session|笔记
登陆页:
处理页:
require_once("conn.php");
SESSION_START();
$username=$_POST['username'];
$password=$_POST['password'];
$exec="select * from admin where username='".$username."'";
if ($result=mysql_query($exec)){
if ($rs=mysql_fetch_object($result)){
if($rs->password==$password){
$_SESSION['adminname']=$username;
echo "SESSION是".$_SESSION['adminname'];
}else{
echo "<script>alert('Password Check Error!');location.href('login.htm');</script>";
}
}else{
echo "<script>alert('Username Check Error!');location.href('login.htm');</script>";
}
}else{
echo "<script>alert('Database connection Error!');location.href=('login.htm');</script>";
}
?>
数据库驱动;
$conn = mysql_connect("127.0.0.1","root","");
mysql_select_db("temp",$conn);
?>
摘要:这次主要遇到以下问题:
Session保存路径设置有误,在php.ini文件中设置:session.save_path = D:\usr\local\php\sessiondata,要保证有此目录,
(2004-10-25 11:08:02) 三角猫(50494427)
你在操作数据库的时候, 尽量不要用 mysql_fetch_object 从结果集中取得一行作为对象
(2004-10-25 11:08:58) 三角猫(50494427)
用:mysql_fetch_row 从结果集中取得一行作为枚举数组
mysql_fetch_array 从结果集中取得一行作为关联数组,或数字数组,或二者兼有

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.
