Jump to content

[SOLVED] Problem with wamp installation pls help me


Recommended Posts

Thanks friend for your sincere attention..

well i already started a project for a simple registration page and i understand all the nuke and corners of it ..

but the problem is so silly

that is the php coding is working fine and giving me the pre output and all just goes fine till i click the register button when i click the register button the php source code is again emitted in the browser i would like to say that i installed php through WAMP software and created a user other than root and created a database and tried to push the users data like username,password,ip etc (6 columns)

and the data is not inserted to the database table ..

Please help me guys

did i need to change my php.ini file or any other config file or my apache ini file???

anyway please help me to get  out of this problem

if u can pls add me as ur buddy in gmail or yahoo

its >>> stbalaji2u@gmail.com or stbalaji2u@yahoo.co.in

or mail me to my gmail id thanks in advance i believe you definitely help me outta this problem.

Link to comment
Share on other sites

You'll need to post some code relating to your problem.

 

Make sure you're not using short tags (<? ?> or <?= ?>) when scripting. Short tags is not enabled by default, Ideally you should always code with full php tags (<?php ?> or <?php echo ?>). Also make sure you code all your PHP related content in .php files and not .html files.

 

You should also be running your code from http://localhost.

Link to comment
Share on other sites

yes  i used full php code and also saved it as a php file and run using DevPhp IDE and also tried in external browser (Firefox) the result is same...

and i the last one makes me think i really forget how to make the program execute from local host???

