Example #1
0
        display_ad_form(1, $mode, '');
    } else {
        $ad_id = insert_ad_data();
        // save ad_id with the temp order...
        $sql = "UPDATE temp_orders SET ad_id='{$ad_id}' where session_id='" . addslashes(session_id()) . "' ";
        //echo $sql;
        $result = mysql_query($sql) or die(mysql_error());
        $prams = load_ad_values($ad_id);
        //print_r($prams);
        ?>
		<center><div class='ok_msg_label'><input type="button"  class='big_button' value="<?php 
        echo $label['write_ad_saved'] . " " . $label['write_ad_continue_button'];
        ?>
" onclick="window.location='confirm_order.php'"></div></center>
		<p>&nbsp;</p>
		<?php 
        display_ad_form(1, "edit", $prams);
    }
} else {
    // get the ad_id form the temp_orders table..
    $sql = "SELECT ad_id FROM temp_orders WHERE session_id='" . addslashes(session_id()) . "' ";
    $result = mysql_query($sql) or die(mysql_error());
    $row = mysql_fetch_array($result);
    $ad_id = $row['ad_id'];
    //echo "adid is: ".$ad_id;
    $prams = load_ad_values($ad_id);
    // user is not logged in
    //print_r($prams);
    display_ad_form(1, 'edit', $prams);
}
require "footer.php";
Example #2
0
                disapprove_modified_order($prams['order_id'], $BID);
            }
            if (AUTO_PUBLISH == 'Y') {
                process_image($BID);
                publish_image($BID);
                process_map($BID);
                //echo 'published.';
            }
            echo 'Ad Saved. <A href="ads.php?BID=' . $prams['banner_id'] . '">&lt;&lt; Go to the Ad List</a>';
            echo "<hr>";
        }
    } else {
        $prams = load_ad_values($_REQUEST['ad_id']);
        display_ad_form(1, 'edit', $prams);
    }
    $prams = load_ad_values($_REQUEST['ad_id']);
    $sql = "select * FROM users where ID='" . $prams['user_id'] . "' ";
    $result = mysql_query($sql);
    $u_row = mysql_fetch_array($result);
    $b_row = load_banner_row($prams['banner_id']);
    ?>

	<h3>Additional Info</h3>
	<b>Customer:</b><?php 
    echo $u_row['LastName'] . ', ' . $u_row['FirstName'];
    ?>
<BR>
	<b>Order #:</b><?php 
    echo $prams['order_id'];
    ?>
