Created
February 5, 2013 15:18
-
-
Save ShenXuGongZi/4715062 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(!isset($_POST['submit'])){ | |
exit('非法访问!'); | |
} | |
session_start(); | |
include ("./manyoudb/conn.php"); | |
//开始获取ip | |
$ip=get_ip(); | |
function get_ip() { | |
if(getenv('HTTP_CLIENT_IP')) $client_ip = getenv('HTTP_CLIENT_IP'); | |
elseif(getenv('HTTP_X_FORWARDED_FOR')) $client_ip = getenv('HTTP_X_FORWARED_FOR'); | |
elseif(getenv('REMOTE_ADDR')) $client_ip = getenv('REMOTE_ADDR'); | |
else $client_ip = $HTTP_SERVER_VARS['REMOTE_ADDR']; | |
return $client_ip; | |
} | |
$username=$_POST[username]; | |
$pwd=$_POST[password]; | |
$showtime=date("Y-m-d H:i:s"); | |
setcookie('userr',$_POST[username],time()+3600*24); //发送_COOKIE记录 用户名 | |
setcookie('passwd',$_POST[password],time()+3600*24); // | |
$sql="select * from data where user='$username' and password='$pwd' "; //查询mysql数据库data数据表 比对 username, password | |
$query=mysql_query($sql); | |
$row=mysql_fetch_array($query); | |
if ($_POST['submit']){ //获取提交按钮 | |
if($row){ | |
if ($username=='liuhang0077'){ | |
echo "<script language='javascript'>location='admin';</script>"; | |
} | |
if ($row['loginss']==$yaoqing){ | |
$_SESSION['loginss']=$yaoqing; | |
mysql_query("update loginss set user = 'user' email = 'email' log_count = 'log_count' + 1,lastip = '$ip', logintime = '$showtime'"); | |
echo "<script language='javascript'>location='center.php';</script>"; | |
} | |
} | |
else { | |
echo "<script language='javascript'>location='error.php';</script>"; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment