Jump to content

Recommended Posts

i used this code for banner expire, send msg when expire, and send msg 1 week before expire, where i wrong...

 

kod:

<?php   // set banner inactive when expire and send msg whit statistic
    $result = dbquery("SELECT * FROM ".$db_prefix."btr_banners WHERE banner_state='1'");
     while ($data = dbarray($result)) {
     $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']."'");
		$result1 = dbquery("SELECT user_id, user_name, user_email FROM ".$db_prefix."users WHERE user_id='".$data['client_id']."'");
			while ($data1 = dbarray($result1)) {
				$user_name = $data1['user_name'];
				$user_email = $data1['user_email'];
				if ($user_email != "") {
					$result2 = dbquery("SELECT * FROM ".$db_prefix."btr_banners WHERE banner_id='".$data['banner_id']."'");
					while ($data2 = dbarray($result2)) {
			 $bannerXtra = explode(".", $data2['banner_clicks']);
		   $bannerClicks = number_format($bannerXtra[0]);
		   $bannerViews = number_format($bannerXtra[1]);
		   if($bannerViews == 0) {
    	    $percent = 0;
         } else {
    	    $percent = substr(100 * $data2['banner_clicks'] / $bannerViews, 0, 5);
         }
      $to = $user_email;
      $subject = $locale['M_10'];
    $message = $locale['M'].$user_name.$locale['M_2'].$data2['banner_date']."<br />".$locale['M_3']."<br />".$locale['M_4'] . $data2['banner_name']."<br />".$locale['M_5'] . $data2['banner_clicks']."<br />".$locale['M_6'] . $bannerViews."<br />".$locale['M_7'] . $data2['banner_date']."<br />".$locale['M_8'] . $data2['banner_expire']."<br /><br /><br /><br />".$locale['M_9'];
    $from = "labunista@gmail.com";
    mail($to,$subject,$msg, "From: labunista@gmail.com");
		}
     }
    }
   }
       // send msg 1 week before expire
       $now = time();
       $nextweek = $now+(60*60*24*7);
       
       if ($data['banner_expire'] <= $nextweek && $data['banner_expire'] >=$now) {
	   $to = $user_email;
		 $from = "From: labunista@gmail.com";
		 $msg = $locale['BB_1'];;
		 $subject = $locale['M'].$user_name.$locale['M_10'];
       mail($to,$subject,$msg, "From: labunista@gmail.com");
      }
    } ?>

 

plz help me.

Link to comment
https://forums.phpfreaks.com/topic/89096-solved-sending-empty-msg/
Share on other sites

wrong is when banner expire send to client email empty msg just show subject of msg nothing also, another did my code is corrected ? can someone test it find bug, worng code ....

 

i need this one:

1. check date for banner expire

2. when banner expire, send to mail statistic of that banner.

3. check date for send msg 1 week before expire.

 

soryy for bad english, maybe someone can undestand me and test my code....

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.