<?php
session_start();
if(!isset($_SESSION['account'])){
if(isset($_POST['account']))
{
$db=new mysqli('localhost','webuser','111111','users');
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
} $stmt=$db->prepare("SELECT account FROM logins WHERE
account=? and password=?");
$account = $_POST['account'];
$password = $_POST['password'];
//**************************************************
$res = $stmt->bind_param('ss', $account, $password);
//**************************************************
$stmt->execute();
$stmt->store_result();
if($stmt->num_rows==1)
{
$stmt->bind_result($account);
$stmt->fetch();
$_SESSION['account']=$account;
header("Location:index.htm");
} else {
require_once('login.htm');
echo "<p>Here isn't such user or wrong password!</p>";
}
}else{
require_once('login.htm');
}
}else{
echo "You have already logged into the site";
}
?>
session_start();
if(!isset($_SESSION['account'])){
if(isset($_POST['account']))
{
$db=new mysqli('localhost','webuser','111111','users');
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
} $stmt=$db->prepare("SELECT account FROM logins WHERE
account=? and password=?");
$account = $_POST['account'];
$password = $_POST['password'];
//**************************************************
$res = $stmt->bind_param('ss', $account, $password);
//**************************************************
$stmt->execute();
$stmt->store_result();
if($stmt->num_rows==1)
{
$stmt->bind_result($account);
$stmt->fetch();
$_SESSION['account']=$account;
header("Location:index.htm");
} else {
require_once('login.htm');
echo "<p>Here isn't such user or wrong password!</p>";
}
}else{
require_once('login.htm');
}
}else{
echo "You have already logged into the site";
}
?>
解决方案 »
- PHP大问题!!!感激1万辈子
- windows xp 用apache_2.2.11和php-5.2.9搭建PHP环境 LoadModule 出错,不能启动apache
- 改了下 网上一个 smarty 分页的函数 分享下
- CSDN上的一个精华贴,但是我把代码复制过来却不能用.在线等啊.
- php按行按长度读取txt数据并存储到mysql
- 关于静态页面,动态页面,动态+数据库页面的思考
- 求教!!!!!!!!!!!!!!!
- $_SERVER的用法?
- My Sql能支持多大的数据量?
- 如何使用php中的mail函数发送html格式的信件?紧急求助!!!!
- 怎样解决发邮件时需要一定的等待时间?给用户的体验很不好
- PHP中安全性问题。
在 $stmt->fetch(); 后面echo $account; exit;看看
有报错信息吗?
看一下报错日志...