有如下两个php文件:
loginProcess.php
<?php
//echo print_r($_POST);
$admin_id = $_POST['admin_id'];
$pasw = $_POST['password'];
$conn = mysql_connect("localhost","root","root");
if(!$conn) {
die("连接失败".mysql_error());
}
mysql_query("set names utf8");
mysql_select_db("test",$conn);
$sql = "select password form admin where admin_id = $admin_id";
$res = mysql_query($sql,$conn);
if($row=mysql_fetch_assoc($res)) {
if($row['password']==md5($pasw)) {
header("Location:empMnanage.php");
eixt();
}else {
header("Location:login.php?erorr=1");
exit();
}
}
mysql_free_result($res);
mysql_close($conn);
?>
login.php<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<h1>管理员登录系统</h1>
<form action="loginProcess.php" method="post">
<table>
<tr>
<td>用户id</td>
<td><input type="text" name="admin_id"/></td>
</tr>
<tr>
<td>密 码</td>
<td><input type="text" name="password"/></td>
</tr>
<tr>
<td><input type="submit" value="用户登录"></td>
<td><input type="reset" value="重新填写"/></td>
</tr> </table>
</form>
<?php
if(!empty($_GET['erorr'])){
$erroNum = $_GET['erorr'];
if($erroNum==1) {
echo "<font color='red'>用户名有误,请重新输入!</font>";
}
}
?>
</body>
</html>
请问,用login.php提交到处理页面loginProcess.php,用zendStdio怎么没办法debug。还有,处理页面loginProcess.php有什么问题吗?
loginProcess.php
<?php
//echo print_r($_POST);
$admin_id = $_POST['admin_id'];
$pasw = $_POST['password'];
$conn = mysql_connect("localhost","root","root");
if(!$conn) {
die("连接失败".mysql_error());
}
mysql_query("set names utf8");
mysql_select_db("test",$conn);
$sql = "select password form admin where admin_id = $admin_id";
$res = mysql_query($sql,$conn);
if($row=mysql_fetch_assoc($res)) {
if($row['password']==md5($pasw)) {
header("Location:empMnanage.php");
eixt();
}else {
header("Location:login.php?erorr=1");
exit();
}
}
mysql_free_result($res);
mysql_close($conn);
?>
login.php<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<h1>管理员登录系统</h1>
<form action="loginProcess.php" method="post">
<table>
<tr>
<td>用户id</td>
<td><input type="text" name="admin_id"/></td>
</tr>
<tr>
<td>密 码</td>
<td><input type="text" name="password"/></td>
</tr>
<tr>
<td><input type="submit" value="用户登录"></td>
<td><input type="reset" value="重新填写"/></td>
</tr> </table>
</form>
<?php
if(!empty($_GET['erorr'])){
$erroNum = $_GET['erorr'];
if($erroNum==1) {
echo "<font color='red'>用户名有误,请重新输入!</font>";
}
}
?>
</body>
</html>
请问,用login.php提交到处理页面loginProcess.php,用zendStdio怎么没办法debug。还有,处理页面loginProcess.php有什么问题吗?
解决方案 »
- php 缩略图 imagecreatefromstring
- php会员注册问题
- win2003下面 IIS配置了PHP以后,出现HTTP404 找不到PHP页?
- 如何输入一个file函数得到的所有内容
- 如何将一个php的数组变成javascript数组
- Php加密及php+apache+mysql整体安装包
- 运行phpmyadmin,但却再现这样的提示,什么意思
- http://www.fujialine.com/proe-view.php3这页为什么会出错??在线等侯
- ab小工具问题
- 请问,代码哪里出现了问题,如果没有文件域直接点击上传按钮,我的逻辑是显示“别玩我了”。但是此时点击按钮没有效果
- 已经装了MySQL,还可以装Wamp吗?
- 关于程序在360浏览器下蛋疼的问题
from 不是form。 再没发现什么错
PHP是远程调试,你要找下相关配置文档。
要注意端口号。默认调试端口号可能有冲突,这是我安装的经验。
----------------------------------------------
另外你代码登录成功后要创建Session。否则很容易被非法登录。
1#正解。