array( 'flag' =>1, 'type' => 'mysql', 'version' => '5', 'host'=> 'localhost', 'port' => '80', 'user'=> 'tonia', 'pass'=> 'tp_353_tp'), ); ?>salt ; } /** * @param param : value to be saved in variable $salt * @desc setSalt : Setting value for $salt */ function setSalt ($value) { $this->salt = $value; } /** * @return returns value of variable $separator * @desc getSeparator : Getting value for variable $separator */ function getSeparator() { return $this->separator; } /** * @param param : value to be saved in variable $separator * @desc setSeparator : Setting value for $separator */ function setSeparator($value) { $this->separator = $value; } function textEncrypter() { $this->setSalt("SH737DH3"); $this->setSeparator("||:||"); } /** * @return encoded string with salt added * @param String to be encoded * @desc Adds Salt to Data and Encode it before sending back to client * @generationDate 2004-10-31 * @version 1.0 * @license GNU GPL License * @author Nilesh Dosooye */ function encode($string) { // Write Function Code Here $string = $string.$this->getSeparator().$this->getSalt(); $string = base64_encode($string); return $string; } /** * @return UnEncoded Data * @param String to be Decoded * @desc Decode Data and Exits if tampering of data is detected * @generationDate 2004-10-31 * @version 1.0 * @license GNU GPL License * @author Nilesh Dosooye */ function decode($string) { // Write Function Code Here $string = base64_decode($string); $tokens = explode($this->getSeparator(),$string); /* if (@$tokens[2]!=$this->getSalt()) { echo "Data tampering was detected. Your session has expired."; exit; } */ return $tokens[0]; } } global $encrypter; $encrypter = new textEncrypter(); ?>SetMyIpAddress("127.0.0.1"); $user_details['real_ip'] = $ip_class->GetIpAddress(); $user_details['shown_ip'] = $_SERVER['REMOTE_ADDR']; //echo "shown ip:".$user_details['shown_ip']." real: ".$user_details['real_ip']; //check if user ip is the reall ip or proxy ip if ($user_details['real_ip']!=$user_details['shown_ip']) $user_details['proxy_ip'] = $user_details['shown_ip']; else $user_details['proxy_ip'] = ''; //check if cookie is set for the user (going to log in) if (@$_COOKIE['tp_dio']=='') { //set the ip to store in cookie $brth_ena = uniqid(microtime(),TRUE).':'.$user_details['real_ip'].':'.rand(1000,9999); $brth_dio = md5($encrypter->encode($brth_ena)); } else { $brth_ena = @$_COOKIE['tp_ena']; $brth_dio = @$_COOKIE['tp_dio']; } // create cookie (cookiename, cookie value, expire, path) $user_details['tp_ena']=$brth_ena; $user_details['tp_dio']=$brth_dio; $user_details['token']=$brth_dio; //setcookie('brth_ena', $brth_ena,$session_expiration_time,'/'); setcookie('tp_dio', $brth_dio,$session_expiration_time,'/'); //if( !isset($_COOKIE['tp_dio']) && empty($_COOKIE['tp_dio']) ) {setcookie('tp_dio', $brth_dio,$session_expiration_time,'/');} ?> Atelier Tonia Poulaki