php登陆小疑点

WBOY
Release: 2016-06-13 10:08:49
Original
879 people have browsed it

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>
Copy after login
用户名:
密 码:

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 "不要捣乱";        }    }?>
Copy after login


------解决方案--------------------
if($result) $result不为0则if时默认为true
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!