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

    <?php
include "../include/conn.php";
include "../include/function.php";
include "../include/userset.php";
// 
//'**************************************************************************************************
//' 软件名称: 搜一次 Content Management System
//' 版本编号: V4.0.0版
//' 官方网站: http://www.syccms.com
//' 官方论坛:http://bbs.syccms.com
//' 软件编写: 无痕(QQ:512591),暮寒,新手℡鼠标
//' 郑重声明:
//'    1、任何个人或组织不得在未经授权的情况下删除、修改、拷贝本软件及其他副本上一切关于版权的信息;
//'    2、搜一次网络有限公司保留此软件的法律追究权利
//'**************************************************************************************************
?>
<!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 check(it){
	var S_Name=it.S_Name.value;
	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;};
};
function checkf(it){
	var S_Name=document.getElementById("S_Name").value;
	var S_Answer=it.S_Answer.value;
	document.getElementById("S_Name").style.borderColor='#666 #ccc #ccc #666';
	it.S_Answer.style.borderColor='#666 #ccc #ccc #666';
	if(S_Name==""){
		document.getElementById("S_Name").style.border='1px solid red';
		return false;};
	else if(S_Answer==""){
		it.S_Answer.style.border='1px solid red';
		return false;};
	else if(len(S_Answer)>18){
		it.S_Answer.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>

<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"><?php
function FindPwd(){
	global $db;
	$S_Name=SafeRequest("S_Name","get");
	$S_Question=SafeRequest("S_Question","post");
	$S_Answer=SafeRequest("S_Answer","post");
	$sql="select * from s_users where S_Name='".$S_Name."'";
	$result=$db->query($sql);
	if($row=$db->fetch_array($result)){
		if(($row["S_Question"]==$S_Question)&&($row["S_Answer"]==$S_Answer)){
			$S_PassWord=Md5(123456);
			$sql="update s_users set S_PassWord='".$S_PassWord."'";
			$db->query($sql);
			?>
			<table width="80%" height="92" align="center" cellpadding="0" cellspacing="0">
            	<tr>
            	  <td align="left"><strong>密码已经还原:123456</strong></td>
            	</tr>
                
                <tr>
                  <td align="left"><font color="#FF0000">*请马上修改此密码并妥善保管好自己的帐号密码!</font></td>
                </tr>
            </table>
			<?php
		}
		else{
			die("<script>alert('密保信息有误,请重新输入!');window.location='userfin.php';</script>");
		}
	}
	else{
		die("<script>alert('帐号不存在,请重新输入!');window.location='userfin.php';</script>");
	}
}

function PassWord($Question,$Names,$Errer){
 ?>
                 <table width="80%" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
				 <form action="?action=findid" method="post" onSubmit="return check(this);">
                   <tr>
                     <td width="30%" height="35" align="right"><font style="font-size: 13px;color:#333333; font-family:'宋体';margin:0;font:13px 'Lucida Grande', Verdana, Lucida, Helvetica, Arial, '宋体', sans-serif">用户名称:</font></td>
                     <td width="42%" align="left">
                     <input id="S_Name" name="S_Name" value="<?php echo $Names?>" style="border-color:#666 #ccc #ccc #666"/>					 </td>
                     <td width="28%">
                     <input type="submit" class="subput" name="bt1"value="检测帐号"/>                     </td>
                   </tr>
                 </form>
                 <form name="form" id="Reg" action="?action=findpwd&S_Name=<?php echo $Names?>" method="post"  runat="server" onSubmit="return checkf(this);">
                   <tr>
                     <td height="35" align="right"><font style="font-size: 13px;color:#333333; font-family:'宋体';margin:0;font:13px 'Lucida Grande', Verdana, Lucida, Helvetica, Arial, '宋体', sans-serif">提示问题:</font></td>
                     <td colspan="2" align="left"><?php echo $Question?>
                     <input type="text" value="<?php echo $Question?>" name="S_Question" id="S_Question" style="display:none"/>
                    <font style="font-size: 12px;> <label style="color:#F00"><?php echo $Errer?></label>  </font>                   </td>
                     </tr>
                   <tr>
                     <td height="35" align="right"><font style="font-size: 13px;color:#333333; font-family:'宋体';margin:0;font:13px 'Lucida Grande', Verdana, Lucida, Helvetica, Arial, '宋体', sans-serif">问题答案:</font></td>
                     <td align="left" colspan="2"><input type="password" value="" name="S_Answer" id="S_Answer" style="border-color:#666 #ccc #ccc #666"/></td>
                   </tr>
                   
                   <tr>
                     <td height="35">&nbsp;</td>
                     <td align="left" colspan="2"><input type="submit" name="Submit" value="找回密码" class="subput"></td>
                   </tr>
					</form>
                 </table>
<?php
}


$action=SafeRequest("action","get");
switch($action){
	case "findpwd" :
		FindPwd();
		break;
	case "findid" :
		FindID();
		break;
	case "tg" :
		TG();
		break;
	default :
		PassWord("","","请输入帐号");
		break;
}

function FindID(){
	global $db;
	$S_Name=$_POST["S_Name"];
	$sql="select * from s_users where S_Name='".$S_Name."'";
	$result=$db->query($sql);
	if($row=$db->fetch_array($result)){
		PassWord($row["S_Question"],$S_Name,"");
	}
	else{
		PassWord("",$S_Name,"帐号不存在!");
	}
}

function TG(){
	global $db;
	$S_ID = SafeRequest("id","get");
	if($S_ID==""){
		echo "<script>window.location='".S_TGURL."'</script>";
	}
	else{
		$sql="select * from s_users where S_ID=".$S_ID;
		$result=$db->query($sql);
		if($row=$db->fetch_array($result)){
			if(isset($_COOKIE["TGIP"])){
			}
			else{
				setcookie("TGIP","a",time()+3600);	
			}
			$TGIP=$_COOKIE["TGIP"];
			$IP=getenv('REMOTE_ADDR');
			$TGIPARR=explode(",",$TGIP);
			$tishi="b";
			for($i=0;$i<count($TGIPARR);$i++){
				if($TGIPARR[$i]==$IP){
					$tishi="a";
				}
			}
			if($tishi=="a"){
				echo "<script>window.location='".S_TGURL."'</script>";
			}
			else{
				if(S_TGFun==1){
					setcookie("TGIP",$TGIP.",".$IP,time()+3600);
					$S_Coin=$row["S_Coin"]+S_Points;
					$sqlu="update s_users set S_Coin=".$S_Coin." where S_ID=".$S_ID;
					$db->query($sqlu);
					echo "<script>window.location='".S_TGURL."'</script>";
				}
				else{
					echo "<script>window.location='".S_TGURL."'</script>";
				}
			}
		}
		else{
			echo "<script>window.location='".S_TGURL."'</script>";
		}
	}
}
?>
        </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>