⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index_bank.php

📁 Download you own three BR
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php
session_start();
if ($noice_if) {
	echo "<script language=\"JavaScript\">"; 
	echo " location.replace(\"noice.php\");"; // 自己修改网址 
	echo "</script>"; 
}	
require("functions/class_mysql.php");
require("configs/Configs.php");
require("functions/func_common.php");


////////////////////////////////////////////玩家登录///////////////////////////////////////////
//if(isset($_COOKIE["UserId"]) and isset($_COOKIE["CityId"]) and isset($_COOKIE["UserName"]) and $_COOKIE["UserId"]<>"" and $_COOKIE["CityId"]<>"" and $_COOKIE["UserName"]<>""){
//	
//	//判断当前用户COOKIE的IP与服务器的登录IP是否一致,如果不相同,则清除COOKIE,重新登录
//	
//	$query=$db->query("select * from player_info where `u_id`='".$_COOKIE['UserId']."'");
//	$login_result=$db->fetch_array($query);
//	
//	if($login_result['login_ip']<>$_COOKIE['login_ip']){
//		session_unregister("online");
//	    session_destroy();
//		setcookie("UserId","",time()-$cookie_times,"/");
//		setcookie("UserName","",time()-$cookie_times,"/");
//		setcookie("NickName","",time()-$cookie_times,"/");
//		setcookie("CityName","",time()-$cookie_times,"/");
//		setcookie("CityId","",time()-$cookie_times,"/");
//		setcookie("CityArea","",time()-$cookie_times,"/");
//		$_COOKIE["UserId"]="";
//		$_COOKIE["UserName"]="";
//		$_COOKIE["NickName"]="";
//		$_COOKIE["CityName"]="";
//		$_COOKIE["CityId"]="";
//		$_COOKIE["CityArea"]="";
//		echomsg("","?");
//	}
//}
////////////////////////////////////////////安全退出///////////////////////////////////////////
if($_GET["action"]=="safe_logout"){
    //更新玩家users表的marker为0;
    $db->query("update users set marker='0' where username='".$_COOKIE['UserName']."';");
    //玩家点击退出链接时,记录下线状态   
    $query=$db->query("update player_info set `online`='0',`login_time`='".time()."' where `u_id`='".$UserId."'");
	$cookie_times=$_COOKIE["cookie_times"];
    if($query){
	    session_unregister("online");
		session_destroy();
	    setcookie("UserId","",time()-$cookie_times,"/");
		setcookie("UserName","",time()-$cookie_times,"/");
		setcookie("NickName","",time()-$cookie_times,"/");
		setcookie("CityName","",time()-$cookie_times,"/");
		setcookie("CityId","",time()-$cookie_times,"/");
		setcookie("country","",time()-$cookie_times,"/");
		setcookie("CityArea","",time()-$cookie_times,"/");
		$_COOKIE["UserId"]="";
		$_COOKIE["UserName"]="";
		$_COOKIE["NickName"]="";
		$_COOKIE["CityName"]="";
		$_COOKIE["CityId"]="";
		$_COOKIE["country"]="";
		$_COOKIE["CityArea"]="";
	}
	
//	$_GET['forward']='http://sg.wanlala.com';
//	$verify	= md5('logout'.$_GET['forward']."kangwglovewxm");
//    header('Location: http://sg.wanlala.com/bbs/api/passport.php?action=logout&forward='.$_GET['forward'].'&verify='.$verify);
	echomsg("已安全退出成功!","../index.php");

}

//调查提交;
if ($_POST['vote_up']=="up") {
	for ($i=0;$i<4;$i++)
	{
		//写入表中;
		$query=$db->query("update vote set num=(num+'1') where id='".$i."';");
	}
	echomsg("提交成功,感谢您对我们的支持!");
}

///////////////////////////////////////////////////////////////////////////////////////
//开始验证登录

