Home >Backend Development >PHP Tutorial >我的第二行php代码之接受get请求连接数据库实现登录验证

我的第二行php代码之接受get请求连接数据库实现登录验证

WBOY
WBOYOriginal
2016-06-23 13:44:01773browse

<?php $conn = mysql_connect("localhost","root","") or die("failed to connect db");mysql_select_db("lio", $conn) or die ("failed to select db");//mysql_query("SET NAMES 'UTF8'",$conn);$username=$_GET['user'];$passwd=$_GET['passwd'];$sql = "select * from userinfo where user='$username' and passwd='$passwd'";$Result = mysql_query($sql, $conn);$onerow = mysql_fetch_array($Result);if ($onerow )    echo "正确";else    echo "错误";?>

Statement:
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