- OpenX Community Forums

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Inherited Website That Uses Openads, And I'm At A Loss...
patracy
post Nov 24 2011, 04:23 PM
Post #1


Beginner
*

Group: Members
Posts: 1
Joined: 15-November 11
Member No.: 170,764



I have stepped up and started helping with a forum. Unfortunately I'm running without guidance from the past admin. The site is a forum that uses vBulletin. I've got the forum under hand, but I'm at a loss with the openads system. To give a little background, we're given an excel spreadsheet on a routine basis with a listing of items for sale. This spreadsheet contains a sale or campaign number, a lot or item number, a start date, close month, close day, close year, make, model, size, year, location, and a image link, and a link to the other parties website that has the item for sale.

I've found a file named xlimport.php. I'm able to kick this off from the web on the server. It appears that it runs though a file. And I can see it updating entries in the openads admin panel. However, it seems to be referencing an old file every time it's ran. I edited the php file to point to a different folder to see if that would correct it. But it appears it's not working. Here's a copy of the php file. (I've marked out some of the information for privacy sake)

CODE
<?
mysql_connect('www.******.com','******','******');

mysql_select_db('openads') or die( "Unable to select database");
//Include reader.php file
include('/home/******/*****.com/Excel/reader.php');

$floc = '/home/*****/******.com/openads/www/glupload.xls';


//Create Instance of Reader
$xl_reader = new Spreadsheet_Excel_Reader();    
    
//Read in File from variable $floc
$xl_reader->read($floc);
    
///Get Number of Rows from first sheet
$rows = $xl_reader->sheets[0]['numRows'];

//Get Cells from first sheet
$cells = $xl_reader->sheets[0]['cells'];

//Cell Example row 1, column 2    
//$cell-1-2 = $cells[1][2];

//Build Reporting Table Header

echo '<table border="1" width="100%" id="table1">';
echo '<tr>
        <th>Sale</th>
        <th>Lot</th>
        <th>Close Date</th>
        <th>Ad Image</th>
        <th>Campaign Write (Y,N,N/A)</th>
        <th>Banner Write (Y,N)</th>
        <th>Zone Write (Y,N)</th>
    </tr>';

