Web UI for ARGUS server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

54 lines
1.5 KiB

<?php
$SessionIsAutorised=false;
if(isset($_COOKIE['UID'])){ // User ID transmitted just by cookies
$UserID=$_COOKIE['UID'];
} else $UserID="";
if(isset($_COOKIE['FROM'])){ // User ID transmitted just by cookies
$LastVisited=$_COOKIE['FROM'];
} else $LastVisited="";
setcookie('FROM',getenv('SCRIPT_NAME'));
if(isset($_COOKIE['SID'])){ // Session ID transmitted just by cookies
$Session=$_COOKIE['SID'];
} else $Session="";
if(isset($_COOKIE['Lang'])){ // Language settings transmitted by cookie
$UserLang=$_COOKIE['Lang'];
} else $UserLang=0;
// New Way Cookie deletion
if ($UserID==='deleted') $UserID='';
if (isset($_POST['login'])) {
$Login=$_POST['login'];
//$UserID=""; to do logout of previouse user
} elseif (isset($_GET['login'])) {
$Login=$_GET['login'];
} elseif ($UserID === "" ) {
$Login="guest";
//$UserID=1;
} else $Login="";
if (isset($_POST['password'])) {
$Password=$_POST['password'];
} else $Password="";
$CUser=new User();
$SessionIsAutorised=$CUser->Login($Login,$Password,$UserID,$Session);
if ( $SessionIsAutorised && $CUser->Data['id']>1){
$CUser->FillInfo($CUser->Data['id']);
setcookie('UID',$CUser->Data['id']);
setcookie('SID',$CUser->Data['SID']);
//if ($CUser->ID > 1 ) setcookie('Lang',$CUser->Language);
};
if ( $CUser->Data['id']==1 ){
$CUser->Data['status']='';
setcookie('UID',$CUser->Data['id']);
//$CUser->Language=$UserLang;
};
?>