• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Execute only one time and then wait set period of time before executing again

javascriptphpjquerycookies


PHP Snippet 1:

<?php

if(isset($_COOKIE['yourCookieName'])){
   //Do nothing
} else {
   $cookie_name = "yourCookieName";
   $cookie_value = "set";
   setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/"); // 86400 = 1 day
   ?>
    //Break out of php and run your javascript here
   <?php 
}
?>

Related Snippets

JSON Render Issue in Date Object Laravel and PHP 7.4

Currently Using CodeIgniter Framework i have an Error

Creating live search with AJAX and CodeIgniter

Get sql.h error on MacOS 12 (Monterey) sqsrv and pdo_sqsrv drive installation

How to get company posts from LinkedIn via API?

How can I make Laravel return a custom error for a JSON REST API

How to auto populate preferredCountries from intl-tel-input with db output

array_key_exists(): The first argument should be either a string or an integer

Google Gmail API - How to login programatically?

"cannot list resources" error from WooCommerce REST API

Losing session data after POST from third party website

Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, null given in

Split comma separated value from table column into rows using mysql?

PHP header location absolute URL

Confirm Leave on External Links in Wordpress

About Contact Privacy policy Terms and conditions