home *** CD-ROM | disk | FTP | other *** search
/ PC World 2001 March / PCWorld_2001-03_cd.bin / KOMUNIK / progweb / progweb.exe / phpnuke / html / auth.inc.php < prev    next >
PHP Script  |  2000-12-05  |  2KB  |  59 lines

  1. <?PHP
  2.  
  3. ######################################################################
  4. # PHP-NUKE: Web Portal System
  5. # ===========================
  6. #
  7. # Copyright (c) 2000 by Francisco Burzi (fburzi@ncc.org.ve)
  8. # http://phpnuke.org
  9. #
  10. # This modules is for administrators authentication
  11. #
  12. # This program is free software. You can redistribute it and/or modify
  13. # it under the terms of the GNU General Public License as published by
  14. # the Free Software Foundation; either version 2 of the License.
  15. ######################################################################
  16.  
  17. if(!isset($mainfile)) { include("mainfile.php"); }
  18.  
  19. if ((isset($aid)) && (isset($pwd)) && ($op == "login")) {
  20.     if($aid!="" AND $pwd!="") {
  21.     $result=mysql_query("select pwd from authors where aid='$aid'");
  22.     list($pass)=mysql_fetch_row($result);
  23.     if($pass == $pwd) {
  24.         $admin = base64_encode("$aid:$pwd");
  25.         setcookie("admin","$admin",time()+2592000); // 1 mo is 2592000
  26.     }
  27.     }
  28. }
  29.  
  30. $admintest = 0;
  31.  
  32. if(isset($admin)) {
  33.   $admin = base64_decode($admin);
  34.   $admin = explode(":", $admin);
  35.   $aid = "$admin[0]";
  36.   $pwd = "$admin[1]";
  37.   if ($aid=="" || $pwd=="") {
  38.     $admintest=0;
  39.     echo "<html>\n";
  40.     echo "<title>INTRUDER ALERT!!!</title>\n";
  41.     echo "<body bgcolor=FFFFFF text=000000>\n<br><br><br>";
  42.     echo "<center><img src=images/eyes.gif border=0><br><br>\n";
  43.     echo "<font face=Verdana size=+4><b>Get Out!</b></font></center>\n";
  44.     echo "</body>\n";
  45.     echo "</html>\n";
  46.     exit;
  47.   }
  48.   $result=mysql_query("select pwd from authors where aid='$aid'");
  49.   if(!$result) {
  50.         echo "Selection from database failed!";
  51.         exit;
  52.   } else {
  53.     list($pass)=mysql_fetch_row($result);
  54.     if($pass == $pwd && $pass != "") {
  55.         $admintest = 1;
  56.     }
  57.   }
  58. }
  59. ?>