Guest User

Untitled

a guest
Oct 16th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. <?php
  2.  
  3. if(is_page(161)){
  4. if(isset($_COOKIE['limitedProduct'])){
  5. $old = $_COOKIE['limitedProduct'];
  6. $value = $_COOKIE["limitedProduct"] - rand(5,8);
  7. setcookie('limitedProduct', $value, (time()+31536000));
  8. echo 'I got set! -> Old: ' . var_export($old) . " - New: " . var_export($value);
  9. }else{
  10. setcookie('limitedProduct', '24', (time()+31536000));
  11. echo 'I got init! -> 24';
  12. }
  13. }
  14. ?>
  15.  
  16. <?php
  17.  
  18. //Asking for NULL because at the very first time there is no cookie!
  19.  
  20. if($_COOKIE['limitedProduct'] == NULL) {
  21. echo "<p style='text-align: center; color: red;'><strong>Der Kurs ist stark limitiert - Nur noch 31 verfügbar!</strong></p><br> " . var_export($_COOKIE['limitedProduct']);
  22. }else if ($_COOKIE['limitedProduct'] > 2) {
  23. echo "<p style='text-align: center; color: red;'><strong>Der Kurs ist stark limitiert - Nur noch " . $_COOKIE['limitedProduct'] . " verfügbar!</strong></p>";
  24. }else if($_COOKIE['limitedProduct'] < 2){
  25. echo "<p style='text-align: center; color: red;'><strong>Der Kurs ist stark limitiert - Nur noch 2 verfügbar!</strong></p>";
  26. }
  27.  
  28. ?>
Add Comment
Please, Sign In to add comment