<br>
Example #3
0
function update_blocks_with_ad($ad_id, $user_id)
{
    global $prams;
    $prams = load_ad_values($ad_id);
    if ($prams['order_id'] > 0) {
        $sql = "UPDATE blocks SET alt_text='" . addslashes(get_template_value('ALT_TEXT', 1)) . "', url='" . addslashes(get_template_value('URL', 1)) . "'  WHERE order_id='" . $prams['order_id'] . "' AND user_id='" . $user_id . "' ";
        mysql_query($sql) or die(mysql_error());
        mds_log("Updated blocks with ad URL, ALT_TEXT", $sql);
    }
}
Example #4
0
session_start();
/*
COPYRIGHT 2008 - see www.milliondollarscript.com for a list of authors
This file is part of the Million Dollar Script.
Million Dollar Script 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 3 of the License, or
(at your option) any later version.
Million Dollar Script is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the Million Dollar Script.  If not, see <http://www.gnu.org/licenses/>.
*/
/*

ga.php
get ad
*/
define('NO_HOUSE_KEEP', 'YES');
require 'config.php';
require_once 'include/ads.inc.php';
$AID = $_REQUEST['AID'];
//$BID = $_REQUEST['BID'];
$prams = load_ad_values($AID);
if ($prams !== false) {
    //display_ad_form (1, "view", $prams);
    echo assign_ad_template($prams);
}
Example #5
0
function reserve_pixels_for_temp_order($temp_order_row)
{
    // check if the user can get the order
    if (!can_user_order(load_banner_row($temp_order_row['banner_id']), $_SESSION['MDS_ID'], $temp_order_row['package_id'])) {
        echo 'can\'t touch this<br>';
        return false;
    }
    require_once '../include/ads.inc.php';
    ###################################################
    if (USE_LOCK_TABLES == 'Y') {
        $sql = "LOCK TABLES blocks WRITE, orders WRITE, ads WRITE, temp_orders WRITE,  currencies READ, prices READ, banners READ, form_fields READ, form_field_translations READ";
        $result = mysql_query($sql) or die(" <b>Dear Webmaster: The current MySQL user does not have permission to lock tables. Please give this user permission to lock tables, or turn off locking in the Admin. To turn off locking in the Admin, please go to Main Config and look under the MySQL Settings.<b>");
    } else {
        // poor man's lock
        $sql = "UPDATE `config` SET `val`='YES' WHERE `key`='SELECT_RUNNING' AND `val`='NO' ";
        $result = mysql_query($sql) or die(mysql_error());
        if (mysql_affected_rows() == 0) {
            // make sure it cannot be locked for more than 30 secs
            // This is in case the proccess fails inside the lock
            // and does not release it.
            $unix_time = time();
            // get the time of last run
            $sql = "SELECT * FROM `config` where `key` = 'LAST_SELECT_RUN' ";
            $result = @mysql_query($sql);
            $t_row = @mysql_fetch_array($result);
            if ($unix_time > $t_row['val'] + 30) {
                // release the lock
                $sql = "UPDATE `config` SET `val`='NO' WHERE `key`='SELECT_RUNNING' ";
                $result = @mysql_query($sql) or die(mysql_error());
                // update timestamp
                $sql = "REPLACE INTO config (`key`, `val`) VALUES ('LAST_SELECT_RUN', '{$unix_time}')  ";
                $result = @mysql_query($sql) or die(mysql_error());
            }
            usleep(5000000);
            // this function is executing in another process. sleep for half a second
            reserve_pixels_for_temp_order($temp_order_row);
            return;
        }
    }
    ####################################################
    $filename = SERVER_PATH_TO_ADMIN . 'temp/' . "info_" . md5(session_id()) . ".txt";
    $fh = fopen($filename, 'rb');
    $block_info = fread($fh, filesize($filename));
    fclose($fh);
    //$block_info = unserialize($temp_order_row['block_info']);
    $block_info = unserialize($block_info);
    //echo "block info:";
    //print_r($block_info);
    $in_str = $temp_order_row['blocks'];
    $sql = "select block_id from blocks where banner_id='" . $temp_order_row['banner_id'] . "' and block_id IN(" . $in_str . ") ";
    //echo $sql."<br>";
    $result = mysql_query($sql) or die($sql . mysql_error());
    if (mysql_num_rows($result) > 0) {
        return false;
        // the pixels are not available!
    }
    // approval status, default is N
    $banner_row = load_banner_row($temp_order_row['banner_id']);
    $approved = $banner_row['auto_approve'];
    $now = gmdate("Y-m-d H:i:s");
    $sql = "REPLACE INTO orders (user_id, order_id, blocks, status, order_date, price, quantity, banner_id, currency, days_expire, date_stamp, package_id, ad_id, approved) VALUES ('" . $_SESSION['MDS_ID'] . "', '', '" . $in_str . "', 'new', '" . $now . "', '" . $temp_order_row['price'] . "', '" . $temp_order_row['quantity'] . "', '" . $temp_order_row['banner_id'] . "', '" . get_default_currency() . "', " . $temp_order_row['days_expire'] . ", '" . $now . "', " . $temp_order_row['package_id'] . ", " . $temp_order_row['ad_id'] . ", '" . $approved . "') ";
    $result = mysql_query($sql) or die(mysql_error() . $sql);
    $order_id = mysql_insert_id();
    mds_log("Changed temp order to a real order - " . $sql);
    //echo "<hr>";echo $sql; echo "<hr>";
    $sql = "UPDATE ads SET user_id='" . $_SESSION['MDS_ID'] . "', order_id='" . $order_id . "' where ad_id='" . $temp_order_row['ad_id'] . "' ";
    //echo $sql;
    mysql_query($sql) or die(mysql_error() . $sql);
    $sql = "UPDATE orders SET original_order_id='" . $order_id . "' where order_id='" . $order_id . "' ";
    //echo $sql;
    mysql_query($sql) or die(mysql_error() . $sql);
    global $prams;
    $prams = load_ad_values($temp_order_row['ad_id']);
    $url = get_template_value('URL', 1);
    $alt_text = get_template_value('ALT_TEXT', 1);
    //print_R($block_info);
    //echo "<P>url: $url, alt_text: $alt_text </p>";
    foreach ($block_info as $key => $block) {
        $sql = "REPLACE INTO `blocks` ( `block_id` , `user_id` , `status` , `x` , `y` , `image_data` , `url` , `alt_text`, `approved`, `banner_id`, `currency`, `price`, `order_id`, `ad_id`) VALUES ('" . $key . "',  '" . $_SESSION['MDS_ID'] . "' , 'reserved' , '" . $block['map_x'] . "' , '" . $block['map_y'] . "' , '" . $block['image_data'] . "' , '" . addslashes($url) . "' , '" . addslashes($alt_text) . "', '" . $approved . "', '" . $temp_order_row['banner_id'] . "', '" . get_default_currency() . "', '" . $block['price'] . "', '" . $order_id . "', '" . $temp_order_row['ad_id'] . "')";
        //echo $sql."<br>";
        mds_log("Updated block - " . $sql);
        mysql_query($sql) or die(mysql_error() . $sql);
    }
    delete_temp_order(session_id(), false);
    // false = do not delete the ad...
    ###################################################
    if (USE_LOCK_TABLES == 'Y') {
        $sql = "UNLOCK TABLES";
        $result = mysql_query($sql) or die(mysql_error() . " <b>Dear Webmaster: The current MySQL user set in config.php does not have permission to lock tables. Please give this user permission to lock tables, or set USE_LOCK_TABLES to 'No' in the Main Config section in the Admin.<b>");
    } else {
        // release the poor man's lock
        $sql = "UPDATE `config` SET `val`='NO' WHERE `key`='SELECT_RUNNING' ";
        mysql_query($sql);
        $unix_time = time();
        // update timestamp
        $sql = "REPLACE INTO config (`key`, `val`) VALUES ('LAST_SELECT_RUN', '{$unix_time}')  ";
        $result = @mysql_query($sql) or die(mysql_error());
    }
    ####################################################
    return $order_id;
}