i saved the php file in htdocs in the apache folder and i type localhost/register.php but it shows "Not Found" error what shall i have to do to  :-[

Link to comment
Share on other sites

Yes i attached the screen shot of the browser content when i entered http://localhost or http://127.0.0.1

i think that the html code is executed and the php fails to compile please help me what to do to accept the entered value and make the php coding to work.

well this is the source code i compiled and saved as .php file

 

<?php
$c=mysql_connect("localhost","prakash","thrisha!") or die(mysql_error());
$d=mysql_select_db("users") or die(mysql_error());
function protect($value)
{
$value=mysql_real_escape_string($value);
$value=stripslashes($value);
$value=strip_tags($value);
}
$action=$_GET['act'];
protect($action);

if (!$action)
{
echo   "<table border =0 cellspacing =3 cellpading=1> \n
        <form name=register method=post action=\"register.php?act=register\">\n
        <tr><td>UserName</td> <td><input type =text name=username maxlength=32 >\n </td></tr>\n
        <tr><td>Password</td> <td><input type =text name=password maxlength=64 >\n </td></tr>\n
        <tr><td>Confirm</td> <td><input type =text name=passconf maxlength=64 >\n </td> </tr>\n
        <tr><td>E-Mail</td><td> <input type=text name=email >\n</td></tr>\n
         <tr><td>confirm</td><td> <input type=text name=econf>\n</td></tr>\n
         <tr><td colspan=2 align=center >About You</td></tr>\n <br>
         <tr><td>Birthday (day)</td><td><select name=day> \n";
         
          for ($i=1;$i<32;$i++)
          {
           echo "<option value=\"$i \">$i</option>\n";
          }
echo "<select <td> </tr> \n
      </td></tr>\n <tr><td>Birthday (Month) </td><td><select name=month>\n";
          for ($i=1;$i<13;$i++)
          {
           echo "<option value=\"$i \">$i</option>\n";
          }
echo "<select </td> </tr> \n
      <tr> <td>Birhtday (year) >/td> <td><select name=year>\n ";
      for ($i=1994;$i>1900;$i--)
      {
      echo "<option value=\"$i\">$i</option>\n";
      }
echo "</select></td></tr>\n
      <tr><td>Your name</td><td><input type=text name=name maxlenght=32>\n
      <tr><td colspan=2 align=right> <input type =submit value=\"register\">\n";
           
}
if($action=="register")
{
  	$username=$_POST['username'];
  	$password=$_POST['password'];
  	$passconf=$_POST['passconf'];
  	$email=$_POST['email'];
  	$econf=$_POST['econf'];
  	$day=$_POST['day'];
  	$month=$_POST['month'];
  	$year=$_POST['year'];
  	$name=$_POST['name'];
  	protect($username);
  	protect($password);
  	protect($passconf);
  	protect($email);
  	protect($econf);
  	protect($day);
  	protect($month);
  	protect($year);
  	protect($name);
			   if(isset($username) && isset($password) && isset($passconf) && isset($email) && isset($econf) && isset($day) && isset($month) && isset($year) && isset($name))
			   {
			   	if(strlen($username)<3 || strlen($username)>32)
			   	{
			     echo "Username is either too short or too long \n";
			    }
			    else
			    {
			     if (strlen($password)<3 || strlen($password)>64)
			     {
			     echo "Password is either too short or too long \n";
			     }
			      else
			      {
			       if(strlen($email)<3 || strlen($email)>125)
			       {
			       	echo "Email is either too short or too long \n";
			       }
			        else
			    	{
			    	 if(strlen($name)<3 or strlen($name)>64)
			    	 {
			    	  echo "Your name is either too short or too long";
			    	  }
			    	  else
			    	  {
			    	   if (!is_numeric($day) || !is_numeric($month) || !is_numeric($year))
			    	   {
			    	   	echo "You entered an invalid birthday \n";
			    	   	}
			    	   	else
			    	   	{
			    	   	 if($day<1 || $ $day>31)
			    	   	 {
			    	   	  echo "Your birthday is invalid =wrong day entered \n";
			    	   	  }
			    	   	  else
			    	   	  {
			    	   	   if($month<1 || $month>12)
			    	   	   	{
			    	   		echo "Your birthday is invalid =wrong month entered \n";
			    	   		}
			    	   		else
			    	   		{
			    	   	 	 if ($year<1901 || $year >1994)
		                 	 {
			    	   	  	 echo "Your birthday is invalid =wrong year entered \n";
			    	     	 }
			    	   	 	 else
							 {
							 if($password !=$passconf)
							 {
							  echo "Your Password do not match \n";
							 }
							 else
							 {
							  if($email !=$econf)
							  {
							  echo "Your email doesnt match";
							  }
							  else
							  {
							  $checkemail='/^(\w+\.)*\w+@(\w+\.)+[A-Za-z]+$/';
							  	if(preg_match($checkemail,$email))
							  	{
							  	 echo "the email you entered is not valid";
							  	}
							  	else
							  	{
							  	$sql="SELECT * from users where username=$username";
							  	$result=mysql_query($sql) or die(testa);
							  	if(mysql_num_rows($result)>0)
							  	{
							  	echo "This username already exists";
							  	}
							  	else
							  	{
							  	$sql="SELECT * from users where email=$email";
							  	$result=mysql_query($sql) or die(testb);
							  	if(mysql_num_rows($result)>0)
							  	{
							  	 echo "The email you entered is already used";
							  	}
							  	else
							  	{
							  	 $sql="SELECT * FROM users where ip=$_SERVER[REMOTE_ADDR]";
							  	 $result=mysql_query($sql) or die(testc);
							  	 if(mysql_num_rows($result) >0)
							  	 {
							  	 echo "Your IP is already in use";
							  	 }
							  	 else
							  	 {
							  	 $password=md5($password);
							  	 $bday="$month/$day/$year";
								 $date=date("F j,Y,g:i:s a");
							  	  $sql="INSERT INTO users ('username ','password','email','ip','name','bday','date') VALUES ('$username','$password','$email','$_SERVER[REMOTE_ADDR]','$bday','$date')";
							  	  $res=mysql_query($sql) or die(testd);
							  	  echo "Thankyou for registering";
							  	}
							  	}
							}
							  	

			    	   }	 	 
			    	  } 	
			    }
                
		}	
		}
	   }
	  }

	}
   }	 
}
}
}
}
?>

 

[attachment deleted by admin]

Link to comment
Share on other sites

Hold on you say you have WAMP installed, if that's the case your files should be saved in C:\wamp\www not C:\wamp\Apache\htdocs (or wherever you're saving the files to).

 

AFAIK PHP scripts cannot produce a page cannot be found error, if there are syntax errors.

Link to comment
Share on other sites

The above picture is shown when i typed http://localhost in my firefox browser and the above code is my registration project coding ..

i saved it with .php extension as i said already

did i need to put the .html and .php in a seperate file and want to run the html file??

or else what else can i do to get out of this problem and see my project running??

please help me friends ..

am dying over here :-[

Link to comment
Share on other sites

woooooooooooowwwwwww

 

wildteen u rocksss

 

ur single line makes me out of this problem 

now i replaced my register.php to the directory you said that is c:\wamp\www\register.php and execute as http://localhost/register.php now it sends me echo message which i used to check if the birhtdate is correct or not and i found the message

in short the php coding starts working

and

 

one more trap i actually designed the page with three drop down list one for day(1-30) another for month (1-12) and the last one for year(1901 to 1994)

now the problem is there is an extra two drop down boxes appearing besides day and month list and the year DDbox is just fine

whats the actual problem????

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.