raymyster Posted April 12, 2008 Share Posted April 12, 2008 I am having complaints around my website that users are facing a prblem when they browse from one page to another users close o there area are the ones who are showing rather then theres, tat taking into consideration tat they are the ones who logged in with there usernae & password :S the code is as following: // THIS METHOD SETS USER LOGIN COOKIES // INPUT: $persistent (OPTIONAL) REPRESENTING WHETHER THE COOKIES SHOULD BE PERSISTENT OR NOT // OUTPUT: function user_setcookies($persistent = 0) { $cookie_id = $cookie_email = $cookie_password = ""; if(!empty($this->user_info) && !empty($this->user_info['user_email']) && !empty($this->user_info['user_id']) && !empty($this->user_info['user_password'])) { $cookie_id = $this->user_info['user_id']; $cookie_email = crypt($this->user_info['user_email'], $this->user_salt); $cookie_password = $this->user_info['user_password']; if($persistent == 0) { $cookie_time = 0; } else { $cookie_time = time()+3600; } } else { $cookie_time = time()-3600; } setcookie("user_id", $cookie_id, $cookie_time, "/"); setcookie("user_email", $cookie_email, $cookie_time, "/"); setcookie("user_password", $cookie_password, $cookie_time, "/"); } // END user_setcookies() METHOD What should i do?????????????????????? Quote Link to comment Share on other sites More sharing options...
Northern Flame Posted April 12, 2008 Share Posted April 12, 2008 the first thing i recommend you doing is checking your spelling so i can understand what you're trying to say.... Quote Link to comment Share on other sites More sharing options...
raymyster Posted April 12, 2008 Author Share Posted April 12, 2008 I am having complaints around my website that users are facing a problem when they browse from one page to another users close to their area are the ones who are showing rather then there’s, that taking into consideration that they are the ones who logged in with their username & password in the first place… Sorry new keyborad Quote Link to comment Share on other sites More sharing options...
raymyster Posted April 12, 2008 Author Share Posted April 12, 2008 no one will hepl here :S Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted April 12, 2008 Share Posted April 12, 2008 <?php function user_setcookies($persistent = 0) { $cookie_id = $cookie_email = $cookie_password = "";// what does this line do? if(!empty($this->user_info)||isset($this->user_info)||! empty($this->user_info['user_email'])||isset(($this->user_info['user_email']) ||isset($this->user_info['user_id'])| |!empty($this->user_info['user_id'])||isset($this->user_info['user_password'])|| !empty($this->user_info['user_password'])) { $cookie_id = $this->user_info['user_id']; $cookie_email = crypt($this->user_info['user_email'], $this->user_salt); $cookie_password = $this->user_info['user_password']; if($persistent == 0) { $cookie_time = 0; } else { $cookie_time = time()+3600; } } else { $cookie_time = time()-3600; } setcookie("user_id", $cookie_id, $cookie_time, "/"); setcookie("user_email", $cookie_email, $cookie_time, "/"); setcookie("user_password", $cookie_password, $cookie_time, "/"); } // END user_setcookies() METHOD ?> Quote Link to comment Share on other sites More sharing options...
raymyster Posted April 12, 2008 Author Share Posted April 12, 2008 $cookie_id = $cookie_email = $cookie_password = "";// what does this line do? this line assigns a null value in the cookie fo Id & email & password.... should i remove it? is it unecessary?? what? what? Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted April 13, 2008 Share Posted April 13, 2008 yes remove it please <?php function user_setcookies($persistent = 0) { if(empty($this->user_info)||empty($this->user_info['user_email'])|| empty($this->user_info['user_id'])){ echo "Data is Empty";} else if(!empty($this->user_info)||isset($this->user_info)|| !empty($this->user_info['user_email'])||isset(($this->user_info['user_email']) ||isset($this->user_info['user_id'])||!empty($this->user_info['user_id']) ||isset($this->user_info['user_password'])|| !empty($this->user_info['user_password'])) { $cookie_id = $this->user_info['user_id']; $cookie_email = crypt($this->user_info['user_email'], $this->user_salt); $cookie_password = $this->user_info['user_password']; if($persistent == 0) { $cookie_time = 0; } else { $cookie_time = time()+3600; } } else { $cookie_time = time()-3600; } setcookie("user_id", $cookie_id, $cookie_time, "/"); setcookie("user_email", $cookie_email, $cookie_time, "/"); setcookie("user_password", $cookie_password, $cookie_time, "/"); } // END user_setcookies() METHOD ?> Quote Link to comment Share on other sites More sharing options...
raymyster Posted April 13, 2008 Author Share Posted April 13, 2008 man i did exactly like you said & my webpage stoped loading returns the following error Parse error: parse error, unexpected '(', expecting T_VARIABLE or '$' in /hsphere/local/home/rasmeon/liubook.com/include/class_user.php on line 259 Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted April 13, 2008 Share Posted April 13, 2008 which line is that ??? Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted April 13, 2008 Share Posted April 13, 2008 <?php function user_setcookies($persistent = 0) { $cookie_id = $cookie_email = $cookie_password = ""; if(empty($this->user_info)||empty($this->user_info['user_email'])|| empty($this->user_info['user_id'])){ echo "Data is Empty";} else if(!empty($this->user_info)||isset($this->user_info)|| !empty($this->user_info['user_email'])||isset(($this->user_info['user_email']) ||isset($this->user_info['user_id'])||!empty($this->user_info['user_id']) ||isset($this->user_info['user_password'])|| !empty($this->user_info['user_password']))) { $cookie_id = $this->user_info['user_id']; $cookie_email = crypt($this->user_info['user_email'], $this->user_salt); $cookie_password = $this->user_info['user_password']; if($persistent == 0) { $cookie_time = 0; } else { $cookie_time = time()+3600; } } else { $cookie_time = time()-3600; } setcookie("user_id", $cookie_id, $cookie_time, "/"); setcookie("user_email", $cookie_email, $cookie_time, "/"); setcookie("user_password", $cookie_password, $cookie_time, "/"); }// END user_setcookies() METHOD ?> Quote Link to comment Share on other sites More sharing options...
raymyster Posted April 13, 2008 Author Share Posted April 13, 2008 / THIS METHOD VERIFIES LOGIN COOKIES, SETS APPROPRIATE OBJECT VARIABLES, AND UPDATES LAST ACTIVE TIME // INPUT: // OUTPUT: function user_checkCookies() { global $database, $setting; if(isset($_COOKIE['user_id']) & isset($_COOKIE['user_email']) & isset($_COOKIE['user_password'])) { // GET USER ROW IF AVAILABLE $user_id = $_COOKIE['user_id']; $this->se_user(Array($user_id)); // VERIFY USER EXISTS, LOGIN COOKIE VALUES ARE CORRECT, AND EMAIL HAS BEEN VERIFIED - ELSE RESET USER CLASS if($this->user_exists == 0 | $_COOKIE['user_email'] != crypt($this->user_info[user_email], $this->user_salt) | $_COOKIE['user_password'] != $this->user_info[user_password] | ($this->user_info[user_verified] == 0 & $setting[setting_signup_verify] != 0)) { $this->user_clear(); } } // IF USER LOGGED IN, UPDATE LAST ACTIVITY if($this->user_exists != 0) { $time_current = time(); $database->database_query("UPDATE se_users SET user_lastactive='$time_current' WHERE user_id='".$this->user_info[user_id]."'"); } } // END user_checkCookies() MET Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted April 13, 2008 Share Posted April 13, 2008 <?php function user_setcookies($persistent = 0) { $cookie_id = 0; $cookie_password= 0; $cookie_time= 0; if($cookie_id=='NULL'||$cookie_password=='NULL'||$cookie_time=='NULL') {Return TRUE;} else{ return FALSE;} if(empty($this->user_info)||empty($this->user_info['user_email'])|| empty($this->user_info['user_id'])){ echo "Data is Empty";} else if(!empty($this->user_info)||isset($this->user_info)|| !empty($this->user_info['user_email'])||isset($this->user_info['user_email']) ||isset($this->user_info['user_id'])||!empty($this->user_info['user_id']) ||isset($this->user_info['user_password'])|| !empty($this->user_info['user_password'])) { $cookie_id = $this->user_info['user_id']; $cookie_email = crypt($this->user_info['user_email'], $this->user_salt); $cookie_password = $this->user_info['user_password']; if($persistent == 0) { $cookie_time = 0; } else { $cookie_time = time()+3600; } } else { $cookie_time = time()-3600; } setcookie("user_id", $cookie_id, $cookie_time, "/"); setcookie("user_email", $cookie_email, $cookie_time, "/"); setcookie("user_password", $cookie_password, $cookie_time, "/"); }// END user_setcookies() METHOD ?> Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted April 13, 2008 Share Posted April 13, 2008 also Try folling the Guidelines 1.) Post In The Right Forum 2.) Ask Good Questions 3.) Never Ask Someone to Program or Rewrite a script for you. If your programmer is wonderinfg.why he was banned he should have followed this, instead of whining about it to me on MSN. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.