DeathStar Posted February 7, 2007 Share Posted February 7, 2007 I made a simple login for a page.. but for some reson its not working?!? error: Parse error: syntax error, unexpected T_STRING in 1/2/3/4/login_test.php on line 2 here the code: <?php start session(); include 'config.php'; $ip = $_SERVER['REMOTE_ADDR']; $charid = $_POST['charid']; $year=date('Y'); session_login (); if (!$_POST['charid']) { print "ID?"; } else if (!$_POST['passwd']) { print "Password?"; } else { mysql_query("UPDATE TABLE 'users' SET logedin='0' WHERE charid=$charid"); mysql_query("UPDATE TABLE 'users' SET ip='$ip',laston=unix_timestamp() WHERE charid=$charid"); } header("Location:home.php"); print "<title>Admin Panel :: IP $ip</title><br /> <form action=login_test.php method=post name=login onsubmit=\'session_login();\'>ID: <input type=text name=charid><br> Password: <input type=password name=passwd><br> <input type=submit value=login></form>"; ?> Quote Link to comment Share on other sites More sharing options...
trq Posted February 7, 2007 Share Posted February 7, 2007 This... start session(); should be.... session_start(); Quote Link to comment Share on other sites More sharing options...
DeathStar Posted February 7, 2007 Author Share Posted February 7, 2007 have tried it that way it then gives me this error: Fatal error: Call to undefined function: session_login() in /1/2/3/4/login_test.php on line 8 Quote Link to comment Share on other sites More sharing options...
trq Posted February 7, 2007 Share Posted February 7, 2007 Where do you define the function session_login()? Quote Link to comment Share on other sites More sharing options...
DeathStar Posted February 7, 2007 Author Share Posted February 7, 2007 well.. <form action=login_test.php method=post name=login onsubmit=\'session_login();\'> Quote Link to comment Share on other sites More sharing options...
trq Posted February 7, 2007 Share Posted February 7, 2007 Sorry, that is where you try and call this function. However, you cannot call php functions from javascript as php runs on the server and javascript on the client. However... I asked where you define this function? session_login() is not a standard php function... have you defined this function yourself? Quote Link to comment Share on other sites More sharing options...
DeathStar Posted February 7, 2007 Author Share Posted February 7, 2007 yes Quote Link to comment Share on other sites More sharing options...
trq Posted February 7, 2007 Share Posted February 7, 2007 Where? Quote Link to comment Share on other sites More sharing options...
DeathStar Posted February 7, 2007 Author Share Posted February 7, 2007 oh.. havnt defined it yet :-\ Quote Link to comment Share on other sites More sharing options...
trq Posted February 7, 2007 Share Posted February 7, 2007 Well that is the reason you get the.... Call to undefined function error. Quote Link to comment Share on other sites More sharing options...
DeathStar Posted February 7, 2007 Author Share Posted February 7, 2007 :'( 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.