Try setting the cookie this way: setcookie("logged", $user, time()+3600*2,"/",".hidden-webs.com",0); PHP: There's a '.' in the front of the domain name, and the 0 parameter was added to the end.
problem after problem... made the modification, but when I browse using the perl proxy, I can't view the images from website and I still get invalid error.
I'm running out of ideas I can't reproduce the problem; it works fine for me. But I'm also not using a login page. I just used a one-line php script to set the cookie, and then I load the proxy script directly. I wonder if there's some kind of side-effect interaction between your login page and the proxy script once you redirect to it.