跳转问题,登录成功后进入index.php之前一直弹出验证码错误,然后又返回到login.php。
<?php require_once '../include.php'; $username = $_POST['username']; $password = $_POST['password']; $verify = $_POST['verify']; $verify1 = $_SESSION['verify']; if ($verify==$verify1){ $sql = "select *from imooc_admin where username='{$username}'and password ='{$password}'"; $row = checkAdmin($sql); if ($row){ $_SESSION['adminName'] = $res['username']; $_SESSION['adminId'] = $row['id']; alertMes("登陆成功","admin.php"); } else{ alertMes("登录失败,请重新登录","login.php"); } } else if($verify!=$verify1){ alertMes("验证码错误,请重新登录","admin.php");//bug }
index.php被我改成了admin.php.