<?php sertakan "../common/dbsession.php"; session_start(); if(isset($_SESSION['user'])){ header('location:../content/home.php'); }lain{ if(isset($_POST['vcode'])){ if($_POST['vcode']==$_SESSION['vcode']){ //核对数 据_connect("10.21 .54.99:3306","c322","20210409","c322"); $sql="select * from `user` where `email`='".$_POST['zh']."'"; $res=mysqli_query($conn,$sql); mysqli_fetch_array($res); /*if (!$res){ printf("Ralat: %sn", mysqli_error($conn)); keluar(); }*/ $row=mysqli_fetch_assoc($res); if(!$conn){ die("连接失败".mysqli_connect_error()); } //var_dump($res); if(isset($row['pw'])){//表中存在 if(md5($_POST['pw'])==$row['pw']){ = ; ESSION $_SESSION['user']=$_POST['zh']; //登陆成功 echo "3"; }lain{ echo "2";//账户不存在 } } else{ } } else{ ; 篪 //session_destroy (); } keluar; } }?><!doctype html><html> <title>Log masuk pengguna</title> <meta charset="utf-8"> ="../resource/jquery-3.2.1.min.js"></script> <link rel="style.css" href="../login.css"> ; <body> <div style="text-align:center;margin-top:20px;"> <div>Selamat masuk < > </div> </borang> (".vcode").val(), "zh":$( ".zh").val(), "pw":$(".pw").val()}, function(res){ alert(res); if(res==0){ window.location.href = "../ Content/Home.php";} Lain jika (res == 1) {alert ("Kod pengesahan Kesalahan input, sila semula! "); Input akaun yang salah, sila masuk semula!"); /html>
Jangan ulas pernyataan ini untuk melihat sama ada ia masalah parameter mysqli_fetch_assoc() atau masalah pernyataan sql