|
-
Oct 13th, 2006, 08:13 PM
#1
Thread Starter
WiggleWiggle
PHP Error - "Warning"
I created a test server on my computer and when tring to test my login script, it woulnt work, so i create a "auto login" page that would set the session so i would be loged in without loging in. apon loading this page, i got this error:
Code:
<b>Warning</b>: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in <b>Unknown</b> on line <b>0</b><br />
My usual boring signature: Something
-
Oct 13th, 2006, 08:19 PM
#2
Re: PHP Error - "Warning"
i'm not completely sure what it means, but i gather that you're using a method that isn't used anymore, and seems to rely on register_globals being enabled.
post the code you're using.
-
Oct 13th, 2006, 08:38 PM
#3
Thread Starter
WiggleWiggle
Re: PHP Error - "Warning"
Here is what it on the "auto login" page
PHP Code:
<?PHP
$logged_in_admin = "dclamp";
session_register("logged_in_admin");
?>
Here is the actual login code:
PHP Code:
<?PHP
$links = "<A HREF='main.php'>Click here to proceed to the main page</A><BR>
You Will Be Redirected In 2 Seconds.<br>
<META HTTP-EQUIV='refresh' content='2;URL=http://www.homtek.net/admin/main.php'>";
if ($admin && $pass) {
if ($logged_in_admin == $admin) {
echo $admin.", you are already logged in.<BR><BR>";
echo $links;
exit;
}
$result = mysql_query("SELECT * FROM admin_login WHERE username = '".$admin."'
AND password = PASSWORD('".$pass."')");
if (!$result) {
echo "Sorry, there has been an error. Please try again, or contact technical support.";
exit;
}
if (mysql_num_rows($result) > 0) {
$logged_in_admin = $admin;
session_register("logged_in_admin");
echo "Welcome, ".$logged_in_admin.". <BR><BR>";
echo $links;
exit;
} else {
echo "<font color=red>Invalid login. Please try again.</font><BR><BR>";
}
} else if ($admin || $pass) {
echo "<font color=red>Please fill in both fields.</font><BR><BR>";
}
?>
<FORM METHOD=POST ACTION="login.php">
Your username:
<INPUT NAME="admin" TYPE=TEXT MAXLENGTH=20 SIZE=20>
<BR>
Your password:
<INPUT NAME="pass" TYPE=PASSWORD MAXLENGTH=10 SIZE=10>
<BR>
<INPUT TYPE=SUBMIT VALUE="Login">
</FORM>
My usual boring signature: Something
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|