www.gusucode.com > 搜一次CMS电影程序 PHP 1.5源码程序 > users/userlog.php

    <?php
include "../include/conn.php";
include "../include/function.php";

//'**************************************************************************************************
//' 软件名称: 搜一次 Content Management System
//' 版本编号: V4.0.0版
//' 官方网站: http://www.syccms.com
//' 官方论坛:http://bbs.syccms.com
//' 软件编写: 无痕(QQ:512591),暮寒,新手℡鼠标
//' 郑重声明:
//'    1、任何个人或组织不得在未经授权的情况下删除、修改、拷贝本软件及其他副本上一切关于版权的信息;
//'    2、搜一次网络有限公司保留此软件的法律追究权利
//'**************************************************************************************************
$action=SafeRequest("action","get");
switch($action){
	case "checklog" :
		CheckLog();
		break;
	default:
	break;
}

function CheckLog(){
	global $db;
	$S_Name=SafeRequest("S_Name","post");
	$S_PassWord=SafeRequest("S_PassWord","post");
	$Code=SafeRequest("codes","post");
	if(($S_Name=="")||($S_PassWord=="")){
		echo "<script>alert('请输入帐号密码!');window.history.go(-1);</script>";
	}
	else{
		if($_SESSION["codes"]!=$Code){
			echo "<script>alert('验证码错误,请重新输入!');window.history.go(-1);</script>";
		}
		else{
			$S_PassWord=Md5($S_PassWord);
			$sql="select * from s_users where S_Name='".$S_Name."'";
			$result=$db->query($sql);
			if($row=$db->fetch_array($result)){
				if($row["S_PassWord"]==$S_PassWord){
					setcookie("S_Name",$S_Name,time()+3600);
					setcookie("S_PWD",$S_PassWord,time()+3600);
					if($row["S_Group"]==1){
						setcookie("S_LogName",$S_Name,time()+3600);
					}
					$S_LogIP=$row["S_LogIP"];
					if($S_LogIP==""){
					}
					else{
						setcookie("S_LogIP",$S_LogIP,time()+3600);
					}
					$S_LogNum=$row["S_LogNum"]+1;
					$S_LogTime=date("Y-m-d");
					$S_LogIP = getenv('REMOTE_ADDR');
					$update="update s_users set S_LogNum='".$S_LogNum."',S_LogTime='".$S_LogTime."',S_LogIP='".$S_LogIP."' where S_Name='".$S_Name."'";
					$db->query($update);
					echo "<script>window.location='index.php'</script>";
				}
				else{
					echo "<script>alert('密码错误,请重新输入!');window.history.go(-1);</script>";
				}
			}
			else{
				echo "<script>alert('帐号不存在,请重新输入!');window.history.go(-1);</script>";
			}
		}
	}
}

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link  href="images/style.css" rel="stylesheet" type="text/css" />
<title>会员登录 - <?php echo  S_SiteName ?></title>

<script language="javascript">
function checklg(it){
	var S_Name=it.S_Name.value;
	var S_PWD=it.S_PassWord.value;
	var codes=it.codes.value;
	it.S_Name.style.borderColor='#666 #ccc #ccc #666';
	it.S_PassWord.style.borderColor='#666 #ccc #ccc #666';
	it.codes.style.border='1px #eaeaea solid';
	if(S_Name==""){
		it.S_Name.style.border='1px solid red';
		return false;
		};
	else if(len(S_Name)>16){
		it.S_Name.style.border='1px solid red';
		return false;
		};
	else if(S_PWD==""){
		it.S_PassWord.style.border='1px solid red';
		return false;
		};
	else if(len(S_PWD)>18){
		it.S_PassWord.style.border='1px solid red';
		return false;
		};
	else if(codes==""){
		it.codes.style.border='1px solid red';
		return false;
		};
	else if(codes.length!=4){
		it.codes.style.border='1px solid red';
		return false;
		};
	};
function len(s) {
	var l = 0;
	var a = s.split("");
	for (var i=0;i<a.length;i++) {
	if (a[i].charCodeAt(0)<299) {
		l++;
		}
	else{
   l+=2;
		}
	}
	return l;
}
</script>
</head>
<body>
<?php
$UserIP=getenv('REMOTE_ADDR');

$sql="select * from s_users where S_Group=1 and S_StartIP='".$UserIP."'";
$result=$db->query($sql);
if($row=$db->fetch_array($result)){
	setcookie("S_Name",$row["S_Name"], time()+3600);
	setcookie("S_PWD",$row["S_PassWord"], time()+3600);
}
else{
}
?>
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="center" valign="middle">
      <table width="600px" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td><table width="27%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="5%"><img src="images/inleft.jpg"/></td>
                <td width="91%" align="center" bgcolor="#20A9F9" class="starsize">会 员 登 录</td>
                <td width="4%"><img src="images/inright.jpg"/></td>
              </tr>
          </table></td>
        </tr>
        <tr>
          <td align="center" valign="top" style="border:2px #21A8F6 solid;">
          <table width="90%" border="0" cellspacing="10" cellpadding="0">
          	  <tr>
                <td>
                	<table align="left">
                    	<tr>
                        	<td>
                	<img src="images/center.jpg" />
                    		</td>
                            <td valign="middle">
                    <b><font color="#720F39" style="font-size:16px;">&nbsp;会员登录&nbsp;</font></b>
                    		</td>
                        </tr>
                    </table>
                </td>
              </tr>
              <tr>
                <td height="10" background="images/inrepeat.jpg"></td>
              </tr>
              <tr>
                <td bgcolor="#EAF5FF" align="center" valign="middle" height="250">

              <table height="172" cellpadding="0" cellspacing="0" style="background-color:#FFF; ">
              <form method="post" action="?action=checklog" name="form1" onSubmit="return checklg(this);">
                  <tr>
                    <td width="79" height="37">&nbsp;&nbsp;&nbsp;<font style="font-size:12px;">用户名:</font></td>
                    <td width="199" align="left">
                    <input type="text" name="S_Name" id="S_Name" style="border-color:#666 #ccc #ccc #666"/></td>
                  </tr>
                  <tr>
                    <td height="37">&nbsp;&nbsp;&nbsp;<font style="font-size:12px;">密 码:</font></td>
                    <td align="left">
                    <input type="password" name="S_PassWord" id="S_PassWord" style="border-color:#666 #ccc #ccc #666"/>
                    </td>
                  </tr>
                  <tr>
                	<td height="37">&nbsp;&nbsp;&nbsp;<font style="font-size:12px;">验证码:</font></td>
                    <td valign="middle"><input type="text" size="5" id="codes"name="codes" style="background:#fffff9;border:1px #eaeaea solid;">
                    &nbsp;<img src="../include/code.php" id="imgcode"></td>
                </tr>
                  <tr>
                  <td colspan="2" align="center">
                    <input type="image" src="images/user.gif" style=" border:0px">
                  <a href="userreg.php"><img src="images/reg.gif" width="52" height="21" style="border:0px;"></a>
                  <a href="userfin.php"><img src="images/wm.gif" width="52" height="21" style="border:0px;"></a>
                  </td>
                  </tr>
                </form>
              </table>
</td>
              </tr>
                  <tr>
                    <td height="10" background="images/inrepeat.jpg"></td>
                  </tr>
                  <tr>
                    <td height="40"></td>
                  </tr>
          </table></td>
        </tr>
      </table>
</td>
</tr>
</table>
</body>
</html>