Jump to content

Check for cookie value constantly


LLeoun

Recommended Posts

Dear phpfreaks,

 

Can anyone please help me to create a program that checks for a cookie's value, let's say every second or two seconds??

 

Right now I have:

$c= $_COOKIE["myidco"]; 

 

But it only stores the value that the cookie had when the page was loaded.

 

Thanks a ton in advance!

Link to comment
https://forums.phpfreaks.com/topic/151374-check-for-cookie-value-constantly/
Share on other sites

The php page has an iframe, the page inside the iframe displays videos and changes the cookie's value every time a new video is displayed.

I need this value (the displayed video id) in the parent page (the php page) and in a php variable.

 

So far I've done it with javascript but not the part of turning the javascript variable into a php variable, that's what I thought about cookies.

 

Setting the cookie's value depending on the video displayed is done, and working good, but now I need the parent page (the php page that contains the iframe) to get this value, so I have to check for it constantly...

 

Any ideas??

 

If you've got one iframe you can make another and have the HTTP_REFRESH set to 2 seconds.

 

It'll rload the page constantly until you navigate away from the main page constantly checking the cookie. The frame doesn't have to be visible - set it to 0x0 or if that fails, 1x1.

Thanks Yesideez, is a nice trick, very witty but I need the value in the parent page .. imagine I want to change the background of the parent page depending on the cookie's value, how could I do that if the value is inside an iframe.

A smaller detail is the annoying loading symbol every 2 seconds at the top of the browser's tab ..

Thanks Yesideez, is a nice trick, very witty but I need the value in the parent page .. imagine I want to change the background of the parent page depending on the cookie's value, how could I do that if the value is inside an iframe.

A javascript inside the second iframe could write to the parent

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.