<?php session_start() && error_reporting(0); header("Content-type: text/html; charset=utf-8"); require './include/db.php'; if($_SERVER['REQUEST_METHOD']=="POST"){ $validate=""; $username = guolv($_POST['username']); $password = guolv($_POST['password']); $password = md5(crypt($password,substr($password,0,2))); $yzm = guolv($_POST["validate"]); if(isset($yzm)){ $validate=$yzm; if($validate!=$_SESSION["authnum_session"]) { $zt = "<font color=red>验证码不对</font>"; echo "<script>alert('验证码不对!');window.history.go(-1);</script>";exit; session_destroy();//清除 } else { $result=mysql_query("SELECT * FROM wq_user where username='$username' and password='$password' and y=1"); $num=mysql_num_rows($result); if($num<1) { $zt = "<font color=red>用户名或密码错误</font>"; echo "<script>alert('用户名或密码错误!');window.history.go(-1);</script>";exit; } else { date_default_timezone_set("PRC"); $time=date("Y-m-d H:i:s", time()); $ip=ip(); mysql_query("update wq_user set lastloginip=loginip,loginip='$ip',lastlogintime=logintime,logintime='$time' where username='$username'"); $_SESSION['username'] = $username; setcookie("name","dsms"); if($url<>"") { echo "<script> window.location.href='".$url."';</script>"; } else { echo "<script> window.location.href='./';</script>"; } } } } } ?> <!doctype html> <html class="x-admin-sm">
这个php代码是有问题么?为什么我去掉可以显示网页,加入php代码在网页前面就无法连接显示错误:500。求大神指点一下是不是if语句错了。