Advertisement
Guest User

Untitled

a guest
Mar 4th, 2010
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. <?php
  2.  
  3. $hasCookie = isset($_COOKIE['TestCookie']);
  4.  
  5. echo '<pre>';
  6.  
  7. if (!$hasCookie) {
  8.         setcookie('TestCookie', 'test', time() + 86400 * 365);
  9.         echo "Test cookie set; <a href='?a=b'>click here to reload this page to see the result</a>.\n";
  10.         die;
  11. }
  12.  
  13. if ($hasCookie && isset($_REQUEST['TestCookie']))
  14.         echo '$_REQUEST has the cookie, no bug present.';
  15. else
  16.         echo '$_REQUEST is missing TestCookie, there is a bug.';
  17.  
  18. echo "\n\n";
  19.  
  20. echo '$_REQUEST:';
  21. print_r($_REQUEST);
  22.  
  23. echo "\n\n";
  24.  
  25. echo '$_COOKIE:';
  26. print_r($_COOKIE);
  27.  
  28. echo '</pre>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement