register_globals off solution required
Posted: Thu Sep 21, 2006 4:50 pm
Everah | Please use
login.php contains this >>>>>[/syntax]
ALL OF THIS WORKS BUT THE AUTHENTICATION AFTER LOGIN TAKES PLACE in header1.php which is this >>>>>>>>>>>>>>>>
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?
Please Help
Thank You
Everah | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi
I 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 code
form_login.php file contains this>>>
[syntax="html"]<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>
Code: Select all
include "header.php";
#session_destroy();
unset($user);
#session_start();
$login=trim($_POST["login"]);
$password=trim($_POST["password"]);
$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><?Code: Select all
<?php
if($user=@$GLOBALS['user']){
?><h3>Welcome <?
echo $user["login"];
?>
      &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>
<?
}
?>Please Help
Thank You
Everah | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]