首頁 >後端開發 >php教程 >php登陆小疑点

php登陆小疑点

WBOY
WBOY原創
2016-06-13 10:08:49916瀏覽

php登陆小问题
login.php

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><script type="text/javascript">    function check()    {        var un = document.getElementById("username").value;        var up = document.getElementById("userpass").value;        if(un==""){alert("null"); return false;}        if(up==""){alert("null");return false;}            }</script>
用户名:
密 码:

show.php
PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?php include("conn.php"); ?><?php if($_POST["submit"])    {        echo $sql ="select * from users where username='".$_POST["username"]."' and userpass='".$_POST["userpass"]."'";        $result=mysql_query($sql);        //echo count($result);                if($result)        {            echo "登陆成功";        }else        {            echo "不要捣乱";        }    }?>


------解决方案--------------------
if($result) $result不为0则if时默认为true
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn