Hi:
I am having trouble with my login page and I can not figure it out. It keeps telling me Invalid Login page...
It is stopping at if==1 then invalid login/password...
I look at it hundreds of time and the password and login is correct I just don't know what is wrong with my code...
Thanks
I am having trouble with my login page and I can not figure it out. It keeps telling me Invalid Login page...
It is stopping at if==1 then invalid login/password...
I look at it hundreds of time and the password and login is correct I just don't know what is wrong with my code...
Code:
<?php
include("./admin/config.php");
include("$include_path/common.php");
include("$include_path/$table_file");
include("$include_path/doc_head.php");
include("$include_path/styles.php");
global $HTTP_POST_VARS,$HTTP_GET_VARS,$HTTP_SESSION_VARS;
global $_SESSION;
if ($HTTP_POST_VARS!="")
$_POST=$HTTP_POST_VARS;
if ($HTTP_GET_VARS!="")
$_GET=$HTTP_GET_VARS;
if ($HTTP_SESSION_VARS!="")
$_SESSION=$HTTP_SESSION_VARS;
$return_message = "";
if(isset($_POST['login'])){
$sql = "
select
username,
id,
is_approved
from
$tb_users
where
username = '$_POST[UN]'
and
password = password('$_POST[PW]')
";
$query = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($query)){
$my_id = (int) mysql_result($query, 0, "id");
$is_approved = mysql_result($query, 0, "is_approved");
if (!empty($is_approved))
{
$_SESSION['username'] = mysql_result($query, 0, "username");
$_SESSION['userid'] = (int) mysql_result($query, 0, "id");
$username=mysql_result($query, 0, "username");
$userid =(int) mysql_result($query, 0, "id");
session_register("username");
session_register("userid");
}
if(($_POST['keep_me_logged_in'] == "Y")&&(!empty($is_approved))){
$md5 = md5(time());
$sql = "
replace into $tb_cookies (
userid,
cookie
) values (
'$_SESSION[userid]',
'$md5'
)
";
$query = mysql_query($sql) or die(mysql_error());
setcookie("keep_me_logged_in", $md5, time() + 31536000);
$_SESSION['sl'] = false;
$sl=false;
session_register("sl");
} else {
$_SESSION['sl'] = true;
$sl=true;
session_register("sl");
}
if (!empty($is_approved))
{
$r = urldecode($_GET['r']);
if (!$r) { $r=urldecode($_POST['r']); }
$url = $base_url . "/" . $r;
$last_logged = date("Y-m-d H:i:s");
$qry = "update $tb_users set last_logged = '$last_logged' where id = '$my_id'";
$res = mysql_query($qry) or die(mysql_error());
}
else
{
$url = $base_url . "/member_pay.php?id=$my_id";
}
// echo " url ".$url."a";
header("Location: $url");
exit();
} else {
$return_message = "Invalid Login name/ Password <br><br>";
}
}
include ("Ads_new.php");
include("$include_path/left.php");
include("$include_path/right.php");
$must_signup = "";
if(isset($_SESSION['m']) && $_SESSION['m'] == 1 && $lf!=1){
$tpl->parse('BLOCK_MUST_SIGNUP', 'block_must_signup');
unset($_SESSION['m']);
} else {
$tpl->clear_dynamic('block_must_signup');
}
$r = urlencode($_GET['r']);
if($lf==1)
$return_message="Invalid Username / Password ";
$tpl->assign(array('RETURN_MESSAGE' => $return_message));
$tpl->assign(array('REDIRECT_URL' => $r));
$tpl->parse('FORM', 'login_page_form');
$login = $tpl->fetch('FORM');
$final_output = table("Login Page", $login);
$tpl->assign(array('CONTENT_TEXT' => $final_output));
$tpl->parse('PAGE', 'main');
$final_output = $tpl->fetch('PAGE');
$final_output = final_output($final_output);
//echo $final_output;
include ("copy.php");
?>