schandhok Posted September 21, 2006 Share Posted September 21, 2006 HiI had created a few php pages for my site which used register_globals as ON but the version of php has been updated at my server and i can no longer user register_globals to authenticate my login. Here is my codeform_login.php file contains this>>><form action="login.php" method=post><table border=0><tr><td>Login</td><td><input type=text name=login size=16></td></tr><tr><td>Password</td><td><input type=password name=password size=16></td></tr><tr><td><a href="prepare_registr.php">REGISTER</a></td><td><input type=submit value=" login "></td>login.php contains this >>>>>include "header.php";#session_destroy();unset($user);#session_start();[color=red]$login=trim($_POST["login"]);$password=trim($_POST["password"]);[/color]$my_user='abcd';$my_pass='1234';$db=mysql_connect(localhost,$my_user,$my_pass);mysql_select_db("blast",$db);$rez = mysql_query("SELECT * FROM users WHERE u_login='$login' and u_password='$password'");if(mysql_num_rows($rez)!=0){list($user["id"],$user["login"],$user["password"],$user[ "mail"],$user["ldate"],$user["fname"],$user["lname"])=mysql_fetch_row($rez);session_register("user");$date=date("Y-m-d");$id=$user["id"];mysql_query("UPDATE users SET u_ldate='$date' WHERE u_id='$id'");mysql_close($db);header("location: index.php");}else{include "header1.php";include "left.php";?><center>       &n bsp    User not found <a href='form_login.php'>Try again</a><?ALL OF THIS WORKS BUT THE AUTHENTICATION AFTER LOGIN TAKES PLACE in header1.php which is this >>>>>>>>>>>>>>>>[color=red]<?phpif($user=@$GLOBALS['user']){?><h3>Welcome <?echo $user["login"];[/color]?>      &n bsp      &n bsp<font color="red" ><a href=prepare_edit_user.php>Update Account</a>      &n bsp<a href=logoff.php>LogOff</a></font></h3><?}?>[font=Verdana]Since register_globals is off if($user=@$GLOBALS['user']){ never comes true and i cannot open my login pages...what other approach can i use to overcome this problem now?[/font]Please HelpThank You Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted September 21, 2006 Share Posted September 21, 2006 will u plz put your code in a code box its as ez as pressing a button or typeing [ code ] and [ /code ] without the spaces Quote Link to comment Share on other sites More sharing options...
trillion Posted September 22, 2006 Share Posted September 22, 2006 Look:http://www.phpfreaks.com/phpmanual/page/faq.misc.html#faq.misc.registerglobals 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.