k21chrono Posted October 6, 2009 Share Posted October 6, 2009 Parse error: syntax error, unexpected T_ELSE in /home/content/m/e/s/mesick/html/students/05/php/checklogin.php on line 13 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <?php $myusername=$_POST['username']; $mypassword=$_POST['password']; if($myusername='********'&&$mypassword='********') header('Location:http://www.mesickonline.com/students/05/php/index.html'); else($myusername='********'&&$mypassword='********') header('Location:http://www.mesickonline.com/students/05/php/index.html'); ?> <body> </body> </html> Quote Link to comment Share on other sites More sharing options...
k21chrono Posted October 6, 2009 Author Share Posted October 6, 2009 P.S. this was posted by my friend....not me, he wants to use my Account for his web page class Quote Link to comment Share on other sites More sharing options...
Mchl Posted October 6, 2009 Share Posted October 6, 2009 Tell him to use code tags, and read PHP manual on if-else syntax. He needs curly braces if($myusername=='********'&&$mypassword='********') { header('Location:http://www.mesickonline.com/students/05/php/index.html'); } elseif($myusername=='********'&&$mypassword='********') { header('Location:http://www.mesickonline.com/students/05/php/index.html'); } Quote Link to comment Share on other sites More sharing options...
k21chrono Posted October 6, 2009 Author Share Posted October 6, 2009 Tell him to use code tags, and read PHP manual on if-else syntax. He needs curly braces if($myusername=='********'&&$mypassword='********') { header('Location:http://www.mesickonline.com/students/05/php/index.html'); } elseif($myusername=='********'&&$mypassword='********') { header('Location:http://www.mesickonline.com/students/05/php/index.html'); } He says thanks....lol Quote Link to comment Share on other sites More sharing options...
k21chrono Posted October 6, 2009 Author Share Posted October 6, 2009 ok now its still being a pain Parse error: syntax error, unexpected T_ELSE in /home/content/m/e/s/mesick/html/students/05/php/checklogin.php on line 13 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <?php $myusername=$_POST['username']; $mypassword=$_POST['password']; if($myusername='******'&&$mypassword='********') { header('Location:http://www.mesickonline.com/students/05/php/index.html'); } else($myusername='*******'&&$mypassword='********') { header('Location:http://www.mesickonline.com/students/05/php/index.html'); } ?> Quote Link to comment Share on other sites More sharing options...
Mchl Posted October 6, 2009 Share Posted October 6, 2009 Use tags around your code. 'else' was in line 13 in your previous code. There is a good chance you didn't save or upload your changes. This code doesn't make much sense anyway. It should be 'elseif' instead of 'else' and '==' instead of '='. Quote Link to comment Share on other sites More sharing options...
k21chrono Posted October 7, 2009 Author Share Posted October 7, 2009 Parse error: syntax error, unexpected '{' in /home/content/m/e/s/mesick/html/students/05/php/checklogin.php on line 15 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <?php $myusername=$_POST['username']; $mypassword=$_POST['password']; if($myusername=='*******'&&$mypassword='********') { header('Location:http://www.mesickonline.com/students/05/php/index.html');} else($myusername=='k**********h'&&$mypassword='*********') { header('Location:http://www.mesickonline.com/students/05/php/index.html');} elseif echo ("wronge user or pass") ?> Quote Link to comment Share on other sites More sharing options...
kickstart Posted October 7, 2009 Share Posted October 7, 2009 Hi An else should be an elseif else($myusername=='k**********h'&&$mypassword='*********') while the following elseif should be just an else. elseif echo ("wronge user or pass") All the best Keith ?> Quote Link to comment Share on other sites More sharing options...
k21chrono Posted October 9, 2009 Author Share Posted October 9, 2009 ok now i got no errors but instead of it taking my user or pass and saying heres the next page it just saying wrounge user and pass im trying to make a logg in for another site <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <?php $myusername=$_POST['username']; $mypassword=$_POST['password']; if($myusername=='*******'&&$mypassword='********') { header('Location:http://www.mesickonline.com/students/05/php/index.html');} elseif($myusername=='**********'&&$mypassword='*******') { header('Location:http://www.mesickonline.com/students/05/php/index.html');} else echo ("wronge user or pass") ?> <body> Quote Link to comment Share on other sites More sharing options...
kickstart Posted October 9, 2009 Share Posted October 9, 2009 Hi Couple of = signs missing if($myusername=='*******'&&$mypassword=='********') { header('Location:http://www.mesickonline.com/students/05/php/index.html');} elseif($myusername=='**********'&&$mypassword=='*******') All the best Keith Quote Link to comment Share on other sites More sharing options...
k21chrono Posted October 9, 2009 Author Share Posted October 9, 2009 fixed that now its still going to wronge user and pass <?php $myusername=$_POST['username']; $mypassword=$_POST['password']; if($myusername=='******'&&$mypassword=='*******') { header('Location:http://www.mesickonline.com/students/05/php/index.html');} elseif($myusername=='**********'&&$mypassword=='*******') { header('Location:http://www.mesickonline.com/students/05/php/index.html');} else echo ("wronge user or pass") ?> Quote Link to comment Share on other sites More sharing options...
kickstart Posted October 9, 2009 Share Posted October 9, 2009 Hi Echo out the userid and password to check they are the ones you expect:- <?php $myusername=$_POST['username']; $mypassword=$_POST['password']; if($myusername=='******'&&$mypassword=='*******') { header('Location:http://www.mesickonline.com/students/05/php/index.html'); } elseif($myusername=='**********'&&$mypassword=='*******') { header('Location:http://www.mesickonline.com/students/05/php/index.html'); } else { echo ("wronge user or pass *".$myusername."*".$mypassword."*") } ?> All the best Keith Quote Link to comment Share on other sites More sharing options...
k21chrono Posted October 9, 2009 Author Share Posted October 9, 2009 wronge user or pass *** that is what its echoing now Quote Link to comment Share on other sites More sharing options...
kickstart Posted October 9, 2009 Share Posted October 9, 2009 Hi That suggests the userid and password haven't got to the script. Have you sent them by GET instead of POST? Are the field names defiantly username and password? All the best Keith Quote Link to comment Share on other sites More sharing options...
k21chrono Posted October 9, 2009 Author Share Posted October 9, 2009 thanks ill try that monday that has been making me mad all week Quote Link to comment Share on other sites More sharing options...
k21chrono Posted October 14, 2009 Author Share Posted October 14, 2009 omfg Warning: Cannot modify header information - headers already sent by (output started at /home/content/m/e/s/mesick/html/students/05/php/checklogin.php: in /home/content/m/e/s/mesick/html/students/05/php/checklogin.php on line 14 <code> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; if($myusername=='fishandben'&&$mypassword=='holycrap') { header('Location:mesickonline.com/students/05/php/index.html');} elseif($myusername=='k21chrono'&&$mypassword=='bloody01') { header('Location:http:mesickonline.com/students/05/php/index.html');} else echo ("wronge user or pass *" . $myusername . "*" . $mypassword . "*") ?> </body> </html> </code> Quote Link to comment Share on other sites More sharing options...
kickstart Posted October 14, 2009 Share Posted October 14, 2009 Hi That suggests that you have tried to do a redirect to another page after you have already output something (even a blank line). All the best Keith Quote Link to comment Share on other sites More sharing options...
k21chrono Posted October 14, 2009 Author Share Posted October 14, 2009 its all fixed thanks guys Quote Link to comment 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.