-
Notifications
You must be signed in to change notification settings - Fork 0
/
getinfo.php
92 lines (84 loc) · 2.44 KB
/
getinfo.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
error_reporting(E_ALL ^ E_NOTICE);
require 'config.php';
define('FROMEWORK',false);
require 'framwork/MooPHP.php';
class GetInfo {
private $_functions = array(1=>'index',2=>'getUserPhoto',3=>'mcUnset');
function __construct() {
$f = empty($_GET['f'])?1:trim($_GET['f']);
$fun = $this->_functions[$f];
if(!empty($fun))
$this->$fun();
else
echo 'has no method!';
}
function index(){
echo "class : getInfo -> function : index!";
}
function getUserPhoto(){
$uid = trim($_GET['uid']);
$style = empty($_GET['type'])?'mid':trim($_GET['type']);
if(empty($uid))
$img = 'public/system/images/service_nopic_man.gif';
else{
$user = MooMembersData($uid);
if(array_empty($user))
$img = 'public/system/images/service_nopic_man.gif';
else{
if($user['images_ischeck']==1 && !empty($user['mainimg'])){
$img = MooGetphoto($uid,$style);
if(!$img)
$img = $user['mainimg'];
}elseif(!empty($user['mainimg'])){
$img = $user['gender']==1?'public/system/images/woman.gif':'public/system/images/man.gif';
}else{
$img = $user['gender']==1?'public/system/images/service_nopic_woman.gif':'public/system/images/service_nopic_man.gif';
}
}
}
$path_parts = pathinfo($img);
switch(strtolower($path_parts['extension'])){
case 'png':
header('Content-Type: image/png');
$im = @imagecreatefrompng('http://'.$_SERVER['SERVER_NAME'].'/'.$img);
imagepng($im);
break;
case 'jpg':
header('Content-Type: image/jpeg');
$im = @imagecreatefromjpeg('http://'.$_SERVER['SERVER_NAME'].'/'.$img);
imagejpeg($im);
break;
case 'jpeg':
header('Content-Type: image/jpeg');
$im = @imagecreatefromjpeg('http://'.$_SERVER['SERVER_NAME'].'/'.$img);
imagejpeg($im);
break;
case 'gif':
header('Content-Type: image/gif');
$im = @imagecreatefromgif('http://'.$_SERVER['SERVER_NAME'].'/'.$img);
imagegif($im);
break;
default:
header('Content-Type: image/png');
/* Create a blank image */
$im = imagecreatetruecolor(150, 30);
$bgc = imagecolorallocate($im, 255, 255, 255);
$tc = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
/* Output an error message */
imagestring($im, 1, 5, 5, 'Error loading ' . $imgname, $tc);
imagepng($im);
}
imagedestroy($im);
}
function mcUnset(){
$key = $_GET['key'];
if(!empty($key))
mc_unset($key);
else
echo 'error!';
}
}
$gt = new GetInfo();
?>