home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 May / INTERNET103.ISO / pc / software / windows / building / php_nuke / html / auth.php < prev    next >
Encoding:
PHP Script  |  2002-09-16  |  2.3 KB  |  66 lines

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