Jump to content

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
https://forums.phpfreaks.com/topic/308578-help-with-creating-a-cookie/
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.

Edited by requinix

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.