<?php
/***************************************  top      *****************************/
session_start();
require ("header.php");
require (R_P."require/user_cookie.php");
/***************************************  login      *****************************/


$chk_user_name = GetCookie('user_name');

if(!empty($chk_user_name))  header("location:user/");


InitGP(array('user_name','user_password','login_type'));
 


if ($login_type == 1) {
	empty_chk(array($user_name,$user_password));
	str_filter(array($user_name,$user_password),'chk');
	$sql = "SELECT  * FROM ".$db_tablepre."user WHERE u_name='".$user_name."' and u_password='".md5($user_password)."'";
	$query = sql_return($sql,2);
	if (!empty($query)) {
		
		cookie_user($query);
		
		//sql语句
		$u_login = $query['u_login']+1;
				
		$sql = " UPDATE ".$db_tablepre."user SET u_lasttime='".$timestamp."',u_login='".$u_login."' WHERE u_id='".$query['u_id']."'";
		sql_return($sql);
		$jumpurl = $_SERVER['HTTP_REFERER'];
		jumpPage('login_s',$jumpurl);
	}else Showmsg('log_err_1');

}


elseif ($login_type == 'out') {

	dle_cookie_user();
	
	
	$jumpurl = $_SERVER['HTTP_REFERER'];
	strpos($jumpurl,'user/') && $jumpurl = '/index.php';

	jumpPage('login_out',$jumpurl);
}elseif (!empty($_SESSION['user_name'])) jumpPage('login_for','/user');


else $jumpurlfor = $_SERVER['HTTP_REFERER'];

/***************************************  开始替换       *****************************/

$content = html_exp('{header1}','',$content);
$content = html_exp('{topback1}',$topback1,$content);
$content = html_exp('{menu}','会员登陆',$content);
$content = html_exp('{jumpurl}',$jumpurlfor,$content);








/***************************************  footer    *****************************/
require (R_P."footer.php");

?>

