Jump to content

Help with creating a cookie


Chrisj

Recommended Posts

I'm trying to create a cookie where the visitor who uploads a webcam recording, from the webcam recording web page, can't record and upload until X amount of time has passed.

I've searched around and have gotten this far:

						document.cookie = "name=Recording_Time_Delay; expires=5 minutes; path=/";

						 function create_cookie(Recording_Time_Delay, Start Disabled) {
						 var date = new Date();
						 date.setTime(date.getTime() + (minutes * 60 * 1000));
						 var expires = date.toUTCString();
						 document.cookie = name + '=' + value + ';' +
						  'expires=' + expires + ';' ;
						 }

It will be added to the script shown here:

Ultimately, I'd like someone not to be able to record/upload until 5 minutes has elapsed from the last upload.
Currently, when a recording is uploaded the User is redirected to another page. 
If they come right back from that redirect and record/upload again, I'd like that ability to be unavailable/delayed. 

I would image the time out should start upon the initial recording being uploaded, where a 5 minute delay starts, and disables the Start Recording function (or button)?

Does that sound right?

And what am I missing in my cookie code attempt?

Also, how do I tie in the disable Start Recording function/Button?

Any guidance will be appreciated.

 

 

 

 

Link to comment
Share on other sites

1 hour ago, Chrisj said:

I would image the time out should start upon the initial recording being uploaded, where a 5 minute delay starts, and disables the Start Recording function (or button)?

Does that sound right?

Is that what you want it to do, or not?

Quote

And what am I missing in my cookie code attempt?

The first lien line that sets the cookie is probably wrong, and the function isn't being called.

Quote

Also, how do I tie in the disable Start Recording function/Button?

You'd check for the cookie before letting the user click, and then also check the cookie in your PHP in case the user got around the Javascript block and recorded and uploaded anyways.

Link to comment
Share on other sites

Thanks for your reply.

Yes, it should disable the Start Recording button (for 5 minutes) upon the upload completing.

Any additional guidance with 'setting the cookie' and 'calling the function' and 'checking the cookie before letting the user click' would be appreciated.

Link to comment
Share on other sites

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.