php登录代码
作者:admin 日期:2008-09-15
<?php
session_start();
echo "<meta http-equiv=Content-Type content=text/html; charset=utf-8 />";
include "conn.php";
$username = $_POST['username'];
$password = $_POST['password'];
$result=mysql_query("select count(*) as count1 from `admin` where username='$username' and password='$password'");
$row=mysql_fetch_array($result);
$total=$row['count1'];
if ($total>0) {
$_SESSION['username']=$username;
echo "<script>alert('登陆成功');location.href='main.php';</script>";
}
else
{
echo "<script>alert('对不起您不是管理员,请重新登陆');location.href='index.php';</script>";
}
?>
<?php
//截取登陆者IP
$ip=$_POST['ip'];
$user=$_POST['username'];
$time1=date('Y')."-".date('m')."-".date('d')." ".date('H').":".date('i').":".date('s');
$sql="insert into ip(ip,time,user)values ('$ip','$time1','$username')";
$rs=mysql_query($sql);
?>
session_start();
echo "<meta http-equiv=Content-Type content=text/html; charset=utf-8 />";
include "conn.php";
$username = $_POST['username'];
$password = $_POST['password'];
$result=mysql_query("select count(*) as count1 from `admin` where username='$username' and password='$password'");
$row=mysql_fetch_array($result);
$total=$row['count1'];
if ($total>0) {
$_SESSION['username']=$username;
echo "<script>alert('登陆成功');location.href='main.php';</script>";
}
else
{
echo "<script>alert('对不起您不是管理员,请重新登陆');location.href='index.php';</script>";
}
?>
<?php
//截取登陆者IP
$ip=$_POST['ip'];
$user=$_POST['username'];
$time1=date('Y')."-".date('m')."-".date('d')." ".date('H').":".date('i').":".date('s');
$sql="insert into ip(ip,time,user)values ('$ip','$time1','$username')";
$rs=mysql_query($sql);
?>
[本日志由 admin 于 2008-09-15 11:49 PM 编辑]
文章来自: 本站原创
引用通告地址: http://www.is21.cn/trackback.asp?tbID=419
Tags:
文章来自: 本站原创
引用通告地址: http://www.is21.cn/trackback.asp?tbID=419
Tags:
评论: 0 | 引用: 0 | 查看次数: 2178
发表评论
你没有权限发表留言!