Changeset 376 for trunk/includes/global_function.php
- Timestamp:
- Mar 11, 2010, 8:40:32 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/global_function.php
r369 r376 1 1 <?php 2 3 // User licence levels4 define('LICENCE_ANONYMOUS', -1);5 define('LICENCE_USER', 0);6 define('LICENCE_MODERATOR', 1);7 define('LICENCE_ADMIN', 2);8 2 9 3 // Log types … … 213 207 } 214 208 215 function Licence($Licence)216 {217 global $Database;218 219 if($Licence == -1) return(true);220 else221 if(isset($_SESSION['User']) and ($_SESSION['User'] <> '') and ($_SESSION['UserID'] != ''))222 {223 // $User = $_SESSION['User'];224 $Pass = $_SESSION['Pass'];225 $Line = mysql_fetch_array($Database->SQLCommand('SELECT * FROM `User` WHERE `ID` = '.$_SESSION['UserID'].' AND `GM` >= '.$Licence.' AND `Pass` = sha1(CONCAT(sha1("'.$Pass.'"), `Salt`))'));226 return($Line);227 } else228 {229 return(!isset($_SERVER['REMOTE_ADDR']));230 }231 }232 233 209 function MysqlDateTimeToTime($Time) 234 210 { … … 274 250 function WriteLog($Text, $Type) 275 251 { 276 global $Database, $Config ;252 global $Database, $Config, $User; 277 253 278 if(!isset($_SERVER['REMOTE_ADDR'])) 279 { 280 $user = 0; 281 $ip = 'Konzole'; 282 } else 283 { 284 if(array_key_exists('UserID', $_SESSION)) $user = $_SESSION['UserID']; 285 else $user = 0; 286 $ip = addslashes($_SERVER['REMOTE_ADDR']); 287 } 254 if(!isset($_SERVER['REMOTE_ADDR'])) $IP = 'Konzole'; 255 else $IP = addslashes($_SERVER['REMOTE_ADDR']); 288 256 289 257 $Database->SelectDatabase($Config['Database']['Database']); 290 258 $Query = 'INSERT INTO `Log` ( `User` , `Type` , `Text` , `Date` , `IP` ) 291 VALUES ('.$ user.', '.$Type.', "'.addslashes($Text).'", NOW(), "'.$ip.'")';259 VALUES ('.$User->Id.', '.$Type.', "'.addslashes($Text).'", NOW(), "'.$IP.'")'; 292 260 $Database->SQLCommand($Query); 293 261 } … … 535 503 } 536 504 537 function GetPasswordSalt()538 {539 return(substr(sha1(mt_rand()), 0, 8));540 }541 542 505 function ErrorMessage($Text) 543 506 {
Note:
See TracChangeset
for help on using the changeset viewer.