Cookies

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Cookies

Postby mightymouse3062 » 13. January 2008 17:29

I am having a problem setting cookies. Here is the code that I use:

$cookie_site_name = "";
$cookie_site_name_path = "";
setcookie("logged_in", 1, time()+604800, "$cookie_site_name_path", "$cookie_site_name");
setcookie("username", $login_username, time()+604800, "$cookie_site_name_path", "$cookie_site_name");

for the $cookie_site_name I have tried leaving it blank, deleting it, using localhost, 127.0.0.1, 192.168.1.3 (my computers ip address).
for the $cookie_site_name_path I have tried leaving it blank, deleting it, and using /, /system, /system/, system/. (system is the folder that I have the site in).

What I will be doing is using it for a administration system for a tournament and I am going to be creating an network so the system can be accessed from multiple computers. The only way I have been able to do this so far is by using the computers IP address. The problem I am having is it will not set any cookies.


Does anyone have an idea on why it is doing this or a way to fix it?

Thanks,
Mightymouse3062
mightymouse3062
 
Posts: 9
Joined: 11. January 2008 02:49

Postby Scory » 13. January 2008 17:37

How do you check the cookies? Code example?

Greets
Scory
Scory
 

Postby mightymouse3062 » 13. January 2008 17:39

if(isset($_COOKIE['logged_in']) == 1){
$logged_in = 1;
$logged_in_userid = $_COOKIE['username'];
}
mightymouse3062
 
Posts: 9
Joined: 11. January 2008 02:49

Postby Scory » 13. January 2008 20:55

Maybe it's a problem of InternetExplorer (or other browser), are you sure that cookies are allowed for the specified domains?
Scory
 

Postby mightymouse3062 » 14. January 2008 00:21

It is something within XAMPP because this code works perfectly fine when it was on my web server (webhostingbuzz shared1 server). I use Firefox and I have tried IE and they both have the same problem that it wont work.
mightymouse3062
 
Posts: 9
Joined: 11. January 2008 02:49

Postby Scory » 14. January 2008 17:25

You should enable full error logging and see, if an error message occurs.

But there is no server specific reason for cookies not working - I never heard about any problems, as the server does not store cookies nor retrieve them. They are part of the HTTP Headers.
Scory
 

Postby RandomZero » 14. January 2008 18:26

I know nothing about this, but I thought I'd offer up some advice anyway.

Try using the web address maybe?
RandomZero
 
Posts: 5
Joined: 14. January 2008 18:17

Postby mightymouse3062 » 14. January 2008 19:09

I dont know what I did to fix it, but it works now. I set $cookie_site_name_path = "/"
$cookie_site_name = "127.0.0.1"

I tried it before and it didnt work and now it does...

Thanks for your help,
Mightymouse3062
mightymouse3062
 
Posts: 9
Joined: 11. January 2008 02:49


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 62 guests