Why is the login failing? They should be refused entry...
Posted: Fri Jul 24, 2009 10:54 am
Hello.
This user's email and password are correct.
The "datejoined" entry is 2009-07-24, and the system date (changed laptop date for testing) is 2009-09-11.
In theory, they should be passed to the subscribe.php page, but they pass through this page successfully. Oddly, they are refused on the following page, for which I have no idea. But thing is, they should NOT be passed beyond this page. They should hit subscribe.php.
Any ideas??
This user's email and password are correct.
The "datejoined" entry is 2009-07-24, and the system date (changed laptop date for testing) is 2009-09-11.
In theory, they should be passed to the subscribe.php page, but they pass through this page successfully. Oddly, they are refused on the following page, for which I have no idea. But thing is, they should NOT be passed beyond this page. They should hit subscribe.php.
Any ideas??
Code: Select all
<?php
include "dbconn.php";
$email=mysql_real_escape_string($_POST["email"]);
$password=mysql_real_escape_string($_POST["password"]);
$result = mysql_query ("SELECT * FROM dxusers WHERE email = '$email' AND password = '$password'");
$num_row = mysql_num_rows($result);
if (mysql_num_rows($result)==0)
{ echo "<meta http-equiv='Refresh' content='0 ;URL=index.html'>";}
elseif (mysql_num_rows($result)!=0)
{
while ($row = mysql_fetch_object($result))
{
$today = (date('Y-m-d'));
$regdate = strtotime("$row->datejoined");
$regdatecomplete = date( "Y-m-d", ($regdate) );
$subDateMicrotime = strtotime($regdatecomplete);
$fortnight = date( "Y-m-d", ($subDateMicrotime + (86400*14)) );
$year = substr("$row->subscribed",-10,4);
$month = substr("$row->subscribed",-5,2);
$day = substr("$row->subscribed",-2,2);
$sysyear = substr("$today",-10,4);
$sysmonth = substr("$today",-5,2);
$sysday = substr("$today",-2,2);
$endyear = $year;
$endmonth = ($month + 1);
$endday = $day;
if
(
($month == "08" && $sysmonth == "08") ||
($today <= $fortnight) ||
($sysyear >= $endyear && $sysmonth <= $endmonth && $sysday >= $endday)
)
{
$user = "$row->firstname " . "$row->lastname";
setcookie("user", $user, time()+13600);
setcookie("firstname", $row->firstname, time()+13600);
setcookie("lastname", $row->lastname, time()+13600);
setcookie("email", $email, time()+13600);
setcookie("userid", $row->id, time()+13600);
setcookie("type", $row->type, time()+13600);
if ($row->type == "admin")
{
echo "<meta http-equiv='Refresh' content='0 ;URL=index.php?page=home&menu=home&title=welcome'>";
}
elseif ($row->type == "user")
{
echo "<meta http-equiv='Refresh' content='0 ;URL=index.php?page=home&menu=home&title=welcome'>";
}
}
else
{ echo "<meta http-equiv='Refresh' content='0 ;URL=subscribe.php?id=$row->id'>"; }
}
}
mysql_free_result($result);
mysql_close($sqlconn);
?>