예제 #1
0
파일: cron.php 프로젝트: ronando/WeBid
    }
}
// "remove" old auctions (archive them)
printLog("\n");
printLog("++++++ Archiving old auctions");
$expireAuction = 60 * 60 * 24 * $system->SETTINGS['archiveafter'];
// time of auction expiration (in seconds)
$expiredTime = time() - $expireAuction;
$query = "SELECT id FROM " . $DBPrefix . "auctions WHERE ends <= '" . $expiredTime . "'";
$result = mysql_query($query);
$system->check_mysql($result, $query, __LINE__, __FILE__);
$num = mysql_num_rows($result);
printLog($num . " auctions to archive");
if ($num > 0) {
    while ($AuctionInfo = mysql_fetch_assoc($result)) {
        printLogL("Processing auction: " . $AuctionInfo['id'], 0);
        // delete auction
        $query = "DELETE FROM " . $DBPrefix . "auctions WHERE id = '" . $AuctionInfo['id'] . "'";
        $system->check_mysql(mysql_query($query), $query, __LINE__, __FILE__);
        // delete bids for this auction
        $query = "DELETE FROM " . $DBPrefix . "bids WHERE auction='" . $AuctionInfo['id'] . "'";
        $system->check_mysql(mysql_query($query), $query, __LINE__, __FILE__);
        // Delete proxybid entries
        $query = "DELETE FROM " . $DBPrefix . "proxybid WHERE itemid = " . $AuctionInfo['id'];
        $system->check_mysql(mysql_query($query), $query, __LINE__, __FILE__);
        // Delete counter entries
        $query = "DELETE FROM " . $DBPrefix . "auccounter WHERE auction_id = " . $AuctionInfo['id'];
        $system->check_mysql(mysql_query($query), $query, __LINE__, __FILE__);
        // Delete all images
        if (file_exists($upload_path . $AuctionInfo['id'])) {
            if ($dir = @opendir($upload_path . $AuctionInfo['id'])) {
예제 #2
0
파일: cron.php 프로젝트: lavsurgut/autoauc2
 if ($num > 0) {
     $resultCLOSEDAUCTIONS = $result;
     while ($row = mysql_fetch_array($resultCLOSEDAUCTIONS, MYSQL_ASSOC)) {
         $AuctionInfo = $row;
         printLogL("Processing auction: " . $AuctionInfo['id'], 0);
         $query = "DELETE FROM " . $DBPrefix . "auctions WHERE id='" . $AuctionInfo['id'] . "'";
         if (!mysql_query($query)) {
             errorLogSQL();
         }
         // delete bids for this auction
         $query = "SELECT * FROM " . $DBPrefix . "bids WHERE auction='" . $AuctionInfo['id'] . "'";
         $result = mysql_query($query);
         if ($result) {
             $num = mysql_num_rows($result);
             if ($num > 0) {
                 printLogL($num . " bids for this auction to delete", 1);
                 $resultBIDS = $result;
                 while ($row = mysql_fetch_array($resultBIDS, MYSQL_ASSOC)) {
                     // archive this bid
                     $query = "delete from " . $DBPrefix . "bids WHERE auction='" . $row['auction'] . "'";
                     $res = mysql_query($query);
                     if (!$res) {
                         errorLogSQL();
                     }
                 }
             }
         } else {
             errorLogSQL();
         }
         // // #################################################################################################
         // // Delete proxybid entries