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.

53 lines
1.5 KiB

6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. $SessionIsAutorised=false;
  3. if(isset($_COOKIE['UID'])){ // User ID transmitted just by cookies
  4. $UserID=$_COOKIE['UID'];
  5. } else $UserID="";
  6. if(isset($_COOKIE['FROM'])){ // User ID transmitted just by cookies
  7. $LastVisited=$_COOKIE['FROM'];
  8. } else $LastVisited="";
  9. setcookie('FROM',getenv('SCRIPT_NAME'));
  10. if(isset($_COOKIE['SID'])){ // Session ID transmitted just by cookies
  11. $Session=$_COOKIE['SID'];
  12. } else $Session="";
  13. if(isset($_COOKIE['Lang'])){ // Language settings transmitted by cookie
  14. $UserLang=$_COOKIE['Lang'];
  15. } else $UserLang=0;
  16. // New Way Cookie deletion
  17. if ($UserID==='deleted') $UserID='';
  18. if (isset($_POST['login'])) {
  19. $Login=$_POST['login'];
  20. //$UserID=""; to do logout of previouse user
  21. } elseif (isset($_GET['login'])) {
  22. $Login=$_GET['login'];
  23. } elseif ($UserID === "" ) {
  24. $Login="guest";
  25. //$UserID=1;
  26. } else $Login="";
  27. if (isset($_POST['password'])) {
  28. $Password=$_POST['password'];
  29. } else $Password="";
  30. $CUser=new User();
  31. $SessionIsAutorised=$CUser->Login($Login,$Password,$UserID,$Session);
  32. if ( $SessionIsAutorised && $CUser->Data['id']>1){
  33. $CUser->FillInfo($CUser->Data['id']);
  34. setcookie('UID',$CUser->Data['id']);
  35. setcookie('SID',$CUser->Data['SID']);
  36. //if ($CUser->ID > 1 ) setcookie('Lang',$CUser->Language);
  37. };
  38. if ( $CUser->Data['id']==1 ){
  39. $CUser->Data['status']='';
  40. setcookie('UID',$CUser->Data['id']);
  41. //$CUser->Language=$UserLang;
  42. };
  43. ?>