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

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

WBOY
Release: 2016-06-23 13:44:01
Original
785 people have browsed it

<?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 "错误";?>
Copy after login

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