if($_POST["action"]=="login"){
	if ($noice_if) 	echomsg("系统进行维护,给你带的不便,我们十分抱歉!","noice.php");
	//判断用户名是否为空;
	if (!$_POST['Username']) {
		echomsg("请输入用户名!");
	}
	
	//判断密码是否为空;
	if (!$_POST['Password']) {
		echomsg("请输入密码!");
	}
	//判断验证码是否为空;
	if (!$_POST['code']) {
		echomsg("请输入验证码!");
	}
	//判断验证码
	if(strtolower($_POST['code'])<>$_SESSION['verifycode'])  echomsg("验证码输入错误!","../index.php");
	
	
	/////////////////////////////////////判断是否豆豆乐//////////////////////////////////////////////
		$_POST['Username']=trim($_POST['Username']);
		$username=strtolower($_POST['Username']);
		
	if (! ereg("^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9\-\.])+", $username))  
	{

		$password=substr(md5($_POST['Password']),0,16);
		$query=$db->query("select * from users where `username`='".$username."' and `password`='".$password."'");
		$m=$db->fetch_array($query);
			
	}else{
		
		$password=substr(md5($_POST['Password']),0,16);
			$query=$db->query("select * from users where `username`='".$username."' and `password`='".$password."'");
	if($row=$db->num_rows($query)){
			$m=$db->fetch_array($query);}
			else{
				$key="$9KJDJ&^(239KJDJ";
				$password=$_POST['Password'];
			$password=md5($key.$password);
				error_reporting(0);
	       include_once("is_file.php");
			$str_url = 'http://www.doudoule.com/3guo/checklogin.jsp';
			$exits = remote_file_exists($str_url);
			//如果网通能打开
			if($exits==true){
			$fp = @fopen("http://www.doudoule.com/3guo/checklogin.jsp?username=".$username."&password=".$password,"r");
			}
			else{
			$fp = @fopen("http://dx.doudoule.com/3guo/checklogin.jsp?username=".$username."&password=".$password,"r");
			}

			while($buffer=@fgets($fp)){
			   $value[]=$buffer;
			}
			foreach($value as $m){
				$result.=$m;
			}				
			
				if(strstr($result,"0")){

					@fclose($fp);

			@mysql_select_db("web3guo");
					$password=substr(md5($_POST['Password']),0,16);
					$db->query("INSERT INTO users (u_id,username,password,email,reg_time,reg_ip) VALUES (NULL,'".$username."','".$password."','".$username."','".time()."','".$_SERVER['REMOTE_ADDR']."')");
				$query=$db->query("select * from users where `username`='".$username."' and `password`='".$password."'");
			$m=$db->fetch_array($query);
					}elseif(strstr($result,"2")){
					 		@fclose($fp);
					echomsg("E-mail输入有误"); 
				}elseif(strstr($result,"1")){
						@fclose($fp);
					echomsg("密码输入有误"); 
					
				}else{
					@fclose($fp);
						echomsg("E-mail或密码输入有误"); 
				}
				
		
			} 
	}

/////////////////////////////////////////////////////////////////////////////////	
	
	
		
	if($m["username"]==$username and $m["password"]==$password){/*验证成功*/
		
		//更新登录IP
		$db->query("update player_info set `login_ip`='".$_SERVER['REMOTE_ADDR']."',`login_time`='".time()."',`online`='1' where `u_id`='".$m["u_id"]."'");
		//更新users表里的marker标记为1登陆状态;
		$db->query("update users set marker='1' where username='".$_POST['Username']."';");
		//获取主城市ID
	    $query=$db->query("select c.c_area,c.c_area_x,c.c_area_y,c.c_id,c.c_name,p.p_country,p.p_nickname from city c,player_info p where c.`u_id`=p.`u_id` and p.`u_id`='".$m["u_id"]."' and `c_type`='1' order by c_id desc limit 1");
	    $c_id=$db->fetch_array($query);
	    $db->close();
	    
	    //设置SESSION值
	    session_register("online");
	    $_SESSION['online']=$m["u_id"];
	    
	    
	    setcookie("cookie_times",$cookie_times,time()+$cookie_times,"/");
	    $_COOKIE["cookie_times"]=$cookie_times;
	    
		//设置COOKIE值
//		if (!$c_id['c_id']) echomsg("用户ID写入不正确","?");
//		if (!$m['u_id']) echomsg("用户ID写入不正确".$m['username'],"?");
		
//		if ($c_id["c_id"]<'1') {
//		echo "<SCRIPT language=JavaScript>";
//		echo "top.window.location='game/init/create_role.php';";
//		echo "</SCRIPT>";
//		exit;	
//		}
//		
		$cookie_times=time()+$cookie_times;
		setcookie("UserId",$m['u_id'],$cookie_times,"/");
		setcookie("remember_UserName",$m['username'],$cookie_times,"/");
		setcookie("UserName",$m['username'],$cookie_times,"/");
		setcookie("NickName",$c_id['p_nickname'],$cookie_times,"/");
		setcookie("CityId",$c_id['c_id'],$cookie_times,"/");
		setcookie("CityArea",$c_id['c_area']."|".$c_id['c_area_x'],$cookie_times,"/");
		setcookie("CityName",$c_id['c_name'],$cookie_times,"/");
		setcookie("login_ip",$_SERVER['REMOTE_ADDR'],$cookie_times,"/");
		setcookie("Country",$c_id['p_country'],$cookie_times,"/");
	    $_COOKIE["UserId"]=$m['u_id'];
	    $_COOKIE["CityId"]=$c_id['c_id'];
	    $_COOKIE["CityArea"]=$c_id['c_area']."|".$c_id['c_area_x'];
	    $_COOKIE["CityName"]=$c_id['c_name'];
	    $_COOKIE["NickName"]=$c_id['p_nickname'];
	    $_COOKIE["UserName"]=$m['username'];
	    $_COOKIE["login_ip"]=$_SERVER['REMOTE_ADDR'];
	    $_COOKIE["Country"]=$c_id['p_country'];
	    $_COOKIE["remember_UserName"]=$m['username'];
//	    echomsg($m['u_id'].'18'.$_COOKIE['UserId']);
	    //给元宝程序
	    include_once("give_cashmoney.php");
	    
	    echo "<script>";
	    echo "top.window.location='interface/enter_game.php?action=enter_game&server=101&game_name=3guo'";
	    echo "</script>";
	    exit;
	
//	论坛接口//
//	$action="login";
//	$member = array
//		(
//		'cookietime'	=> 86400,
//		'time'		=> time(),
//		'username'	=> $m["username"],
//		'password'	=> md5($_POST['Password']),
//		'email'		=> $m['email'],
//		);
//	$auth = passport_encrypt(passport_encode($member), "kangwglovewxm");
//	if ($_GET['forward']=='') $_GET['forward']='../interface/enter_game.php?action=enter_game&server=101&game_name=3guo';
//	$verify = md5($action.$auth.$_GET['forward']."kangwglovewxm");
//	header('Location: http://sg.wanlala.com/bbs/api/passport.php?action=login&auth='.rawurlencode($auth).'&forward='.rawurlencode($_GET['forward']).'&verify='.$verify);
	//////////////////////
	
	    
	}else{
		echomsg("用户名或密码错误!","../index.php");
	}
			
}


//引用头首部内容;
include("top_end.php");
index_top();
?>
<SCRIPT language="JavaScript">
function refreshCc() {//验证图片更新
	document.getElementById('imagecode').src = 'functions/passcode.inc.php?' + Math.random();
}

function check_login(obj)
{
	if(obj.Username.value==""){
		alert("请输入用户名!");
		obj.Username.focus();
		return false;	
	}
	
	if(obj.Password.value==""){
		alert("请输入登录密码!");
		obj.Password.focus();
		return false;	
	}
	if(obj.code.value==""){
		alert("请输入验证码!");
		obj.code.focus();
		return false;	
	}
	login.style.display="none";
	logining.style.display="";
}


<!--
//屏蔽js错误
 function ResumeError() {
 return true;
 }
 window.onerror = ResumeError;
 // -->
</SCRIPT>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -