Jump to content

Cookies on include files.


turkman

Recommended Posts

didn't work.  still on one page its the new cookie, go to a different page and displays old cookie.

 

try yourself i have debugging on. supercookie is what you are looking for.

 

go to the site it will create a cookie.

go to stuff, log out

you will be redirected to main page and have a new cookie

click on post, bulletins, faq and you will have old cookie back

 

www.imgboard.co.uk

Hey OP, just saying:

 

Rule #13: Duplication of topics is strictly prohibited. Users will not post duplicate topics, if a topic needs moved please use the "Report to Moderator" button and a staff member will move the topic as soon as possible.

(http://www.phpfreaks.com/forums/index.php/topic,310296.0.html)

 

Also, trying to post out all the meaningful bits of code helps - for example the log out bit, both places where you set cookies, etc.

the other thread didn't make sense. Thought this was more clear. Its just stupid problems now. I can log in and override the existing cookie and get a new one. But using basically the same function i CANNOT get it to change.

 

This bit works, if i have a cookie and log in. It will override the cookie.

 

  if($p==$row['pass']){ 
        
        $n = $row['uname'];
        $_SESSION['uname'] =$row['uname'];
        $_SESSION['ID']= $row['ID'];
         $_SESSION['LEVEL'] = $row['level'];  
         $_SESSION['lv'] = $row['lv'];  
           
         
         setcookie("supercookie",$row['scookie'],time() + 60 *60 *24 *30);
         $cc = $row['scookie'];
         
         
        
        unset($_SESSION['lf']);
        echo "<script>location.href='http://www.imgboard.co.uk'</script>.";
        header("Location: http://www.imgboard.co.uk");

 

 

this bit doesnt work, despite being just below the above code in the file.

 


else if(isset($_GET['logout'])){
    
   
       
        
        
        unset($_SESSION['uname']);
        unset($_SESSION['ID']);
         unset($_SESSION['LEVEL']) ;
         unset($_SESSION['lv']);
         $cr = $_COOKIE['supercookie'];
        setcookie("supercookie",$cr ,time() -3600);
       
       
        $charlist =  "abcdefghijklmnopqrstuvwxyz0123456789";
        $c = "";
        
        for($i = 0; $i < 25; $i++ ){
        
              
              $r = rand() % strlen($charlist);
              $c .= $charlist[$r];
        
        
        }
        
        setcookie("supercookie",$c,time() + 60 * 60 * 24 * 30);
        echo "<script>location.href='http://www.imgboard.co.uk'</script>.";
        header("Location: http://www.imgboard.co.uk");
    
    
    
    
    }

 

 

Its practically the same code! yet it doesn't work when i try to logout. However it works when i log in. So fukkn annoying.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.