Jump to content

Recommended Posts

you'll need some kind of cron process to run a script that checks and sends. Depending upon your host influences how your cron is setup, you could even do it manually once a week, or even setup a cron job at home which calls an appropriate script on your server.

The script could be something along the lines of...

 

$now=time();
$nextweek=$now+(60*60*24*7);
if ($expiry<=$nextweek && $expiry >=$today) {
 mail($to,$from,$subject, "From: you@yoursite.com");
}

 

Obviously you'd need to stick in your database connection bits around that script and make it a little more detailed than that, but I hope that gives you the idea.

 

After the email was sent you'd also need to make sure that the database was updated to show that, otherwise people would receive multiple emails.

field in date base:

field:banner_expire  type:datetime  Null: yes

for expire i used this code:

<?php $time = date("Y-m-d H:i:s");
		if ($data['banner_expire'] < $time) {
			$expires = dbquery("UPDATE ".$db_prefix."btr_banners SET banner_state='0' WHERE banner_id='".$data['banner_id']."'");
		}?>

 

now if i use your code maybe not working propertly ?

 

i can use this way ?

 

<?php $now = date("Y-m-d H:i:s");
$nextweek=$now+(60*60*24*7);
if ($data['banner_expire']<=$nextweek && $data['banner_expire'] >=$today) {
  mail($to,$from,$subject, "From: you@yoursite.com");
} ?>

 

i dont understand what doing variable $today ?

soryy for reply i just wanna to know for this code can work propertly,

<?php 
$now = time();
      $nextweek = $now+(60*60*24*7);
      if ($data['banner_expire'] <= $nextweek) {
      mail($to,$subject,$msg,"From: you@yoursite.com");
      } ?>

 

i ask this question because field banner_expire in datebase is:

`banner_expire` datetime default NULL,

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.