Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(is_page(161)){
- if(isset($_COOKIE['limitedProduct'])){
- $old = $_COOKIE['limitedProduct'];
- $value = $_COOKIE["limitedProduct"] - rand(5,8);
- setcookie('limitedProduct', $value, (time()+31536000));
- echo 'I got set! -> Old: ' . var_export($old) . " - New: " . var_export($value);
- }else{
- setcookie('limitedProduct', '24', (time()+31536000));
- echo 'I got init! -> 24';
- }
- }
- ?>
- <?php
- //Asking for NULL because at the very first time there is no cookie!
- if($_COOKIE['limitedProduct'] == NULL) {
- 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']);
- }else if ($_COOKIE['limitedProduct'] > 2) {
- echo "<p style='text-align: center; color: red;'><strong>Der Kurs ist stark limitiert - Nur noch " . $_COOKIE['limitedProduct'] . " verfügbar!</strong></p>";
- }else if($_COOKIE['limitedProduct'] < 2){
- echo "<p style='text-align: center; color: red;'><strong>Der Kurs ist stark limitiert - Nur noch 2 verfügbar!</strong></p>";
- }
- ?>
Add Comment
Please, Sign In to add comment