PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 7th, 2000, 12:19 AM
jdma79 jdma79 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 20 jdma79 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to jdma79
Sir im using the following code to store cookies into the client computer but it works on some machine . i don;t know why it;s not working on the same machin which is accepting java cookeis but not accepting php cookeis

here is the code

setcookie("computerid",$computerid,time()+94608000,"/","www.mycompany.com","");


Plzx help me

Reply With Quote
  #2  
Old May 7th, 2000, 03:04 AM
derbot derbot is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 2 derbot User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0

I had the same problem recently. Lynx recognized my cookies but netscape or exploder not.
There is something special with cookies format?


------------------

Belu Bogdan - cobra@ines.ro
webmaster
INES Internet

Reply With Quote
  #3  
Old May 7th, 2000, 03:58 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 14
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan
jdma79,

see,first whether your cookie is set or not.
Another reason,
Probably your clients computer must have switched off the cookie option.

for checking whether cookie is successfully you can use:
if(isset($computerid)){
print "Cookie is setn";
}


Visit the following link for solving your problem...
http://www.phpbuilder.com/manual/fu....setcookie.php3


GOOD LUCK!!!

------------------
SR -
shiju.dreamcenter.net

Reply With Quote
  #4  
Old May 7th, 2000, 11:26 PM
bbaez bbaez is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 1 bbaez User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Here is code to test the ability to save a cookie on a browser. Also note some useful methods of storing cookies. This is a compilation of tips and tricks found on php.net. Works on Linux, 95, 98 ,NT IE 4 and Netscape 4.5-

<?
function store_array_in_cookie($cookiename, $array2store) {
$tmpstring = serialize($array2store);
setcookie($cookiename, $tmpstring, time()+3600*5, "/");
unset($tmpstring);
}

function erase_array_in_cookie($cookiename, $array2store) {
$tmpstring = serialize($array2store);
setcookie($cookiename, $tmpstring, time()-3600*5, "/");
unset($tmpstring);
}
function erase_set_array_cookie($cookiename, $array2store) {
$tmpstring = serialize($array2store);
setcookie($cookiename, $tmpstring, time()-604800, "/");
setcookie($cookiename, $tmpstring, time()+604800, "/");

unset($tmpstring);
}
function erase_set_array_cookie_header($cookiename, $array2store) {
$time = mktime()+36000;
$backtime = mktime()-36000;
$date = date("l, d-M-y H:i:s", ($time));
$backdate = date("l, d-M-y H:i:s", ($backtime));
$tmpstring = serialize($array2store);
$tmpstring = urlencode($tmpstring);
// header("Set-Cookie: $cookiename=$tmpstring; expires=$backdate GMT; path=/; domain=.biospectra.netn");
// header("Set-Cookie: $cookiename=$tmpstring; expires=$date GMT; path=/; domain=.biospectra.netn");
// header("Location: <A HREF="http://www.biospectra.net/index.php3n");" TARGET=_blank>http://www.biospectra.net/index.php3n");</A>
// exit;

header("Set-Cookie:$cookiename=$tmpstring;expires=$backdate GMT;path=/nSet-Cookie:$cookiename=$tmpstring;expires=$date GMT;path=/");
unset($tmpstring);
}
function erase_cookie_header($cookiename, $array2store) {
$backtime = mktime()-36000;
$backdate = date("l, d-M-y H:i:s", ($backtime));
$tmpstring = serialize($array2store);
$tmpstring = urlencode($tmpstring);
header("Set-Cookie: $cookiename=$tmpstring; expires=$backdate GMT; path=/");
unset($tmpstring);
}
function store_cookie_header($cookiename, $array2store) {
$time = mktime()+36000;
$date = date("l, d-M-y H:i:s", ($time));
$tmpstring = serialize($array2store);
$tmpstring = urlencode($tmpstring);
header("Set-Cookie: $cookiename=$tmpstring; expires=$date GMT; path=/");
unset($tmpstring);
}
function get_array_from_cookie($cookiename) {
$tmpstring = "global $$cookiename";
eval($tmpstring);
unset($tmpstring);

if (isset(${$cookiename})) {
$tmparray=unserialize(stripslashes(${$cookiename}));
} else {
$tmparray = array();
}
while (list($name, $value) = each($tmparray))
printf("type="hidden" name="%s" value="%s"<BR>n", $name, $value);
return $tmparray;
}
$cookiename="cookiearray";
if (!($submit_store == "")) {
$array2store=array(bbaez,nim101,15,0,0);
store_array_in_cookie($cookiename, $array2store);
};
if (!($submit_erase == "")) {
$array2store=array(bbaez,nim101,15,1,1);
erase_array_in_cookie($cookiename, $array2store);
};
if (!($submit_erase_store_set == "")) {
$array2store=array(bbaez,nim101,15,1,1);
erase_set_array_cookie($cookiename, $array2store);
};
/**********************************************************************************/
if (!($submit_store_header == "")) {
$array2store=array(bbaez,nim101,15,0,0);
store_cookie_header($cookiename, $array2store);
};
if (!($submit_erase_store_header == "")) {
$array2store=array(bbaez,nim101,15,1,1);
erase_set_array_cookie_header($cookiename, $array2store);
};
if (!($submit_erase_header == "")) {
$array2store=array(bbaez,nim101,15,1,1);
erase_cookie_header($cookiename, $array2store);
};
/**********************************************************************************/
if (!($submit_retrieve == "")) {
get_array_from_cookie($cookiename);
};
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>

<BODY BGCOLOR="#FFFFFF">
<form action="<? echo $PHP_SELF ?>" method="POST">

<input type="submit" name="submit_store" value="Click To Store">
<input type="submit" name="submit_erase_store_set" value="Click To Erase and Store Using setcookie()">
<input type="submit" name="submit_erase" value="Click To Erase">
<P>
<P>
<input type="submit" name="submit_store_header" value="Click To Store Using the Header">
<input type="submit" name="submit_erase_store_header" value="Click To Erase and Store Using Header">
<input type="submit" name="submit_erase_header" value="Click To Erase Using the Header">
<P>
<P>
<input type="submit" name="submit_retrieve" value="Click To Retrieve">
</form>
</BODY>
</HTML>

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Problem with coookies plz help

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap