Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- $db_Connect = mysql_connect($config->Host,$config->User,$config->Pass);
- mysql_select_db($config->DB,$db_Connect);
- class UserControl
- {
- public $user;
- public function check_user($name, $pass)
- {
- $sql = "SELECT id,Name,Admin,Password,Banned FROM `players` WHERE Name='".mysql_real_escape_string($name)."' AND Password='".md5(mysql_real_escape_string($pass))."' LIMIT 1";
- $result = mysql_query($sql) or die(mysql_error());
- if (mysql_num_rows($result) == 1)
- {
- $this->user = mysql_fetch_object($result);
- mysql_free_result($result);
- //session_register('name');
- $_SESSION['Name'] = $this->user->Name;
- $_SESSION['AdminLevel'] = $this->user->AdminLevel;
- $_SESSION['Password'] = $this->user->Password;
- $_SESSION['id'] = $this->user->id;
- $_SESSION['Locked'] = $this->user->Locked;
- return $this->user->id;
- }
- else
- {
- return false;
- }
- }
- function login($userid)
- {
- $_SESSION['loggedin'] = true;
- echo 'Palun oota...';
- echo '<script language="javaScript">
- top.document.location="index.php?page=home";
- </script>';
- }
- function CreatePass()
- {
- $chars = "abcdefghijkmnopqrstuvwxyz0123456789";
- srand((double)microtime()*1000000);
- $i = 0;
- $pass = '';
- while ($i <= 7)
- {
- $num = rand() % 33;
- $tmp = substr($chars, $num, 1);
- $pass = $pass . $tmp;
- $i++;
- }
- return $pass;
- }
- }
- function GetContentLine($filename,$conline,$row,$loopsize)
- {
- $file = $filename;
- $handle = fopen($file,"r");
- $content = fread($handle,filesize($file));
- $filter = trim(strip_tags($content));
- $filter = explode("\n", $filter);
- foreach($filter as $value)
- {
- $output[] = trim($value);
- }
- while($i < $loopsize)
- {
- $line[] = explode(",",$output[$i]);
- $i++;
- }
- fclose($handle);
- return $line[$conline][$row];
- }
- function logout()
- {
- $_SESSION['loggedin'] = false;
- header('refresh: 2; url=index.php?page=home');
- }
- function check()
- {
- $check = mysql_query('SELECT link FROM `pages` WHERE pagename = "'.home.'" LIMIT 1');
- if(mysql_num_rows($check) != 0)
- {
- return true;
- }
- else
- {
- echo '<div class="right">You have not installed the MySQL table yet.</div>';
- include_once ('panel.php');
- include_once ('footer.php');
- exit;
- }
- }
- function ResizeImage($old_image_name, $new_image_name, $new_image_x_size, $new_image_y_size)
- {
- global $image_prop;
- if(@imagecreatetruecolor(1,1)) $GDLIB_VERS = 2;
- else $GDLIB_VERS = 1;
- $file = basename($old_image_name);
- $image_ext = explode(".", $file);
- if($image_ext[1] == "gif" || $image_ext[1] == "GIF")
- {
- if(function_exists ("ImageCreateFromGIF"))
- {
- $imgA = ImageCreateFromGIF ($old_image_name);
- // height and width recalculate
- $org_x = ImageSX($imgA);
- $org_y = ImageSY($imgA);
- if($org_x >= $org_y && $image_prop == "ja") {
- $new_image_x_size = $new_image_x_size;
- $new_image_y_size = $org_y / ($org_x / $new_image_x_size);
- $new_image_y_size = floor($new_image_y_size);
- }
- if($org_x < $org_y && $image_prop == "ja")
- {
- $new_image_y_size = $new_image_y_size;
- $new_image_x_size = $org_x / ($org_y / $new_image_y_size);
- $new_image_x_size = floor($new_image_x_size);
- }
- if($GDLIB_VERS == 2)
- {
- $imgB = imagecreatetruecolor($new_image_x_size,$new_image_y_size);
- imagecopyresampled($imgB,$imgA,0,0,0,0, $new_image_x_size, $new_image_y_size, $org_x ,$org_y);
- }
- else
- {
- $imgB = imagecreate($new_image_x_size,$new_image_y_size);
- imagecopyresized($imgB, $imgA,0,0,0,0, $new_image_x_size, $new_image_y_size, $org_x ,$org_y);
- }
- if($imgB) imagegif($imgB, $new_image_name);
- }
- else
- {
- return false;
- }
- }
- if($image_ext[1] == "jpg" || $image_ext[1] == "jpeg" || $image_ext[1] == "JPG" || $image_ext[1] == "JPEG")
- {
- if(function_exists ("ImageCreateFromJPEG"))
- {
- $imgA = ImageCreateFromJPEG ($old_image_name);
- $org_x = ImageSX($imgA);
- $org_y = ImageSY($imgA);
- if($org_x >= $org_y && $image_prop == "ja")
- {
- $new_image_x_size = $new_image_x_size;
- $new_image_y_size = $org_y / ($org_x / $new_image_x_size);
- $new_image_y_size = floor($new_image_y_size);
- }
- if($org_x < $org_y && $image_prop == "ja")
- {
- $new_image_y_size = $new_image_y_size;
- $new_image_x_size = $org_x / ($org_y / $new_image_y_size);
- $new_image_x_size = floor($new_image_x_size);
- }
- $quality = 100;
- if($GDLIB_VERS == 2)
- {
- $imgB = imagecreatetruecolor($new_image_x_size,$new_image_y_size);
- imagecopyresampled($imgB, $imgA,0,0,0,0, $new_image_x_size, $new_image_y_size, $org_x ,$org_y);
- }
- else
- {
- $imgB = imagecreate($new_image_x_size,$new_image_y_size);
- imagecopyresized($imgB, $imgA,0,0,0,0, $new_image_x_size, $new_image_y_size, $org_x ,$org_y);
- }
- imagejpeg($imgB, $new_image_name, $quality);
- }
- else
- {
- return false;
- }
- }
- if($image_ext[1] == "png" || $image_ext[1] == "PNG")
- {
- if(function_exists ("ImageCreateFromPNG"))
- {
- $imgA = ImageCreateFromPNG ($old_image_name);
- $org_x = ImageSX($imgA);
- $org_y = ImageSY($imgA);
- if($org_x >= $org_y && $image_prop == "ja")
- {
- $new_image_x_size = $new_image_x_size;
- $new_image_y_size = $org_y / ($org_x / $new_image_x_size);
- $new_image_y_size = floor($new_image_y_size);
- }
- if($org_x < $org_y && $image_prop == "ja")
- {
- $new_image_y_size = $new_image_y_size;
- $new_image_x_size = $org_x / ($org_y / $new_image_y_size);
- $new_image_x_size = floor($new_image_x_size);
- }
- if($GDLIB_VERS == 2)
- {
- $imgB = imagecreatetruecolor($new_image_x_size,$new_image_y_size);
- imagecopyresampled($imgB, $imgA,0,0,0,0, $new_image_x_size, $new_image_y_size, $org_x ,$org_y);
- }
- else
- {
- $imgB = imagecreate($new_image_x_size,$new_image_y_size);
- imagecopyresized($imgB, $imgA,0,0,0,0, $new_image_x_size, $new_image_y_size, $org_x ,$org_y);
- }
- imagepng($imgB, $new_image_name);
- }
- else
- {
- return false;
- }
- }
- if(!$imgA)
- {
- return false;
- }
- return true;
- }
- ?>
Add Comment
Please, Sign In to add comment