Guest User

Untitled

a guest
Jan 7th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <?php
  3. $cookie_n = "user";
  4. $cookie_value = "John Doe";
  5. setcookie($cookie_n, $cookie_value, , "/");
  6. ?>
  7. <html>
  8. <body>
  9.  
  10. <?php
  11. if(!isset($_COOKIE[$cookie_n])) {
  12. echo "Cookie named '" . $cookie_n . "' is not set!";
  13. } else {
  14. echo "Cookie '" . $cookie_n . "' is set!<br>";
  15. echo "Value is: " . $_COOKIE[$cookie_n];
  16. }
  17. ?>
  18.  
  19. <p><strong>Note:</strong> You might have to reload the page to see the value of the cookie.</p>
  20.  
  21. </body>
  22. </html>
  23.  
  24. setcookie($cookie_n, $cookie_value, '' , "/");
  25.  
  26. Warning: setcookie() expects parameter 3 to be integer, string given in ... on line 5
  27. Cookie named 'user' is not set!
  28.  
  29. Note: You might have to reload the page to see the value of the cookie.
Add Comment
Please, Sign In to add comment