Viewing file: maintenance-activation.php (2.76 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php // $Revision: 1.9 $
/************************************************************************/
/* phpAdsNew 2 */
/* =========== */
/* */
/* Copyright (c) 2001 by Niels Leenheer <niels@creatype.nl> */
/* http://sourceforge.net/projects/phpadsnew */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
// Include required files
require (phpAds_path."/lib-warnings.inc.php");
/*********************************************************/
/* Mail clients and check for activation */
/* and expiration dates */
/*********************************************************/
$res_clients = phpAds_dbQuery("
SELECT
clientid,
clientname,
contact,
email,
language,
reportdeactivate
FROM
".$phpAds_config['tbl_clients']."
WHERE
parent = 0
") or die($strLogErrorClients);
while($client = phpAds_dbFetchArray($res_clients))
{
// Load client language strings
if (isset($client["language"]) && $client["language"] != "")
include ("../language/".$client["language"]."/default.lang.php");
else
include ("../language/".$phpAds_config['language']."/default.lang.php");
// Send Query
$res_campaigns = phpAds_dbQuery("
SELECT
clientid,
clientname,
views,
clicks,
expire,
UNIX_TIMESTAMP(expire) as expire_st,
activate,
UNIX_TIMESTAMP(activate) as activate_st,
active
FROM
".$phpAds_config['tbl_clients']."
WHERE
parent = ".$client['clientid']."
") or die($strLogErrorClients);
while($campaign = phpAds_dbFetchArray($res_campaigns))
{
$active = "t";
if ($campaign["clicks"] == 0 || $campaign["views"] == 0)
$active = "f";
if (time() < $campaign["activate_st"])
$active = "f";
if (time() > $campaign["expire_st"] && $campaign["expire_st"] != 0)
$active = "f";
if ($campaign["active"] != $active)
{
if ($active == "t")
phpAds_userlogAdd (phpAds_actionActiveCampaign, $campaign['clientid']);
else
{
phpAds_userlogAdd (phpAds_actionDeactiveCampaign, $campaign['clientid']);
phpAds_deactivateMail ($campaign);
}
phpAds_dbQuery("UPDATE ".$phpAds_config['tbl_clients']." SET active='$active' WHERE clientid=".$campaign['clientid']);
}
}
}
?>
|