I just built a whois class, simple, and i have a problem, for example, when i'm in: ?a=css, it will add to the DB : a=css, and then in for printing a=css real location [ editing css files ], no pro, but, when i got: ?a=css&w=new, i have a problem, the data is on $data [?a=css&w=new] but how can i make a simple replacement?
The whois class:
Code: Select all
class whois{
private $doSearch; // checking if the user is not yet signed in at the DB storage
private $IP; // client's ip
private $expent; // will be in use when we will need to get the client's location
private $time; // linux time [time();]
private $username;
private $status;
private $sess_value;
private $sess_name = "admin_sess";
public function checkTime(){
global $DB;
$time = time(); // 3000 - 2700 >= 300
$DB -> query("DELETE FROM `pmaker_whois` WHERE '$time' - timestamps >= '300'");
}
public function OnPageLoad(){
global $DB,$Err;
$this -> checkTime();
$this -> IP = $_SERVER['REMOTE_ADDR'];
$this -> doSearch = $DB -> query("SELECT * FROM `pmaker_whois` WHERE ip = '{$this -> IP}'");
if(preg_match("/.?./" ,$_SERVER['REQUEST_URI'])){
$this -> expent = str_replace("?","/",$_SERVER['REQUEST_URI']);
$this -> location = basename($this -> expent);
}
else
{
$this -> location = $_SERVER['REQUEST_URI'];
}
$this -> time = time();
$this -> date = date("H:i:s");
if(empty($_SESSION)){
$this -> sess_value = 0;
}
else{
$this -> sess_value = $_SESSION[$this -> sess_name];
}
if($DB -> count($this -> doSearch) == 1){
$DB -> query("UPDATE `pmaker_whois` SET location = '{$this -> location}', timestamps = '{$this -> time}',ip = '{$this -> IP}', sess_value = '{$this -> sess_value}' WHERE ip = '{$this -> IP}' ");
}
else
{
$DB -> query("INSERT INTO `pmaker_whois` (location,timestamps,date,ip,sess_value) VALUES ('{$this -> location}','{$this -> time}','{$this -> date}','{$this -> IP}','{$this -> sess_value}')");
}
}
}Tal.