-
-
-
-
-
- 登陆系统
-
-
- session_start();
- if ($_SESSION[username]) {
- ?>
-
-
-
- }else {
- ?>
-
-
-
- }
- ?>
-
-
复制代码
2,config.php
-
- $dbhost="localhost";
- $dbuser="root";
- $dbpassword="123456";
- $dbname="auth";
- $conn=mysql_connect("$dbhost","$dbuser","$dbpassword") or die('不能连接服务器'.mysql_error());
- mysql_select_db("$dbname",$conn) or die("数据库访问错误".mysql_errno());
- mysql_query("set names gb2312");
- ?>
复制代码
3,userlogin.php
-
-
-
-
-
- 登陆系统_bbs.it-home.org
-
-
- session_start();
- require("config.auth.php");
- if ($_POST[submit]) {
- $sql="select * from userinfo where username = '$_POST[username]' and password = '$_POST[password]'";
- $result=mysql_query($sql);
- $numrows=mysql_num_rows($result);
- if ($numrows == 1) {
- $row=mysql_fetch_assoc($result);
- $_SESSION[username]=$row[username];
- //echo $_SESSION[username];
- echo "<script>alert('登陆成功!');window.location.href='left.php';</script>";
- }else {
- echo "
|