国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

不判斷哪里錯(cuò)了,請(qǐng)大神指教
cq
cq 2018-04-29 22:06:26
0
5
1053

<?php?

header("content-type:text/html:charset=utf-8");

include("conn.php");


if(isset($_POST['submitted'])){?

? ? $user = $_POST['user'];?

? ? $pwd = $_POST['pwd'];?

? ? $sql = 'select * from name where user="'.$user.'"';?

? ? //$sql = "select * from name where user = '.$user'";

? ? $result = mysqli_query($conn,$sql) ;


? ? $row = mysqli_fetch_array($result);

? ? $cmp_pwd = $row['password'];

? ? $quan =$row['quan'];

? ? $xbb = 1;

? ? $fx = 0;


? ? if( $cmp_pwd == $pwd && $quan == $xbb){ //用從數(shù)據(jù)庫(kù)取出的密碼和提交的密碼比較

?

? ? ? ? ? ? ? ? echo "<script language=javascript>alert('登錄成功');</script>";?

? ? ? ? Header("Location:addhc1.php");?

? ? ? ? //跳轉(zhuǎn)到指定頁(yè)面?

?

? ? }elseif($cmp_pwd1 == $pwd && $quan == $fx){

? ? ? ? echo "<script language=javascript>alert('用戶名或密碼錯(cuò)誤');</script>";?

? ? ? ? Header("Location:bddhc1.php"); //重新載入頁(yè)面?

?

? ? } else{?

? ? ? ? echo "<script language=javascript>alert('用戶名或密碼錯(cuò)誤');</script>";?

? ? ? ? Header("Location:login1.php"); //重新載入頁(yè)面?

?

? ? }

?

}?

?>?

?

<html>?

? ? <head>?

? ? <title>登錄窗口</title>?

? ? <meta http-equiv="Content-Type" content="text/html" charset="utf-8">?

? ? </head>?

? ? <body>?

? ? <form action="login1.php" ?method="post">?

? ? ? ? 用戶名:?

? ? ? ? <input type="text" name="user" />?

? ? ? ? 密碼:?

? ? ? ? <input type="password" name="pwd" />?

? ? ? ? <br/>?

? ? ? ? <輸入類型=“隱藏”名稱=“已提交”值=“1”/>?

? ? ? ? ?

? ? ??

? ? ?

? ? ?

</html>?


cq
cq

全部回復(fù)(2)
一笑而過(guò)

你的查詢語(yǔ)句 ? ?少了一個(gè)單引號(hào) ? 你可以按照我這樣寫 ?$sql = 'select * from name where user ='.$user; ? ?

  • 回復(fù) 多謝您的回復(fù),我輸入用戶名和密碼,程序不按權(quán)限$quan判斷,就直接跳到 Header("Location:bddhc1.php")這里,為何呀?
    tutu 作者 2018-05-01 15:23:47
麻狼

$sql = 'select * from name where user="'.$user.'"';?

變量名用單引號(hào)。

PHP中,雙引號(hào)里可以使用變量,你可以這么寫:

$sql = “select * from name where user='$user';";?

  • 回復(fù) 多謝您的回復(fù),我輸入用戶名和密碼,程序不按權(quán)限$quan判斷,就直接跳到 Header("Location:bddhc1.php")這里,為何呀?
    tutu 作者 2018-05-01 15:23:23
  • 回復(fù) mysqli_fetch_array是不是漏了一個(gè)參數(shù)呀?
    MrSwan 作者 2018-05-04 12:45:55
最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板