<?php
session_start();
$hostname="{".$_POST[hostname].":pop3/110}";
$username=$_POST[username];
$userpwd=$_POST[userpwd];
if(!$mbox=@imap_open("$hostname","$username","$userpwd")){
echo "<script>alert('登录失败!');window.location.href='index.php';</script>";
}else{
session_register("host");
session_register("user");
session_register("pwd");
$_SESSION[host]=$hostname;
$_SESSION[user]=$username;
$_SESSION[pwd]=$userpwd;
imap_close($mbox);
echo "<script>window.location.href='lookmail.php';</script>";
}
?>
在登陆界面输入邮件服务器IP和邮箱名,邮箱密码后提交到上面代码处理,出现空白页面,无法跳转,求教
直接服务器跳转就可以了。
你输出的js,在客户端可能被转义编码,没当成js。
看你客户端输出了什么。
右键,查看源代码看有什么内容。可能是乱码了导致脚本出错,给script增加charset为你当前站点的编码试试
echo "<script charset='gb2312'>alert('登录失败!');window.location.href='index.php';</script>";
echo "<script charset='gb2312'>window.location.href='lookmail.php';</script>";
如果是其他编码注意修改charset的值