nezbo Posted April 15, 2008 Share Posted April 15, 2008 Hi all I have setcookies working fine, or so i thought. What is hapening is the system is picking up the cookie from another computer, i thought the info was stored on the local computer. Please help... I done know how to fix this problem... Please Help. Link to comment https://forums.phpfreaks.com/topic/101190-cookie-help-needed-fast/ Share on other sites More sharing options...
kenrbnsn Posted April 15, 2008 Share Posted April 15, 2008 Code? Ken Link to comment https://forums.phpfreaks.com/topic/101190-cookie-help-needed-fast/#findComment-517608 Share on other sites More sharing options...
nezbo Posted April 15, 2008 Author Share Posted April 15, 2008 sorry this code sets the cookies... setcookie("user", $usernames, false, "/", false); setcookie("pass", $passwordCript, false, "/", false); Code? Ken Link to comment https://forums.phpfreaks.com/topic/101190-cookie-help-needed-fast/#findComment-517612 Share on other sites More sharing options...
nezbo Posted April 15, 2008 Author Share Posted April 15, 2008 I think i might have a problem with our server only having 1 wan IP address. Is there an easy way to store the cookies stored in the local computers. i.e. setcookie("user", $name, false, "c:\windows\temp", false); is so how do i reacal it? Cheers Link to comment https://forums.phpfreaks.com/topic/101190-cookie-help-needed-fast/#findComment-517681 Share on other sites More sharing options...
nezbo Posted April 15, 2008 Author Share Posted April 15, 2008 I am really confused with cookies now!!!!! ??? there are a number of computers the company on diffrent sites, all connecting through on servers to the Web. I am getting a problem the if one member of staff logs on one computer and another on a computer they could be using the other users details. It is not doing it on my PC but only on others. if i press F5 to refresh page it picks up the correct cookie. untill the next page is clicked on. Hope this makes sense, cos it is really starting to anoy me grrrrrrr :'( Link to comment https://forums.phpfreaks.com/topic/101190-cookie-help-needed-fast/#findComment-517707 Share on other sites More sharing options...
atl_andy Posted April 15, 2008 Share Posted April 15, 2008 Are you calling $_COOKIE['user'] or $_COOKIE['pass'] on the next page? Link to comment https://forums.phpfreaks.com/topic/101190-cookie-help-needed-fast/#findComment-517799 Share on other sites More sharing options...
nezbo Posted April 15, 2008 Author Share Posted April 15, 2008 i am calling both to compare the database. the system is working fine untill more than one person is trying to use it at work. I think there is something fundamentaly wrong with what i am doing here is my full setcookie code if ($num_rows == 1) { while ($theUser = @mysql_fetch_array($okLogin)) { $usernames = $theUser['CallID']; setcookie("user", $usernames, false, "/", false); setcookie("pass", $passwordCript, false, "/", false); echo "<meta HTTP-EQUIV='refresh' CONTENT='0'; URL='" . $_SERVER['PHP_SELF'] . "'>"; } } else { ?> <script type="text/javascript"> alert ("Please enter a valid username and password"); window.onload = history.back(1) </script> <?php } Cheers, Nezbo Are you calling $_COOKIE['user'] or $_COOKIE['pass'] on the next page? Link to comment https://forums.phpfreaks.com/topic/101190-cookie-help-needed-fast/#findComment-517914 Share on other sites More sharing options...
nezbo Posted April 16, 2008 Author Share Posted April 16, 2008 any ideas... could it be something on the server that is a problem, i.e. where it is storing the cookies. or could any one advise me how to change it to use sessions insted of cookies. And if so there may be a problem with computers being on the same network, and a problem when i move to another page on the site it dose not stay logged in? Link to comment https://forums.phpfreaks.com/topic/101190-cookie-help-needed-fast/#findComment-518279 Share on other sites More sharing options...
haku Posted April 16, 2008 Share Posted April 16, 2008 Show all your code. It looks like you may be trying to set the cookie after you have already sent headers to the browser, which means the cookie wont be set. Link to comment https://forums.phpfreaks.com/topic/101190-cookie-help-needed-fast/#findComment-518455 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.