-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patho_query.php
69 lines (48 loc) · 1.24 KB
/
o_query.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
<?php //o_query.php
class o_query
{
public $p_get = array();
public $p_post = array();
public $p_cookie = array();
public $p_method = "";
public $p_query = "";
function __construct()
{
$this->p_cookie = $_COOKIE;
$this->p_method = $_SERVER['REQUEST_METHOD'];
$this->p_query = $_SERVER['QUERY_STRING'];
switch ($this->p_method)
{
case 'GET':
$get_pairs = explode("&",self::m_decode_q($this->p_query));
foreach ($get_pairs as $get_pair)
{
$pair = explode("=",$get_pair);
$this->p_get[$pair[0]] = $pair[1];
}
$this->p_post = $this->p_get;
break;
case 'POST':
if (is_array($_POST) && (count($_POST) > 0))
$this->p_post = array_merge($_POST,$this->p_cookie);
break;
} //end switch
} //end __construct
public function m_get($key=null)
{
return $this->p_get[$key];
} //end m_get
public function m_post($key=null)
{
return $this->p_post[$key];
} //end m_post
public function m_decode_q($query=null)
{
return convert_uudecode(urldecode(base64_decode($query)));
} //end m_decode_q
public function m_encode_q($query=null)
{
$session_query = $_COOKIE['PHPSESSID']."&".$query;
return base64_encode(urlencode(convert_uuencode($session_query)));
} //end m_encode_q
} //end o_query.php