Advertisement
Guest User

Untitled

a guest
May 8th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.67 KB | None | 0 0
  1. //common.php
  2.  
  3. <?php
  4.  
  5. function get_from_mangosconf($configvalue,$id){ // Get Config values FROM mangos conf file. $configvalue should be name of config. $id is ID of realm ( config array value )
  6.     global $MW;
  7.     $init = 'id_'.$id;
  8.     $mangosconf = file((string)$MW->getConfig->mangos_conf_external->$init->mangos_world_conf);
  9.     foreach ($mangosconf as $line_num){
  10.         $line_num = (string)$line_num;
  11.         if (strstr($line_num,$configvalue) == TRUE){
  12.             $arr = explode(' = ', $line_num);
  13.             return str_replace("\r","",str_replace("\n","",$arr['1']));
  14.         }
  15.     }
  16. }
  17.  
  18. function sha_password($user,$pass){
  19.     $user = strtoupper($user);
  20.     $pass = strtoupper($pass);
  21.     return SHA1($user.':'.$pass);
  22. }
  23.  
  24. function check_for_symbols($string, $space_check = 0){
  25.     //$space_check=1 means space is not allowed
  26.     $len=strlen($string);
  27.     $allowed_chars="abcdefghijklmnopqrstuvwxyzæøåABCDEFGHIJKLMNOPQRSTUVWXYZÆØÅ0123456789";
  28.     if(!$space_check) {
  29.         $allowed_chars .= " ";
  30.     }
  31.     for($i=0;$i<$len;$i++)
  32.         if(strstr($allowed_chars,$string[$i]) == FALSE)
  33.             return TRUE;
  34.     return FALSE;
  35. }
  36.  
  37. function get_banned($account_id,$returncont){
  38.     global $DB;
  39.  
  40.     $get_last_ip = $DB->selectCell("SELECT last_ip FROM account WHERE id='".$account_id."'");
  41.     $db_IP = $get_last_ip;
  42.  
  43.     $ip_check = $DB->selectCell("SELECT ip FROM `ip_banned` WHERE ip='".$db_IP."'");
  44.     if ($ip_check == FALSE){
  45.         if ($returncont == "1"){
  46.             return FALSE;
  47.         }
  48.     }
  49.     else{
  50.         if ($returncont == "1"){
  51.             return TRUE;
  52.         }
  53.         else{
  54.             return $db_IP;
  55.         }
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement