session_set_cookie_params(36000, "/", "12221.clients"); session_start(); include 'connect.php'; include 'functions.php'; include 'config.php'; if(isset($_COOKIE['login']) and isset($_COOKIE['username']) and isset($_COOKIE['usertype'])) { $_SESSION['login'] = $_COOKIE['login']; $_SESSION['username'] = $_COOKIE['username']; $_SESSION['usertype'] = $_COOKIE['usertype']; header("Location: ".base64_decode($_GET['referer'])); exit(); } if(isset($_POST['enter'])) { $sql = "SELECT * FROM wexcel_users WHERE login = '".$_POST['username']."' AND password = '".md5($_POST['userpass'])."'"; $res = mysql_query($sql); //if( ( $users[$_POST['username']]['password'] == md5($_POST['userpass']) ) OR ( isset($_COOKIE['username']) AND $_COOKIE['username'] == $_POST['username'] ) ) if( mysql_num_rows($res) > 0 OR ( isset($_COOKIE['username']) AND $_COOKIE['username'] == $_POST['username'] )) { $user_row = mysql_fetch_array($res); $_SESSION['login'] = $_POST['username']; $_SESSION['username'] = $user_row['name']; $_SESSION['usertype'] = $user_row['type']; if($_POST['savepass']==1) { setcookie('login', $_POST['username'], time()+2592000); setcookie('username', $user_row['name'], time()+2592000); setcookie('usertype', $user_row['type'], time()+2592000); } else { SetCookie('login',''); SetCookie('username',''); SetCookie('usertype',''); } /*if(!empty($_POST['referer'])) { if(!strstr(base64_decode($_POST['referer']),"login")) header('Location: '.base64_decode($_POST['referer'])); else header('Location: index.php'); } else*/ header('Location: index.php'); exit(); } } //echo ; ?>
|
if(!isset($_COOKIE['username']))
{
?>
|