0

安装脚本后,当我尝试使用默认密码或新密码登录管理区域时,它只会让我回到管理登录页面。

登录.php 文件

<?
session_start();
ob_start();
?>
<?php include('../db.php');?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Scripteen FB Covers Script - Admin Control Panel</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<header>
<div class="headcontaint">
<div class="logo"><a href="index.html"><img src="../images/logo.png" width="280" height="74"></a></div>

</div>
</header>
<div class="container">
<div class="maintitle">Login to Admin Contol Panel</div>
<?php
$err=isset($_GET['error'])?$_GET['error']:""; 
if($err=='error'){?>
<div class="errormsgbox">Wrong Username or Password. Please try again.</div>    
<?php }

if(!isset($_SESSION['adminuser'])){
if($_SERVER["REQUEST_METHOD"] == "POST")
{
// username and password sent from Form
$adminuser=mysql_real_escape_string($_POST['adminuser']); 
$adminpassword=mysql_real_escape_string($_POST['adminpassword']); 
$gpassword=md5($adminpassword); // Encrypted Password
$sql="SELECT id FROM admin WHERE adminuser='$adminuser' and adminpassword='$gpassword'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);

// If result matched $username and $password, table row must be 1 row
if($count==1)
{
session_register("adminuser");

header("location:index.php");
}
else
{
header("location:login.php?error=error");

}
}
ob_end_flush();

?>
<div class="box">
<div class="login_box">
<form action="login.php" method="post">
<div class="login_input">
<label class="loginlbl"  for="adminuser">UserName :</label>
<input type="text" name="adminuser"/>
</div>
<div class="login_input">
<label class="loginlbl"  for="adminpassword">Password :</label>
<input type="password" name="adminpassword"/>
</div>
<div class="login_submit">
<input type="submit" id="submit" value=" Login to Admin Contol Panel"/>
</div>
</form>
</div>

</div>
<?php }else{
header("location:index.php");
}

include('footer.php');
?>

有什么问题?> 如果 login.php 文件好,问题在哪里?

4

1 回答 1

0

所以,这是为了给 OP 一些更易读的解释我的评论......

header("location:index.php");
exit; // Stop script from being further executed (doing unwanted stuff in most cases, when continuing)
于 2013-10-07T21:03:18.153 回答