//looop to get each row
for ($row = 2; $row <= $rows; $row++) {
  //Start Table Row
  echo '<tr>';

  //Get Row Data
  $sale = $cells[$row][1];
  $lot = $cells[$row][2];
  $opendate = $cells[$row][3];
  $closemonth = $cells[$row][4];
  $closeday = $cells[$row][5];
  $closeyear = $cells[$row][6];
  $make = $cells[$row][7];
  $model = $cells[$row][8];
  $size = $cells[$row][9];
  $year = $cells[$row][10];
  $location = $cells[$row][11];
  $loturl = $cells[$row][12];
  $imgurl = $cells[$row][13];
  
  $closedate = $closemonth . '/' . $closeday . '/' . $closeyear;
  
  //Provide Sale & Lot feedback
  echo '<td>' . $sale . '</td><td>' . $lot . '</td><td>' . $closedate . '</td>';
  
  //Build Image File
  $image_dir = "/home/*****/*****.com/openads/www/images";
  $image = "/home/*****/*****.com/openads/www/images/" . $sale . "-" . $lot . "image.jpg";
  $ad_image = "/home/*****/*****.com/openads/www/images/" . $sale . "-" . $lot . "-ad.jpg";
  copy($imgurl,$image);
  $resize_image = "/usr/bin/convert " . $image . " -resize 160x120 " . $image;
  $composite_images = "/usr/bin/composite -geometry +8+49 " . $image . " /home/*****/*****.com/openads/www/images/main2.jpg /home/*****/*****.com/openads/www/images/imagetemp.jpg";
  $add_text = "/usr/bin/convert /home/*****/*****.com/openads/www/images/imagetemp.jpg -font Helvetica-Bold -pointsize 10 -gravity North -draw \"fill '#003300' text 0,181 '" . $year . " " . $make . " " . $model . "' text 0,194 '" . $location . "' text 0,207 'Auction Ends " . $closedate . "'\" " . $ad_image;
  exec($resize_image);
  exec($composite_images);
  exec($add_text);
  unlink($image);
  
  
  //Provide Completed Banner for feedback
  echo '<td><img src="http://www.*****.com/openads/www/images/' . $sale . '-' . $lot . '-ad.jpg" width="175" height="221"></td>';
  
  //Check for existing Campaign
  $query = "SELECT * FROM `oa_campaigns` WHERE `campaignname` = 'GL" . $sale . "'";
    $result = mysql_query($query);
    $num_camp_rows = mysql_num_rows($result);
  if ($num_camp_rows < 1){
    //No Campaign, create one
    $today = time();
    $campaign_insert = "INSERT INTO `openads`.`oa_campaigns` (
                            `campaignid` ,
                            `campaignname` ,
                            `clientid` ,
                            `views` ,
                            `clicks` ,
                            `conversions` ,
                            `expire` ,
                            `activate` ,
                            `active` ,
                            `priority` ,
                            `weight` ,
                            `target_impression` ,
                            `target_click` ,
                            `target_conversion` ,
                            `anonymous` ,
                            `companion` ,
                            `comments` ,
                            `revenue` ,
                            `revenue_type` ,
                            `updated` ,
                            `block` ,
                            `capping` ,
                            `session_capping`
                        )
                        VALUES (
                            NULL ,
                            'GL" . $sale . "',
                            '4',
                            '-1',
                            '-1',
                            '-1',
                            '" . $closeyear . "-" . $closemonth . "-" . $closeday . "',
                            '0000-00-00',
                            't',
                            '0',
                            '1',
                            '0',
                            '0',
                            '0',
                            'f',
                            '0',
                            NULL ,
                            NULL ,
                            NULL ,
                            '" . date("Y-m-d h:i:s",$today) . "',
                            '0',
                            '0',
                            '0'
                      )";
    $campaign_insert_result = mysql_query($campaign_insert);
    $campaign_id = mysql_insert_id();
    //Log Campaign results to screen
    if (!$campaign_insert_result) {
      echo '<td>N</td>';
    } else {

      echo '<td>' . $campaign_id . '</td>';
    }
    
  } else {
  
    $campaign_id = mysql_result($result,0,'campaignid');
    echo '<td>' . $campaign_id . '</td>';
  }
  
  //Create Banner Entry
  $today = time();
  $banner_insert = "INSERT INTO `openads`.`oa_banners` (
                          `bannerid` ,
                          `campaignid` ,
                          `active` ,
                          `contenttype` ,
                          `pluginversion` ,
                          `storagetype` ,
                          `filename` ,
                          `imageurl` ,
                          `htmltemplate` ,
                          `htmlcache` ,
                          `width` ,
                          `height` ,
                          `weight` ,
                          `seq` ,
                          `target` ,
                          `url` ,
                          `alt` ,
                          `status` ,
                          `bannertext` ,
                          `description` ,
                          `autohtml` ,
                          `adserver` ,
                          `block` ,
                          `capping` ,
                          `session_capping` ,
                          `compiledlimitation` ,
                          `acl_plugins` ,
                          `append` ,
                          `appendtype` ,
                          `bannertype` ,
                          `alt_filename` ,
                          `alt_imageurl` ,
                          `alt_contenttype` ,
                          `comments` ,
                          `updated` ,
                          `acls_updated` ,
                          `keyword` ,
                          `transparent` ,
                          `parameters`
                  )
                  VALUES (
                          NULL ,
                          '" . $campaign_id . "',
                          't',
                          'jpeg',
                          '0',
                          'web',
                          '" . $sale . "-" . $lot . "-ad.jpg',
                          '',
                          '',
                          '',
                          '175',
                          '221',
                          '1',
                          '0',
                          '',
                          '" . $loturl . "',
                          'Bid Now!!',
                          '',
                          '',
                          '" . $lot . "',
                          'f',
                          '',
                          '0',
                          '0',
                          '0',
                          '',
                          NULL ,
                          '',
                          '0',
                          '0',
                          '',
                          '',
                          'gif',
                          NULL ,
                          '" . date("Y-m-d h:i:s",$today) . "',
                          '0000-00-00 00:00:00',
                          '',
                          '0',
                          'N;'
                  )";
  $banner_insert_result = mysql_query($banner_insert);
  $banner_id = mysql_insert_id();
  //Log Banner Insert results to screen
  if (!$banner_insert_result){
    echo '<td>N</td>';
  } else {
    echo '<td>' . $banner_id . '</td>';
  }

  //Insert Ad Zone Entry
  $zone_insert = "INSERT INTO `openads`.`oa_ad_zone_assoc` (
                          `ad_zone_assoc_id` ,
                          `zone_id` ,
                          `ad_id` ,
                          `priority` ,
                          `link_type` ,
                          `priority_factor` ,
                          `to_be_delivered`
                  )
                  VALUES (
                          NULL ,
                          '5',
                          '" . $banner_id . "',
                          '0',
                          '1',
                          '0',
                          '1'
                  )";
  $zone_insert_result = mysql_query($zone_insert);

  //Log Zone Insert results to screen
  if (!$zone_insert_result){
    echo '<td>N</td>';
  } else {
    echo '<td>Y</td>';
  }

}
?>


I realize this is an outdated application these days, but there's a lot of additional advertisements that work without issue. And I'd like to leave it alone until I get a better understanding of how this system works. (I'm not opposed to upgrading, just want to take it a step at a time.)

I'm just needing help to understand why this isn't working. Any advice would be greatly appreciated.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

 

Locations of visitors to this page