grlayouts Posted February 7, 2010 Share Posted February 7, 2010 Hi, I have created a login that once worked on another server and i have changed the register globals on in the php.ini.. when I hit login the page does nothing.. the page is located at www.ycreate.com/sos to see what i mean the login code is below.. any idea's? LOGIN FORM <form method="post" action="index.php?cmd=login"> <font size="3"><B>PLAYERS LOG IN BELOW</B><br /> <br /> <BR> </font><table border="0" style="font-family = Verdana; font-size = 12px"> <tr><td><font size="1">Username:</font></td><td><font size="1"><input type="text" size="15" name="inUser" style="<?php echo $boxStyle; ?>"></font></td></tr> <tr><td><font size="1">Password:</font></td><td><font size="1"><input type="password" size="15" name="inPass" style="<?php echo $boxStyle; ?>"></font></td></tr> <tr><td colspan="2" align="center"><font size="1"><input type="submit" value="Login"></font></td></tr> </table></form> LOGIN SCRIPT (DB CONNECT) <? if ($cmd == "login") { setcookie('sosuser' , $inUser); setcookie('sospass' , $inPass); if ($_COOKIE['sossess'] == "") { $sql = "SELECT val FROM tickers WHERE id=1"; $r = mysql_query($sql); $row = mysql_fetch_row($r); $next = $row[0]; setcookie('sossess', $next, time()+60*60*24*365); $sql = "UPDATE tickers SET val=val+1 WHERE id=1"; mysql_query($sql); } header('location: index.php?cmd=home'); }else if ($cmd == "logout") { setcookie('sosuser' , ' '); setcookie('sospass' , ' '); header('location: index.php'); } if ($cmd == '') { $cmd = 'default'; } $userid = -1; if (in_array($cmd, $iPages)) { $sql = "SELECT id,team FROM users WHERE username='{$_COOKIE['sosuser']}' AND password='{$_COOKIE['sospass']}'"; $r = mysql_query($sql); if (mysql_num_rows($r) == 0) { $cmd = "badlogin"; }else { $row = mysql_fetch_row($r); $userid = $row[0]; $teamid = $row[1]; $sql = "UPDATE users SET lastaction=".time()." WHERE id={$userid}"; mysql_query($sql); } } include ("serv.php"); if (!in_array($cmd, $noHeader)) { echo 'LOGGED IN' {; ?> Quote Link to comment https://forums.phpfreaks.com/topic/191237-login-does-nothing/ Share on other sites More sharing options...
PFMaBiSmAd Posted February 7, 2010 Share Posted February 7, 2010 Register_globals were turned off by default nearly 8 years ago because they were the stupidest thing a programming language ever did. They have been completely removed in php6. Instead of wasting your time every time you switch servers, just spend a little time fixing your code to use the correct variable where the data is coming from, it will work on all server configurations - $cmd = $_GET['cmd']; You should also use full opening <?php tags to again keep from wasting your time every time you switch servers and the short open tag setting is not ON. Full opening tags will work on all server configurations. Quote Link to comment https://forums.phpfreaks.com/topic/191237-login-does-nothing/#findComment-1008322 Share on other sites More sharing options...
grlayouts Posted February 7, 2010 Author Share Posted February 7, 2010 but even with the globals bring on i should get some sort of reponse from the form? Quote Link to comment https://forums.phpfreaks.com/topic/191237-login-does-nothing/#findComment-1008326 Share on other sites More sharing options...
PFMaBiSmAd Posted February 7, 2010 Share Posted February 7, 2010 Did you check if register_globals were actually ON? In programming, you cannot ASSUME * anything. You must always check to make sure what a value is. It is not enough to just change a setting because there are a dozen different things that could prevent that setting from taking affect. * ASSUME = To make an ASS out of U and ME Quote Link to comment https://forums.phpfreaks.com/topic/191237-login-does-nothing/#findComment-1008394 Share on other sites More sharing options...
grlayouts Posted February 7, 2010 Author Share Posted February 7, 2010 yes im sure it's on. i changed the php.ini file Quote Link to comment https://forums.phpfreaks.com/topic/191237-login-does-nothing/#findComment-1008467 Share on other sites More sharing options...
teamatomic Posted February 7, 2010 Share Posted February 7, 2010 OK...but...as PFMaBiSmAd suggested, have you actually checked via phpinfo() ? HTH Teamatomic Quote Link to comment https://forums.phpfreaks.com/topic/191237-login-does-nothing/#findComment-1008487 Share on other sites More sharing options...
grlayouts Posted February 7, 2010 Author Share Posted February 7, 2010 yeah Quote Link to comment https://forums.phpfreaks.com/topic/191237-login-does-nothing/#findComment-1008491 Share on other sites More sharing options...
teamatomic Posted February 7, 2010 Share Posted February 7, 2010 You maybe need to clear data on your side cause I just tried the url you supplied and it works. HTH Quote Link to comment https://forums.phpfreaks.com/topic/191237-login-does-nothing/#findComment-1008497 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.