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

  1. <?php
  2.  
  3. ###################################################################### # Modulo Splatt Forum per PHP-NUKE 
  4. #------------------------- 
  5. # Versione: 3.2 
  6. # Copyright (c) 2002 by: 
  7. # Giorgio Ciranni (~Splatt~) 
  8. # (http://www.splatt.it) 
  9. # (webmaster@splatt.it) 
  10. # Supporto tecnico disponibile sul Forum di www.splatt.it 
  11. ######################################################################
  12. # Splatt Forum 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. # Splatt Forum is distributed in the hope that it will be useful,
  16. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18. # GNU General Public License for more details.
  19. #
  20. # You should have received a copy of the GNU General Public License
  21. # along with this program; if not, write to the Free Software
  22. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA   
  23. # 02111-1307  USA
  24. ######################################################################
  25.  
  26.  
  27. # change above $nukeversion to 0 if you have phpnuke version 5.0
  28. $nukversion = 1;
  29.  
  30. //$module_name = "$name";
  31.  
  32. require_once("mainfile.php");
  33.    $module_name = basename(dirname(__FILE__));
  34.    get_lang($module_name);  
  35.  
  36.  
  37. /* Make a database connection */
  38.  
  39. if(!$db = @mysql_connect("$dbhost", "$dbuname", "$dbpass")) {
  40.     die("<font size=\"+1\">An Error Occured</font><hr>phpBB was unable to connect to the database. <BR>Please check $dbhost, $dbuser, and $dbpasswd in config.php.");
  41. }
  42.  
  43. if(!@mysql_select_db("$dbname",$db)) {
  44.     die("<font size=\"+1\">An Error Occured</font><hr>phpBB was unable to find the database <b>$dbname</b> on your MySQL server. <br>Please make sure you ran the phpBB installation script.");
  45. }
  46.  
  47. /* Code for the LastVisit cookie */
  48.  
  49. // Inizio Keledan
  50. if ($user)
  51. {
  52.  $user_data = base64_decode($user);
  53.  $userdata = explode(":", $user_data);
  54.  $userdata = get_userdata_from_id($userdata[0], $db);
  55. }
  56.  
  57. // Keledan Fine
  58. if(isset($HTTP_COOKIE_VARS["LastVisit"])) {
  59.     $userdata["lastvisit"] = $HTTP_COOKIE_VARS["LastVisit"];
  60. } else {
  61.     $value = date("Y-m-d H:i");
  62.     /* one year 'til expiry */
  63.     $time = (time() + 3600 * 24 * 7 * 52);
  64.    // setcookie("LastVisit", $value, $time);
  65. }
  66.  
  67. list($day, $time) = split(" ", $userdata[lastvisit]);
  68. list($hour, $min) = split(":", $time);
  69. $this_min = date("i");
  70. $this_hour = date("H");
  71. $this_day = date("Y-m-d");
  72.  
  73. /* Only set the last visit cookie if 10 mins have gone by, or its the next day or hour or something... */
  74. /* This is kinda ugly but it works :) */
  75. if( ($this_day > $day) || ($this_hour > $hour) || (($this_min - 10) > $min) ) {
  76.     $value = date("Y-m-d H:i");
  77.     $time = (time() + 3600 * 24 * 7 * 52);
  78.     setcookie("LastVisit", $value, $time);
  79.  
  80. }
  81.  
  82.  
  83. $sql = "SELECT * FROM ${prefix}_forum_config";
  84.  
  85. if($result = mysql_query($sql, $db)) {
  86.         if($myrow = mysql_fetch_array($result)) {
  87.                 $allow_html = $myrow["allow_html"];
  88.                 $allow_bbcode = $myrow["allow_bbcode"];
  89.                 $allow_sig = $myrow["allow_sig"];
  90.                 $posts_per_page = $myrow["posts_per_page"];
  91.                 $hot_threshold = $myrow["hot_threshold"];
  92.                 $topics_per_page = $myrow["topics_per_page"];
  93.         }
  94. }
  95.  
  96. ?>