When I go to the admin I am stuck on the login page
Posted: Sat Feb 25, 2012 11:57 am
Hi
I installed a script on my localhost. Everything on the front end of the site appears to be working perfectly. However, when I go to the admin I am stuck on the login page. I am putting in the correct username and password, but the page simply refreshes. I checked my database and everything matches alright. Has this happened to anyone else? And idea on what I can do to resolve it? Thanks.
OBS! I am a newbie
my files look like:
index.php
login.php
I installed a script on my localhost. Everything on the front end of the site appears to be working perfectly. However, when I go to the admin I am stuck on the login page. I am putting in the correct username and password, but the page simply refreshes. I checked my database and everything matches alright. Has this happened to anyone else? And idea on what I can do to resolve it? Thanks.
OBS! I am a newbie
my files look like:
index.php
Code: Select all
<?php
if(!isset($_SESSION))
{
session_start();
}
error_reporting(0);
if (($_GET['error'])=="userorpass"){
$error="User Or Password Is Wrong";
}
if (($_GET['error'])=="fild"){
$error="Please Fill The Fields";
}
if (($_GET['error'])=="page"){
$error="You Can`t Access To This Page You Must Login";
}
if (($_GET['error'])=="ip"){
$error="You Have $_GET[n] Try , Your Ip is Locked";
}
if (($_GET['success'])=="logout"){
$success="Logout Successfully";
}
?>
<html>
<head>
<title>Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<style type="text/css">
input.itext {
background:transparent none repeat scroll 0 0;
border:0 none;
color: #505050;
margin-left:7px;
position:relative;
width:160px;
z-index:140;
}
input.ibutton {
background:transparent none repeat scroll 0 0;
border:0 none;
color: #505050;
margin-left:2px;
position:relative;
width:75px;
z-index:140;
}
</style>
<link href="login.css" rel="stylesheet" type="text/css">
</head>
<body>
script...............
</body>
</html>
Code: Select all
<?php
if(!isset($_SESSION))
{
session_start();
}
?>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php
script.............
$pass = $line['password'].$line['secuirty'];
$user = $line['username'];
}
$name = md5(ereg_replace("^(www.)?([^.]+).[^.]+$", "\\2",$_SERVER['HTTP_HOST']));
$str = md5($_POST['pass']);
if ($str.$name=== $pass){
$_SESSION['adminlogin'] = true;
$_SESSION['admin'] = "$user";
?>
<SCRIPT LANGUAGE="JavaScript">
var URL= 'admin.php'
window.location.href = URL;
</SCRIPT>
<?php
}else{
echo"<SCRIPT LANGUAGE=\"JavaScript\">
var URL= 'index.php?error=userorpass'
window.location.href = URL;
</SCRIPT>";}}
$i = $_SESSION['loginip'];
if($i >=0 ) {
$i = $i +1 ;
$_SESSION['loginip']= $i;
}else{
$i = 0 ;
$_SESSION['loginip']= $i;
};
}
?>