OSDN Git Service

Fixed some bugs and some mysql queries.
[idb/iDB.git.git] / inc / prelogin.php
1 <?php
2 /*
3     This program is free software; you can redistribute it and/or modify
4     it under the terms of the Revised BSD License.
5
6     This program is distributed in the hope that it will be useful,
7     but WITHOUT ANY WARRANTY; without even the implied warranty of
8     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9     Revised BSD License for more details.
10
11     Copyright 2004-2007 Cool Dude 2k - http://intdb.sourceforge.net/
12     Copyright 2004-2007 Game Maker 2k - http://upload.idb.s1.jcink.com/
13
14     $FileInfo: prelogin.php - Last Update: 08/09/2007 SVN 73 - Author: cooldude2k $
15 */
16 $File3Name = basename($_SERVER['SCRIPT_NAME']);
17 if ($File3Name=="prelogin.php"||$File3Name=="/prelogin.php") {
18         require('index.php');
19         exit(); }
20 $_SESSION['CheckCookie']="done";
21 $querylog2 = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `Name`='%s' AND `Password`='%s'", array($_COOKIE['MemberName'],$_COOKIE['SessPass']));
22 $resultlog2=mysql_query($querylog2);
23 $numlog2=mysql_num_rows($resultlog2);
24 if($numlog2>=1) {
25 $il=0;
26 $YourIDAM=mysql_result($resultlog2,$il,"id");
27 $YourGroupAM=mysql_result($resultlog2,$il,"GroupID");
28 $YourPassAM=mysql_result($resultlog2,$il,"Password");
29 $gquery = query("SELECT * FROM `".$Settings['sqltable']."groups` WHERE `id`=%i", array($YourGroupAM));
30 $gresult=mysql_query($gquery);
31 $YourGroupAM=mysql_result($gresult,0,"Name");
32 @mysql_free_result($gresult);
33 $YourTimeZoneAM=mysql_result($resultlog2,$il,"TimeZone");
34 $UseThemeAM=mysql_result($resultlog2,$il,"UseTheme");
35 $YourDSTAM=mysql_result($resultlog2,$il,"DST");
36 $NewDay=GMTimeStamp();
37 $NewIP=$_SERVER['REMOTE_ADDR'];
38 $queryup = query("UPDATE `".$Settings['sqltable']."members` SET `LastActive`=%i,`IP`='%s' WHERE `id`=%i", array($NewDay,$NewIP,$YourIDAM));
39 $_SESSION['Theme']=$UseThemeAM;
40 $_SESSION['MemberName']=$_COOKIE['MemberName'];
41 $_SESSION['UserID']=$YourIDAM;
42 $_SESSION['UserTimeZone']=$YourTimeZoneAM;
43 $_SESSION['UserGroup']=$YourGroupAM;
44 $_SESSION['UserDST']=$YourDSTAM;
45 setcookie("MemberName", $YourNameM, time() + (7 * 86400), $basedir);
46 setcookie("UserID", $YourIDAM, time() + (7 * 86400), $basedir);
47 setcookie("SessPass", $YourPassAM, time() + (7 * 86400), $basedir);
48 } if($numlog2<=0) {
49 redirect("location",$basedir.url_maker($exfile['member'],$Settings['file_ext'],"act=logout",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'],FALSE));
50 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
51 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
52 @mysql_free_result($resultlog2);
53 ?>