View file input.php

File size: 2.73Kb
<?php
// mod by Golem http://veplog.ru

require_once"template/start.php";
require_once"template/regglobals.php";
require_once"template/config.php";
require_once"template/functions.php";
require_once"template/antidos.php";
require_once"template/gzip.php";
require_once"template/header.php";

sleep(1); 
if(isset($_POST['login'])){ $login = check($_POST['login']); } else { $login = check($_GET['login']); }
if(isset($_POST['pass'])){ $pass = check($_POST['pass']); } else { $pass = check($_GET['pass']); }

##########################################################################
##                          Авторизация
##########################################################################
if (!isset($action)){
if (file_exists(BASEDIR."local/profil/$login.prof")){
$inform = file_get_contents(BASEDIR."local/profil/$login.prof"); 
$info = explode(":||:",$inform);

if (md5($pass)==$info[1] && $login==$info[0] && $login!="" && md5($pass)!="") {

if($cookietrue==1){
	
$apar=xoft_encode($pass,$config_keypass);
$alog=xoft_encode($login,$config_keypass);

SetCookie("cookpar", $apar, $sitetime+3600*24*365);
SetCookie("cooklog", $alog, $sitetime+3600*24*365);
}
SetCookie("cookname", $login, $sitetime+3600*24*365);

$pr_ip = explode(".",$ip);
$my_ip=$pr_ip[0].$pr_ip[1].$pr_ip[2];

$_SESSION['log']=$login;
$_SESSION['par']=$pass;
$_SESSION['my_ip']=$my_ip;
$_SESSION['my_brow']=$brow;


//------------------------------ Запись в профиль ----------------------------//
$ufile = file_get_contents(BASEDIR."local/profil/$login.prof"); 
$udata = explode(":||:",$ufile);

$udata[11]++;
$udata[14]=$ip;
$udata[44]=$sitetime;

for ($u=0; $u<$config_userprofkey; $u++){
$utext.=$udata[$u].':||:';}

if($udata[0]!="" && $udata[1]!="" && $udata[4]!="" && $utext!=""){
$fp=fopen(BASEDIR."local/profil/$login.prof","a+");    
flock($fp,LOCK_EX);           
ftruncate($fp,0);                                                                
fputs($fp,$utext);
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);  
}
	
header ("Location: index.php?".SID); exit; 

} else { header ("Location: pages/vhod.php?isset=inputoff");  exit; }
} else { header ("Location: pages/vhod.php?isset=inputoff");  exit; }
}



##########################################################################
##                         Выход с сайта
##########################################################################
if($action=="exit"){
$_SESSION['log']='';
$_SESSION['par']='';
unset($_SESSION['log']);
unset($_SESSION['par']);	
setcookie('cookpar', '');
setcookie('cooklog', '');
session_unset();
setcookie(session_name(), '');
session_destroy();
header ("Location: index.php?isset=exit");  exit;
}

?>