Cookie probs
Posted by: Darghon (62.235.144.---)
Date: February 03, 2007 03:47PM

I have a webhost running in my home network, just installed WAMP5 and it all runs very good, BUT

when I open my website locally on the pc (127.0.01) then I can create cookies, but when I try to access the website from an other pc in the network then I can't... explorer options are set to allow all cookies so thats not the problem.

The website needs to work with cookies, so no session solution for me

if anyone knows a fix for this its greatly appreciated

Options: ReplyQuote
Re: Cookie probs
Posted by: CyberSpatium (71.237.217.---)
Date: February 03, 2007 11:17PM

make sure you allow cookies in IE for both 127.0.0.1 and your website domain. try this in another browser and see if you get the same results.

CyberSpatium
WAMP English Forum Admin
--------------------------------------

like my free support, help support me by checking out my website here:
www.AnyRingTone.net

Options: ReplyQuote
Re: Cookie probs
Posted by: Darghon (---.104-247-81.adsl-dyn.isp.belgacom.be)
Date: February 04, 2007 11:38AM

I tried in IE and opera

Setting are set to accept all cookies so thats not the problem.

Options: ReplyQuote
Re: Cookie probs
Posted by: CyberSpatium (71.237.217.---)
Date: February 05, 2007 06:45AM

post your code please.

CyberSpatium
WAMP English Forum Admin
--------------------------------------

like my free support? help support me by checking out my new Newbie Webmaster Development Forum dedicated to the newbie webmaster here:
www.WebDevNewbie.com

Options: ReplyQuote
Re: Cookie probs
Posted by: Darghon (62.235.144.---)
Date: February 05, 2007 10:22AM

This is the piece of the sourcecode on the login page where the cookie is needed.
This works on every free webserver I ever tried, but it doesn't work on my own webserver...

$strSQL = "SELECT * FROM tbl_user WHERE loginName='$user'";
$rsUser = mysql_query($strSQL, $cnn);
if(mysql_num_rows($rsUser) >= 1)
{
$rowUser = mysql_fetch_array($rsUser);
if($pass == $rowUser["Pass"])
{
if($rowUser["Val"] == 0){
$err = "Account needs to be activated";
}
else{
setcookie("Login", $rowUser["ID"], time()+7200, "/~rasmus/", ".utoronto.ca", 1)winking smiley;
if(!isset($_COOKIE["Login"])){
$err .= "<br />Cookie not created";
}
}
}
else
{
$err = "Wrong password";
}
}
else
{
$err = "No such user";
}

Options: ReplyQuote
Re: Cookie probs
Posted by: CyberSpatium (71.237.217.---)
Date: February 05, 2007 10:58PM

change:
setcookie("Login", $rowUser["ID"], time()+7200, "/~rasmus/", ".utoronto.ca", 1)winking smiley;

to
setcookie("Login", $rowUser["ID"], time()+7200, "/~rasmus/", "localhost", 1)winking smiley;

if your local directory structure is different then your webserver, you will need to change the path setting /~rasmus/ to the location on your local server.



CyberSpatium
WAMP English Forum Admin
--------------------------------------

like my free support? help support me by checking out my new Newbie Webmaster Development Forum dedicated to the newbie webmaster here:
www.WebDevNewbie.com

Options: ReplyQuote
Re: Cookie probs
Posted by: Darghon (62.235.144.---)
Date: February 05, 2007 11:00PM

Oh yea that was a attempt to make it work again

didn't work that way, and didn't work with just setcookie("Login", $rowUser["ID"], time()+7200)
but i'll try to change it in the morning, to late to try now

Options: ReplyQuote


Sorry, only registered users may post in this forum.