返回信息流修改密码的后台程序,有时候明明密码修改成功了还提示我“旧密码输入错误”!
有可能是修改完了跳转不成功?php.ini里的output_bufering 设置问题?
请问该怎么改呢?*修改密码那段是用socket交给私服程序执行的,可以不看。
<?php
$login=false;
session_start();
if(!empty($_SESSION['user']) )//&& $_SESSION['user']=='admin')
$login=true;
if($login)
{
$oldPasswd=$_POST["oldPasswd"];
$passwd=$_POST["newPasswd"];
$message="";
//获取本地password
$arr=parse_ini_file("/btplug/server/btplug.ini",true);
if(strcmp($arr['BTPLUG']['aaaa'],$oldPasswd)==0)
{
//发送重启指令
error_reporting (E_ALL);
// Get the port for the WWW service.
$service_port = "59173";
// Get the IP address for the target host.
$address = gethostbyname($_SERVER['SERVER_NAME']);
$address = strtok($address,':');
// Create a TCP/IP socket.
$socket = socket_create (AF_INET, SOCK_STREAM, 0);
if ($socket < 0) {
// echo "socket_create() failed: reason: " . socket_strerror ($socket)."</br>";
exit;
}
$result = socket_connect ($socket, $address, $service_port);
if ($result < 0) {
// echo "socket_connect() failed."."Reason: ($result) " . socket_strerror($result)."</br>";
exit;
}
$passwd=str_pad($passwd,32,"\x00");
$oldPasswd=str_pad($oldPasswd,32,"\x00");
$in ="\xfe"."\x00\x00\x00\x4A"."\x00"."\x00\x00"."\xCD".$passwd.$oldPasswd."\xef";
$out = '';
socket_write($socket, $in, strlen($in));
if($out = socket_read ($socket, 2048, PHP_BINARY_READ))
{
// echo $out;
}
socket_close ($socket);
}
else
{
$message=1;
}
if($message == 1)
{
echo "<meta http-equiv='Content-Type'' content='text/html; charset=utf-8'>";
echo "<script language=\"JavaScript\" type=\"text/javascript\">";
echo "alert(\"旧密码输入错误!\");";
echo "history.back();\r\n";
echo "</script>";
exit;
}
else if($message == "")
{
echo "<meta http-equiv='Content-Type'' content='text/html; charset=utf-8'>";
echo "<script language=\"JavaScript\" type=\"text/javascript\">";
echo "alert(\"设置成功!\");";
echo "history.back();\r\n";
echo "</script>";
exit;
}
}
else
{
echo "<meta http-equiv='Content-Type'' content='text/html; charset=utf-8'>";
echo "<script language=\"JavaScript\" type=\"text/javascript\">";
echo "alert(\"网页已过期,请重新登录!\");";
echo "location.replace(\"index.php\");";
echo "</script>";
}
?>
这是一条镜像帖。来源:北邮人论坛 / www-technology / #12091同步于 2011/1/7
该镜像源已超过 30 天没有更新,可能在源站已被删除。
WWWTechnology机器人发帖
【求助】一个简单的php后台验证程序执行顺序总是出错....
tongcheng
2011/1/7镜像同步0 回复
订阅后,新回复会通过你的通知中心匿名送达。
0 条回复
暂无回复 · 你可以订阅本帖等待新回复。