stbalaji2u Posted August 10, 2008 Share Posted August 10, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/119019-solved-problem-with-wamp-installation-pls-help-me/ Share on other sites More sharing options...
wildteen88 Posted August 10, 2008 Share Posted August 10, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/119019-solved-problem-with-wamp-installation-pls-help-me/#findComment-612870 Share on other sites More sharing options...
stbalaji2u Posted August 11, 2008 Author Share Posted August 11, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/119019-solved-problem-with-wamp-installation-pls-help-me/#findComment-613169 Share on other sites More sharing options...
wildteen88 Posted August 11, 2008 Share Posted August 11, 2008 What happens if you go to just http://localhost Quote Link to comment https://forums.phpfreaks.com/topic/119019-solved-problem-with-wamp-installation-pls-help-me/#findComment-613383 Share on other sites More sharing options...
stbalaji2u Posted August 11, 2008 Author Share Posted August 11, 2008 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] Quote Link to comment https://forums.phpfreaks.com/topic/119019-solved-problem-with-wamp-installation-pls-help-me/#findComment-613524 Share on other sites More sharing options...
wildteen88 Posted August 11, 2008 Share Posted August 11, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/119019-solved-problem-with-wamp-installation-pls-help-me/#findComment-613526 Share on other sites More sharing options...
stbalaji2u Posted August 11, 2008 Author Share Posted August 11, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/119019-solved-problem-with-wamp-installation-pls-help-me/#findComment-613528 Share on other sites More sharing options...
wildteen88 Posted August 11, 2008 Share Posted August 11, 2008 Re-read read my post, I am asking WHERE you are saving the file. Quote Link to comment https://forums.phpfreaks.com/topic/119019-solved-problem-with-wamp-installation-pls-help-me/#findComment-613530 Share on other sites More sharing options...
stbalaji2u Posted August 11, 2008 Author Share Posted August 11, 2008 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???? Quote Link to comment https://forums.phpfreaks.com/topic/119019-solved-problem-with-wamp-installation-pls-help-me/#findComment-613539 Share on other sites More sharing options...
stbalaji2u Posted August 11, 2008 Author Share Posted August 11, 2008 wildteen can i know your yahoo id can we please chat on some day?? Quote Link to comment https://forums.phpfreaks.com/topic/119019-solved-problem-with-wamp-installation-pls-help-me/#findComment-613540 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.