thesavior
01-05-2006, 03:53 AM
if($login_username=="")
is always returning true, when i don't think it should. This is how it is set up.
adminlogin.php
<?php
session_start();
include "../includes/config.inc.php";
mysql_connect ($dbhost, $dbusername, $dbuserpass);
mysql_select_db($dbname) or die(mysql_error());
$query="SELECT * from $logtable where username='$username' and password='$password'";
$result= mysql_query($query) or die("Could not execute query: $q." . mysql_error());
if (mysql_num_rows($result) == 0)
{
echo "<div align=center><b>Oops! Your login is wrong. Please click back and try again.</b></div>";
}
else
{
session_register("$login_username");
Header("Location: protected.php");
}
?>
protected.php
<?php
if($login_username=="") {
Header("Location: ../index.php?act=admin");
} else {
include "../includes/config.inc.php";
switch($act)
{
case 'in': include('edittuts.php'); break;
default: include('admin.php'); break;
}
}
?>
I don't think this is supposed to be happening, but i can't figure out why it is...huh...
is always returning true, when i don't think it should. This is how it is set up.
adminlogin.php
<?php
session_start();
include "../includes/config.inc.php";
mysql_connect ($dbhost, $dbusername, $dbuserpass);
mysql_select_db($dbname) or die(mysql_error());
$query="SELECT * from $logtable where username='$username' and password='$password'";
$result= mysql_query($query) or die("Could not execute query: $q." . mysql_error());
if (mysql_num_rows($result) == 0)
{
echo "<div align=center><b>Oops! Your login is wrong. Please click back and try again.</b></div>";
}
else
{
session_register("$login_username");
Header("Location: protected.php");
}
?>
protected.php
<?php
if($login_username=="") {
Header("Location: ../index.php?act=admin");
} else {
include "../includes/config.inc.php";
switch($act)
{
case 'in': include('edittuts.php'); break;
default: include('admin.php'); break;
}
}
?>
I don't think this is supposed to be happening, but i can't figure out why it is...huh...