javascript - Check if cookie exists then extract value -


i have looked around while , cannot find solution suits me.

i trying check if cookie exists, , if does, contents , take url contains.

i created cookie this:

<script> document.cookie = "pin=<?php echo $_get['pin']; ?>" </script> 

pretending $_get["pin"]=5060; should create cookie pin=5060

i need checks if exists (this on different page)

if cookie exists, should extract value of pin should take to: http://musicdemo.hol.es/users/(value of pin here)/host.php?pin=(value of pin here again)

this pin not password , not need secured.

thank in advance :)

i think don't understand js cookie*s*. there no cookies. document stack in 1 attribute named cookie string cookies. so, shall split string catch'em. see this more info.

about condition. every time check if document.cookie exists return true. because attribute built-it on document. so, try check if can split or if size greater 0.

and, bet development of cookies wrong. don't set document.cookie on html. and, if cookie dispatched php server still using there; security thank you.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -