安装脚本后,当我尝试使用默认密码或新密码登录管理区域时,它只会将我踢回管理员登录页面。
login.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');
?>
问题是什么?&gt; 如果login.php文件好的地方在哪里?
答案 0 :(得分:0)
所以,这是给OP一些更可读的解释我的评论...
header("location:index.php");
exit; // Stop script from being further executed (doing unwanted stuff in most cases, when continuing)