id = $refSite; // $objSite->get(); // if ($HTTP_GET_VARS['id'] != '') { // $objTextad->get($HTTP_GET_VARS['id']); // writead($objTextad->title, $objTextad->body, "http://kalsey.com/textad/c/$objTextad->id", $mode); // exit(); // } // if ($objSite->status != "1") { showamazon($mode); // } else { // $objTextad->randomad($objSite->id); // // get amazon code if ad id is 66 or 67 // if ($objTextad->id == 66 || $objTextad->id == 67) { // showamazon($mode); // } else { // writead($objTextad->title, $objTextad->body, "http://kalsey.com/textad/c/$objTextad->id", $mode); // } // $objStats = new Adstats(); // $objStats->adid = $objTextad->id; // $objStats->adsite = $objTextad->site; // $objStats->viewsite = $objSite->id; // $ret = $objStats->loghit(); // if ($ret != 0) echo "Error code $ret"; // } function showamazon($mode) { $arrNodes = Array ( Array('node' => '17', 'type' => 'books', 'name' => 'Books'), Array('node' => '491286', 'type' => 'software', 'name' => 'Software'), Array('node' => '471280', 'type' => 'videogames', 'name' => 'Games'), Array('node' => '301668', 'type' => 'music', 'name' => 'Music'), Array('node' => '172282', 'type' => 'electronics', 'name' => 'Electronics'), Array('node' => '130', 'type' => 'dvd', 'name' => 'DVD') ); $arrRandNode = $arrNodes[array_rand($arrNodes)]; $resultscache = new SmartCache( 'amazonnode'.$arrRandNode['node'].$arrRandNode['type'] ); if (!$result = $resultscache->read( 3500 )) { $soapclient = new soapclient("http://soap.amazon.com/schemas3/AmazonWebServices.wsdl",true); // uncomment the next line to see debug messages // $soapclient->debug_flag = 1; // create a proxy so that WSDL methods can be accessed directly $proxy = $soapclient->getProxy(); $params = array( 'browse_node' => $arrRandNode['node'], 'page' => 1, 'mode' => $arrRandNode['type'], 'tag' => 'kalsey-20', 'type' => 'lite', 'devtag' => 'DMRKTBU9F2P28' ); $result = $proxy->BrowseNodeSearchRequest($params); $resultscache->write( $result ); // Store result } mt_srand((double)microtime()*1000000); $rand=intval((mt_rand(0,10000000)/10000000)*10); writead("{$result['Details'][$rand]['ProductName']} [{$arrRandNode['name']}]", "Buy {$result['Details'][$rand]['ProductName']} from Amazon.com for {$result['Details'][$rand]['OurPrice']}", $result['Details'][$rand]['Url'], $mode); } function writead($adTitle, $adBody, $adLink, $mode) { print adLine("
", $mode); print adLine("$adTitle
", $mode); print adLine("$adBody", $mode); print adLine("
Your ad here. Free.
", $mode); print adLine("
", $mode); } function adLine($line, $mode) { if ($mode == "include") { return $line . "\n"; } else { return "document.write(\"".addcslashes($line,'"')."\");\n"; } } ?>