Advanced cookie function with php


/ Published in: PHP
Save to your folder(s)

To set cookie use "cookie('name of your cookie','cookie data','expire date ')" it will set your cookie in the user browser .
To get the saved cookie use "cookie('name of your cookie')" it will give you the value of the cookie which you saved in the user's browser .


Copy this code and paste it in your HTML
  1. <?php
  2. /*
  3. If you have doubt please ontact me : [email protected]
  4. */
  5. function cookie($name , $val = null , $exp = 0){
  6. if($val == null) return $_COOKIE[$name];
  7. else{
  8. return setcookie($name, $val , $exp);
  9. }
  10. }
  11. ?>

URL: http://ksoft.is-great.org

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.