','>',$str); $str = str_replace('"','"',$str); $str = str_replace("'",''',$str); return $str; } #print responce to AS in XML function printXMLResponce($resHash) { echo {$resHash['duration']} {$resHash['link']} {$resHash['comment']} HTMLTEXT; } #receive advert image if any exist function receiveAdsImage($id) { $storeDir = '/some/directory/for/images'; global $HTTP_POST_FILES; $lastError = NULL; $fileext = ''; if (!$HTTP_POST_FILES['asimage']['size']) { #echo "No advert image.\n"; return 1; } else { #echo $HTTP_POST_FILES['asimage']['name']; if (preg_match("/\.(jpg|jpeg|gif|png)$/i",$HTTP_POST_FILES['asimage']['name'],$ok)) { $fileext = strtolower($ok[1]); } else { $lastError = "Falscher Typ der Bild-Datei. Nur jpeg (jpg), png, gif sind erlaubt."; return; } if (!move_uploaded_file($HTTP_POST_FILES['asimage']['tmp_name'], "{$storeDir}/{$id}.{$fileext}")) { $lastError = "Fehler bei der Erzeugung der Bild-Datei."; return; } } return 2; } #read input parameters $username = $HTTP_POST_VARS["username"]; $firstname = $HTTP_POST_VARS["firstname"]; $telephone = $HTTP_POST_VARS["telephone"]; $zipcode = $HTTP_POST_VARS["zipcode"]; $areacode = $HTTP_POST_VARS["areacode"]; $country = $HTTP_POST_VARS["country"]; $street = $HTTP_POST_VARS["street"]; $town = $HTTP_POST_VARS["town"]; $email = $HTTP_POST_VARS["email"]; $fax = $HTTP_POST_VARS["fax"]; $link = $HTTP_POST_VARS["link"]; $category = $HTTP_POST_VARS["category"]; $subcategory = $HTTP_POST_VARS["subcategory"]; $categoryID = $HTTP_POST_VARS["categoryID"]; $subcategoryID = $HTTP_POST_VARS["subcategoryID"]; $adverttype = $HTTP_POST_VARS["adverttype"]; $busitype = $HTTP_POST_VARS["busitype"]; $advertheader = $HTTP_POST_VARS["advertheader"]; $advertbody = $HTTP_POST_VARS["advertbody"]; $adults_only = $HTTP_POST_VARS["adults_only"]; $advertID = $HTTP_POST_VARS["advertID"]; $action = $HTTP_POST_VARS["action"]; $xml = $HTTP_POST_VARS["xml"]; $lastError =''; receiveAdsImage($advertID) or die ("FATAL: receiveAdsImage fatal error: ".$lastError."\n");; $date = date('d.m.Y H:i:s'); $fp = fopen ("tester.txt","a") or die ("Couldn't open tester.txt"); fputs($fp,"---->$date"\''); $resHash['comment'] = escapeString('Anzeigenschleuder - Test: dieses Skript erhalten die Maerkte im Mitglied-Bereich unter: cgi-submission -> test.cgi'); printXMLResponce($resHash); ?>