Hi,
I've used Kevin's accesscontrol script for an admin section. My problem is how does it need to be rewritten to work with register_globals OFF? I'm having trouble with my session variables etc, and I'm not quite sure what I have to change in the script. I'm still using 4.1, however I am updating my site in case the host upgrades to 4.2.
Here is Kevins script:
Hope someone can help me with this!!PHP Code:session_start();
if(!isset($uid))
{ ?>
<html>
<head>
<title> Please Log In for Access </title> </head> <body>
<h1> Login Required </h1>
<p>You must log in to access this area of the site.
If you are not a registered user, <a href="signup.php">click here</a> to sign up for instant access!</p>
<p><form method="post" action="<?=$PHP_SELF?>"> User ID: <input type="text" name="uid" size="8"><br>
Password: <input type="password" name="pwd" SIZE="8"><br>
<input type="submit" value="Log in">
</form></p>
</body>
</html>
<?php
exit;
}
session_register("uid");
session_register("pwd");
dbConnect("sessions");$sql = "SELECT * FROM user WHERE userid = '$uid' AND password = PASSWORD('$pwd')";
$result = mysql_query($sql);
if (!$result)
{
error("A database error occurred while checking
your "."login details.\\nIf this error persists,
please "."contact [email]kevin@sitepoint.com[/email].");}
if (mysql_num_rows($result) == 0)
{
session_unregister("uid");
session_unregister("pwd");
?>
<html>
<head>
<title> Access Denied </title>
</head>
<body>
<h1> Access Denied </h1>
<p>Your user ID or password is incorrect,
or you are not a registered user on this site.
To try logging in again, click <a href="<?=$PHP_SELF?>">here</a>.
To register for instant access, click <a href="signup.php">here</a>.</p>
</body>
</html>
<?php
exit;
}






Bookmarks