auth.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. require_once 'init.php';
  3. $errorFail = "<div align=center><font color=red>Login Failed </font></div>
  4. <script language=javascript>
  5. setTimeout('location.href = \"logout.php\"', 1000);
  6. </script>";
  7. $errorFail2 = "<div align=center><font color=red>Login Failed<br>-<br>Adminseite wird benutzt!</font></div>
  8. <script language=javascript>
  9. setTimeout('location.href = \"logout.php\"', 2000);
  10. </script>";
  11. if (isset($_SESSION['userid'])) {
  12. $rs = $adodb->Execute("SELECT * FROM qb_user".
  13. " WHERE userid = '".$_SESSION['userid']."'");
  14. if (!$rs->EOF) {
  15. if ( file_exists("templates/sem") && $_SESSION['userid'] != implode(file("templates/sem")) ) {
  16. die($errorFail2);
  17. } else {
  18. if (ereg('login2\.php', @$_SERVER['HTTP_REFERER'])) {
  19. header('Location: nola.php');
  20. }
  21. $passkey = md5($_SESSION['userid'].($rs->fields['passwd']).'qbuilder');
  22. if ($_SESSION['passkey'] !== $passkey) {
  23. die($errorFail);
  24. }
  25. return true;
  26. }
  27. }
  28. }
  29. $userid = $_REQUEST['auth_user'];
  30. $pass = $_REQUEST['password_md5'];
  31. //Semaphor-Check
  32. if ( file_exists("templates/sem") && $userid != implode(file("templates/sem")) ) {
  33. die($errorFail2);
  34. } else {
  35. $rs = $adodb->Execute("SELECT *, u.userid as userid FROM qb_user u LEFT JOIN qb_user_group ug ON ug.userid = u.userid WHERE u.userid = '".$userid."'") or die($adodb->ErrorMsg());
  36. // $rs = $adodb->Execute("SELECT * FROM qb_user WHERE userid = '".$userid."'") or die($adodb->ErrorMsg());
  37. if ($rs && strlen($pass) > 0 && $rs->fields['passwd'] === $pass) {
  38. $record = array();
  39. $record['updated'] = date('Y-m-d H:i:s');
  40. $record['user'] = $userid;
  41. $record['host'] = $_SERVER['REMOTE_ADDR'];
  42. $record['operation'] = 'login';
  43. $record['newval'] = session_id();
  44. $rs2 = $adodb->SelectLimit("SELECT * FROM qb_changelog", 1);
  45. $adodb->Execute($adodb->GetInsertSQL($rs2, $record));
  46. $_SESSION['userid'] = $rs->fields['userid'];
  47. $_SESSION['passkey'] = md5($userid.$pass.'qbuilder');
  48. $_SESSION['group_name'] = $rs->fields['group_name'];
  49. #header('Location: phplayersmenu-3.2.0/index3.php');
  50. header('Location: nola.php');
  51. } else {
  52. die($errorFail);
  53. }
  54. }
  55. ?>