Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(cookie && firstUsers[1]==='Pass') {
- alert("firstUsers is Pass");
- } else {
- alert("expired / not set");
- }
- <script>
- function firstUsers(){
- days=1;
- myDate = new Date();
- myDate.setTime(myDate.getTime()+(days*24*60*60*1000));
- document.cookie = 'firstUsers=Pass; expires=' + myDate.toGMTString();
- document.cookie = 'secondUsers=Pass; expires=' + myDate.toGMTString();
- }
- var cookie = document.cookie.split(';')
- .map(function(x){ return x.trim().split('='); })
- .filter(function(x){ return x[0]==='firstUsers'; })
- .pop();
- if(cookie && firstUsers[1]==='Pass') {
- alert("firstUsers is Pass");
- } else {
- alert("expired / not set");
- }
- $('#set-btn').on('click', function(){
- // run code below
- firstUsers();
- return false;
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement