Guest User

Untitled

a guest
May 21st, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function get_cookie(cookiename) {
  2.     var results = document.cookie.match( '(^|;) ?' + cookiename + '=([^;]*)(;|$)' );
  3.     if (results) {
  4.         return(unescape(results[2]));
  5.     } else {
  6.         return null;
  7.     }
  8. }
  9.  
  10. function set_cookie(name, value, exp_y, exp_m, exp_d, path, domain, secure) {
  11.     var cookie_string = name + "=" + escape(value);
  12.     if (exp_y) {
  13.         var expires = new Date(exp_y, exp_m, exp_d);
  14.         cookie_string += "; expires=" + expires.toGMTString();
  15.     }
  16.     if (path) { cookie_string += "; path=" + escape(path); }
  17.     if (domain) { cookie_string += "; domain=" + escape(domain); }
  18.     if (secure) { cookie_string += "; secure"; }
  19.     document.cookie = cookie_string;
  20. }
Add Comment
Please, Sign In to add comment