Jump to content

[SOLVED] Send msg Before 1 week Expire


balkan7

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: [email protected]");
}

 

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: [email protected]");
} ?>

 

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: [email protected]");
      } ?>

 

i ask this question because field banner_expire in datebase is:

`banner_expire` datetime default NULL,

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.