php登陆小问题
login.php
<!--
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>
<body>
<form method="post" action="show.php" name="form1" onsubmit="return check()">
用户名:<input type="text" name="username" id="username" /><br />
密 码:<input type="password" name="userpass" id="userpass" /><br />
<input type="submit" name="submit" value="登陆" />
</form>
</body>
<!--
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 "不要捣乱";
}
}
?>
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号