alivec Posted March 17, 2008 Share Posted March 17, 2008 Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\checklogin.php on line 15 i get this error when i enter this script please help.. <? $host = "localhost"; $username = ""; $password = ""; $db_name ="alivecsetup"; $tbl_name ="members"; mysql_connect($host, $username, $password) or die ("Can't Connect"); mysql_select_db($db_name) or die(mysql_error()); $myusername = $_POST['myusername']; $mypassword = $_POST['mypassword']; $sql = "SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'" $result = mysql_query($sql); $count = mysql_num_rows($result); if($count==1) { Session_register("myusername"); Sesion_register("mypassword"); header("location:login_success.php"); } else { Echo "Wrong username or password"; } ?> Quote Link to comment Share on other sites More sharing options...
peranha Posted March 17, 2008 Share Posted March 17, 2008 $sql = "SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'" should be $sql = "SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; you are missing the ; Quote Link to comment Share on other sites More sharing options...
alivec Posted March 17, 2008 Author Share Posted March 17, 2008 thanks but i have another error that im getting Fatal error: Call to undefined function session_is_registerd() in C:\xampp\htdocs\login\login_success.php on line 3 <? $host = "localhost"; $username = "root"; $password = ""; $db_name ="alivecsetup"; $tbl_name ="members"; mysql_connect($host, $username, $password) or die ("Can't Connect"); mysql_select_db($db_name) or die(mysql_error()); $myusername = $_POST['myusername']; $mypassword = $_POST['mypassword']; $sql = "SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result = mysql_query($sql); $count = @mysql_num_rows($result); if($count==1){ Session_register("myusername"); Session_register("mypassword"); header("location:login_success.php"); } else { Echo "wrong username or password"; } ?> thank you in advance Quote Link to comment Share on other sites More sharing options...
peranha Posted March 17, 2008 Share Posted March 17, 2008 we need the code for this page login_success.php Quote Link to comment Share on other sites More sharing options...
alivec Posted March 17, 2008 Author Share Posted March 17, 2008 <? session_start(); if(!session_is_registerd(myusername)) { header("location:mainlogin.php"); } ?> that is login_success.php Quote Link to comment Share on other sites More sharing options...
peranha Posted March 17, 2008 Share Posted March 17, 2008 Where is the function session_is_registered set at. or is it supposed to be if (!isset($_SESSION['myusername'])) Quote Link to comment Share on other sites More sharing options...
alivec Posted March 17, 2008 Author Share Posted March 17, 2008 if (!isset($_SESSION['myusername'])) is supposed to be it Quote Link to comment Share on other sites More sharing options...
Jeremysr Posted March 17, 2008 Share Posted March 17, 2008 You misspelled it: session_is_registered() instead of session_is_registerd() Quote Link to comment Share on other sites More sharing options...
peranha Posted March 17, 2008 Share Posted March 17, 2008 You misspelled it: session_is_registered() instead of session_is_registerd() I completely missed that, better go back to school 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.