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>"; ?> Link to comment https://forums.phpfreaks.com/topic/37449-solved-a-simple-login-not-working/ Share on other sites More sharing options...
trq Posted February 7, 2007 Share Posted February 7, 2007 This... start session(); should be.... session_start(); Link to comment https://forums.phpfreaks.com/topic/37449-solved-a-simple-login-not-working/#findComment-179029 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 Link to comment https://forums.phpfreaks.com/topic/37449-solved-a-simple-login-not-working/#findComment-179031 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()? Link to comment https://forums.phpfreaks.com/topic/37449-solved-a-simple-login-not-working/#findComment-179033 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();\'> Link to comment https://forums.phpfreaks.com/topic/37449-solved-a-simple-login-not-working/#findComment-179036 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? Link to comment https://forums.phpfreaks.com/topic/37449-solved-a-simple-login-not-working/#findComment-179038 Share on other sites More sharing options...
DeathStar Posted February 7, 2007 Author Share Posted February 7, 2007 yes Link to comment https://forums.phpfreaks.com/topic/37449-solved-a-simple-login-not-working/#findComment-179040 Share on other sites More sharing options...
trq Posted February 7, 2007 Share Posted February 7, 2007 Where? Link to comment https://forums.phpfreaks.com/topic/37449-solved-a-simple-login-not-working/#findComment-179042 Share on other sites More sharing options...
DeathStar Posted February 7, 2007 Author Share Posted February 7, 2007 oh.. havnt defined it yet :-\ Link to comment https://forums.phpfreaks.com/topic/37449-solved-a-simple-login-not-working/#findComment-179046 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. Link to comment https://forums.phpfreaks.com/topic/37449-solved-a-simple-login-not-working/#findComment-179047 Share on other sites More sharing options...
DeathStar Posted February 7, 2007 Author Share Posted February 7, 2007 :'( Link to comment https://forums.phpfreaks.com/topic/37449-solved-a-simple-login-not-working/#findComment-179048 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.