php+mysql_log
2017-01-23 18:50
253 查看
<?php
header("Content-Type: text/plain;charset=utf-8");
session_start();
$servername = "localhost";
$username = "root";
$password = "msroot17";
$dbname = "myDB";
$con = new mysqli($servername,$username,$password,$dbname);
if(!$con)
{
echo mysql_error();
}
$username = $_POST['username'];
$password = md5($_POST['password']);
echo $username.$password;
$sql = "select password from login where username = '".$username."'";
$result = $con->query($sql);
if($result->num_rows>0)
{
while($row=$result->fetch_assoc())
{
if(md5($row['password'])==$password)
{
$_SESSION['login']=$username;
echo "<script>alert('log in');location='http://www.baidu.com';</script>";
exit;
}
}
}
else
{
echo "No User";
}
?>
<html>
<head>
<title>web log </title>
</head>
<body>
<form action="login.php" method="post">
Please Log In.</br>
User:
<input type="text" name="username">
<br/> PsWd:
<input type="password" name="password">
<br/>
<input type="submit" name="sub" value="submit">
</form>
</body>
</html>
header("Content-Type: text/plain;charset=utf-8");
session_start();
$servername = "localhost";
$username = "root";
$password = "msroot17";
$dbname = "myDB";
$con = new mysqli($servername,$username,$password,$dbname);
if(!$con)
{
echo mysql_error();
}
$username = $_POST['username'];
$password = md5($_POST['password']);
echo $username.$password;
$sql = "select password from login where username = '".$username."'";
$result = $con->query($sql);
if($result->num_rows>0)
{
while($row=$result->fetch_assoc())
{
if(md5($row['password'])==$password)
{
$_SESSION['login']=$username;
echo "<script>alert('log in');location='http://www.baidu.com';</script>";
exit;
}
}
}
else
{
echo "No User";
}
?>
<html>
<head>
<title>web log </title>
</head>
<body>
<form action="login.php" method="post">
Please Log In.</br>
User:
<input type="text" name="username">
<br/> PsWd:
<input type="password" name="password">
<br/>
<input type="submit" name="sub" value="submit">
</form>
</body>
</html>
相关文章推荐
- 编译安装PHP出现configure: error: MySQL configure failed. Please check config.log的解决方法
- dedeCMS /data/mysql_error_trace.php DB error raised PHP Code Injection Via /include/dedesql.class.php Log FIle Without Access Validation
- 编译安装PHP出现configure: error: mysql configure failed. Please check config.log的解决方法
- PHP: configure: error: mysql configure failed. Please check config.log for more information.
- 日志系统搭建(nginx+php+mysql+rsyslog+LogAnalyzer)
- php出现[#2002 Cannot log in to the MySQL server]解决方法
- 编译安装php-5.6.19出现的问题configure: error: mysql configure failed. Please check config.log
- nginx error.log 提示 [error] 887#887: *58 FastCGI sent in stderr: "PHP message: PHP Warning: mysql_connect(): Headers and client library minor version mismatch. Headers:50556 Library:50637
- centos LAMP第三部分php,mysql配置 php配置文件 配置php的error_log 配置php的open_basedir 安装php的扩展模块 phpize mysql配置第二十一节课
- log:linux deepin下配置apache+php+mysql
- rsyslog+loganalyzer+mysql+apache+php的lamp架构搭建日志服务器
- Apache、SSL、MySQL和PHP平滑无缝地安装
- [转载]一家之言的经验之谈php+mysql扎实个人基本功
- PHP 5 Release Candidate 3 Released完成后,加入了对mysql的支持。
- 用PHP连mysql和oracle数据库性能比较
- mysql+apache+php Linux安装指南
- PHP和MYSQL的黄金组合将成昨日美丽神话!
- FreeBSD下安装MySQL+Apache+PHP新手指南
- php将mysql中jpeg图片取出后直接缩小然后传给客户端,减轻网络传输负担
- php+mysql的日记本