enemeth Posted April 4, 2007 Share Posted April 4, 2007 Hello All, I got a problem, Ofcourse ! i have a checkuser.php for my site , to get users to log in with there credentials that have been emailed to them , all goes well up until log in ! here is the code and error is : Parse error: parse error, unexpected T_VARIABLE in /home/www/thetruthdiscovered.com/checkuser.php on line 16 <? /* Check User Script */ session_start(); // Start Session include 'db.php'; // Conver to simple variables $username = $_POST['username']; $password = $_POST['password']; if((!$username) || (!$password)){ echo "Please enter ALL of the information! <br />"; include 'login.php; exit(); } // Convert password to md5 hash $password = md5($password); // check if the user info validates the db //ERROR IS HERE // $sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' AND activated='1'"); $login_check = mysql_num_rows($sql); if($login_check > 0){ while($row = mysql_fetch_array($sql)){ foreach( $row AS $key => $val ){ $$key = stripslashes( $val ); } // Register some session variables! session_register('first_name'); $_SESSION['first_name'] = $first_name; session_register('last_name'); $_SESSION['last_name'] = $last_name; session_register('email_address'); $_SESSION['email_address'] = $email_address; session_register('special_user'); $_SESSION['user_level'] = $user_level; mysql_query("UPDATE users SET last_login=now() WHERE userid='$userid'"); header("Location: login_success.php"); } } else { echo "You could not be logged in! Either the username and password do not match or you have not validated your membership!<br /> Please try again!<br />"; include 'login.php'; } ?> Can someone go over that and tell me why i keep getting that error ? BTW the users are already activated to 1 Thank you for all your help Elaine Link to comment https://forums.phpfreaks.com/topic/45547-solved-log-in-script/ Share on other sites More sharing options...
jitesh Posted April 4, 2007 Share Posted April 4, 2007 <? /* Check User Script */ session_start(); // Start Session include 'db.php'; // Conver to simple variables $username = $_POST['username']; $password = $_POST['password']; if((!$username) || (!$password)){ echo "Please enter ALL of the information! "; include 'login.php; // i think Prb is here 'login.php'(forget to close quates) exit(); } Link to comment https://forums.phpfreaks.com/topic/45547-solved-log-in-script/#findComment-221103 Share on other sites More sharing options...
enemeth Posted April 4, 2007 Author Share Posted April 4, 2007 Yea i see that now, just changed that , thank you , but now instead of going to the members area , i get the exact message again , but stating that i must enter ALL information, but i do ! do you see anything else that is wrong? Elaine Link to comment https://forums.phpfreaks.com/topic/45547-solved-log-in-script/#findComment-221106 Share on other sites More sharing options...
jitesh Posted April 4, 2007 Share Posted April 4, 2007 Post next error Link to comment https://forums.phpfreaks.com/topic/45547-solved-log-in-script/#findComment-221111 Share on other sites More sharing options...
enemeth Posted April 4, 2007 Author Share Posted April 4, 2007 no error, just the login.php page with the comment on the page that i should enter ALL information, and i do enter the username and password that was emailed to me Link to comment https://forums.phpfreaks.com/topic/45547-solved-log-in-script/#findComment-221119 Share on other sites More sharing options...
enemeth Posted April 4, 2007 Author Share Posted April 4, 2007 anyone know why i get that error when it should continue past that part of the code and log me in ? Thanks , Elaine Link to comment https://forums.phpfreaks.com/topic/45547-solved-log-in-script/#findComment-221170 Share on other sites More sharing options...
aebstract Posted April 4, 2007 Share Posted April 4, 2007 if(!isset($username) || !isset($password)){ echo "Please enter ALL of the information! "; include 'login.php'; exit(); } edit: Don't forget to check the code I just posted again. I noticed you were missing a ' in your include line, so I updated that also. edit2: I just realized that the ' problem was already addressed Link to comment https://forums.phpfreaks.com/topic/45547-solved-log-in-script/#findComment-221184 Share on other sites More sharing options...
enemeth Posted April 4, 2007 Author Share Posted April 4, 2007 Thank you , i placed that code instead of mine! but it still brings me back to the login screen with the error Please enter ALL of the information! Elaine Link to comment https://forums.phpfreaks.com/topic/45547-solved-log-in-script/#findComment-221213 Share on other sites More sharing options...
enemeth Posted April 4, 2007 Author Share Posted April 4, 2007 anyone know why this script isnt working? Elaine Link to comment https://forums.phpfreaks.com/topic/45547-solved-log-in-script/#findComment-221280 Share on other sites More sharing options...
enemeth Posted April 4, 2007 Author Share Posted April 4, 2007 its all good i figured it out was my login.php , the names of the form were not matching with my database ! thanks anyways! Elaine Link to comment https://forums.phpfreaks.com/topic/45547-solved-log-in-script/#findComment-221306 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.