','>',$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<----\n"); fputs($fp,"Name: $username \n"); fputs($fp,"Vorname: $firstname \n"); fputs($fp,"Telefon: $telephone \n"); fputs($fp,"PLZ: $zipcode \n"); fputs($fp,"Vorwahl: $areacode \n"); fputs($fp,"Land-Vorwahl: $country \n"); fputs($fp,"Strasse: $street \n"); fputs($fp,"Stadt: $town \n"); fputs($fp,"Email: $email \n"); fputs($fp,"Fax: $fax \n"); fputs($fp,"URL: $link \n"); fputs($fp,"Kategorie: $category \n"); fputs($fp,"Unterkategorie: $subcategory \n"); fputs($fp,"KategorieID: $categoryID \n"); fputs($fp,"SubkategorieID: $subcategoryID \n"); fputs($fp,"Suchen-Bieten: $adverttype \n"); fputs($fp,"Privat-Gesch: $busitype \n"); fputs($fp,"Anzeigenkopf: $advertheader \n"); fputs($fp,"Anzeigentext: $advertbody \n"); fputs($fp,"Nur f�r Erwachsene: $adults_only \n"); fputs($fp,"ID der Anzeige: $advertID \n"); fputs($fp,"Action: $action \n"); fputs($fp,"XML-String: $xml \n"); fclose($fp); $resHash['duration'] = escapeString('30'); $resHash['link'] = escapeString('http://www.test.de&"\''); $resHash['comment'] = escapeString('Anzeigenschleuder - Test: dieses Skript erhalten die Maerkte im Mitglied-Bereich unter: cgi-submission -> test.cgi'); printXMLResponce($resHash); ?>