boeing | Code :
- <html>
- <head>
- <meta http-equiv="Content-Language" content="fr">
- <?php
- $AFF_NUMBER = "AFF2336";
- $mix_lien_redirect = "";
- $COOKIES_MIXAD = $GLOBALS["HTTP_COOKIE"];
- function GetServicePA()
- {
- $COOKIES_MIXAD = $GLOBALS["COOKIES_MIXAD"];
- $mix_redirect=False;
- $mix_fichiers="";
- $mix_headers="";
- $mix_dc = 0;
- $mix_form="";
- $mix_bo="";
- $mix_variables="";
- $mix_buf="";
- $mix_header = true;
- $mix_result = "";
- $mix_urlsitebase=$_COOKIE["MixadUrlSiteBase"];
- $mix_method = $GLOBALS["REQUEST_METHOD"];
- $mix_host = "perso.mixad.com";
- $mix_create_form = $GLOBALS["create_form"];
- $mix_path = "/";
- $mix_port = 80;
- $mix_strcookie = "";
- $mix_headerclient="";
- $mix_lien_http = $GLOBALS["lien_http"];
- if ($mix_lien_http == "" ) {
- $mix_lien_http=$GLOBALS["url_mixad"];
- }
- //Gestion des redirect IIS
- if ($GLOBALS["lien_redirect"] != "" ) {
- $mix_lien_http = $GLOBALS["lien_redirect"];
- }
- //Extraction du path
- if ($mix_lien_http!="" ) {
- $mix_path = $mix_lien_http;
- $pos = strpos($mix_path,"?" );
- if (is_int($pos)) {
- $mix_path = substr($mix_path,0,$pos);
- $mix_variables = substr($mix_lien_http,$pos+1) . "&";
- }
- }
- //Extraction des variables du GET
- if ($GLOBALS["lien_redirect"] == "" && $mix_create_form=="" ) {
- foreach($GLOBALS["HTTP_GET_VARS"] as $key=>$elem) {
- if ($key!="lien_http" && $key!="action_http" && $key!="url_mixad" ) {
- $mix_variables .= $key . "=" . urlencode($elem) . "&";
- }
- }
- }
- //Interrogation du serveur IIS/MixadPerso distant
- //pour affichage du service de petites annonces
- $fp = fsockopen($mix_host,$mix_port, $errno, $errstr,300);
- if (!isset($_COOKIE["MIXADTRACKING"]) || !strpos($_COOKIE["MIXADTRACKING"],"TCKID=" . $GLOBALS["AFF_NUMBER"]) ) {
- $mix_variables.="TCKID=". $GLOBALS["AFF_NUMBER"] . "&NBCVERSION=PHP2&";
- }
- $mix_headers.="$mix_method $mix_path?$mix_variables HTTP/1.1\r\nHost: $mix_host\r\n";
- //On repasse tous les cookiees précédemment récupérés
- if (isset($COOKIES_MIXAD)&&$COOKIES_MIXAD!="" ) {
- $mix_headers.="Cookie: ".$COOKIES_MIXAD."\r\n";
- }
- $mix_headers.="Accept: */*\r\n";
- $mix_headers.="Connection: Keep-Alive\r\n";
- if ($mix_create_form == "2" ) {
- $bo_key = substr(md5($local_file.time()), 1, 15);
- $mix_bo="-----------------------------".$bo_key;
- $mix_form.="Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*\r\n";
- $mix_form.="Accept-Charset: iso-8859-1,*,utf-8\r\n";
- $mix_form.="Content-type: multipart/form-data; boundary=$mix_bo\r\n";
- $mix_bo="-----------------------------".$bo_key."\r\n";
- foreach($GLOBALS["HTTP_GET_VARS"] as $key=>$val) {
- if ($key!="create_form" && $key!="lien_http" ) {
- $ds =sprintf("%sContent-Disposition: form-data; name=\"%s\"\r\n\r\n%s\r\n", $mix_bo, $key, $val);
- $mix_dc += strlen($ds);
- }
- }
- $mix_dc += strlen($mix_bo)+3;
- $mix_form.="Content-length: $mix_dc \r\n";
- $mix_form.="\r\n";
- foreach($GLOBALS["HTTP_GET_VARS"] as $key=>$val) {
- if ($key!="create_form" && $key!="lien_http" ) {
- $ds =sprintf("%sContent-Disposition: form-data; name=\"%s\"\r\n\r\n%s\r\n", $mix_bo, $key, $val);
- $mix_form.=$ds;
- }
- }
- $mix_bo = "-----------------------------".$bo_key . "--";
- $mix_form.=$mix_bo;
- }
- //Si create_form = 1
- if ($mix_create_form == "1" ) {
- foreach($GLOBALS["HTTP_GET_VARS"] as $key=>$val) {
- if ($key!="create_form" && $key!="lien_http" ) {
- $mix_form .= $key . "=" . urlencode($val) . "&";
- }
- }
- $mix_form = substr($mix_form,0,strlen($mix_form)-1);
- $mix_headers.="Content-type: application/x-www-form-urlencoded\r\n";
- $mix_headers.="Content-length: ". strlen($mix_form) ."\r\n\r\n";
- }
- if ($mix_create_form == "" ) {
- $mix_headers.="\r\n";
- }
- fputs($fp, $mix_headers);
- fputs($fp, $mix_form."\r\n\r\n" );
- //Récupération du résultats
- while(!feof($fp)) {
- $line = fgets($fp,4096);
- //Gestion des redirect de la Plate-Forme IIS
- if ($line != "HTTP/1.1 302 Object moved\r\n" ) {
- if ( $line == "\r\n"&&$mix_header) $mix_header = false;
- //traitement des cookie renvoyés
- if (substr($line,0,10) == "Set-Cookie" ) {
- $mix_strcookie .= $line;
- $dline=urldecode($line);
- $firstpos=strpos($dline,'URL_BASE_AFFILIEUR=');
- if ($firstpos!= false) {
- $firstpos+=19;
- $secpos=strpos($dline,'&ISAFFILIEUR');
- $mix_urlsitebase = substr($dline,$firstpos,$secpos-$firstpos);
- $mix_strcookie .= 'Set-Cookie: MixadUrlSiteBase='. urlencode($mix_urlsitebase) . "; path=/\r\n";
- }
- }
- if ( $mix_header == false )
- {
- $mix_result = $fp;
- break;
- }
- }
- else {
- $mix_redirect = True;
- while(!feof($fp)) {
- $line = fgets($fp,4096);
- if ($line == "\r\n" ) {
- break;
- }
- if (substr($line,0,9) == "Location:" ) {
- $GLOBALS["lien_redirect"] = str_replace("\r\n","",substr($line,10));
- }
- //traitement des cookie renvoyés
- if (substr($line,0,10) == "Set-Cookie" ) {
- $mix_strcookie .= $line;
- $dline=urldecode($line);
- $firstpos=strpos($dline,'URL_BASE_AFFILIEUR=');
- if ($firstpos!= false) {
- $firstpos+=19;
- $secpos=strpos($dline,'&ISAFFILIEUR');
- $mix_urlsitebase = substr($dline,$firstpos,$secpos-$firstpos);
- $mix_strcookie .= 'Set-Cookie: MixadUrlSiteBase='. urlencode($mix_urlsitebase) . "; path=/\r\n";
- }
- }
- }
- break;
- }
- }
- if ($mix_redirect) {
- header("HTTP/1.1 301 Moved Permanently" );
- $mix_headerclient.="Location: ".$mix_urlsitebase."lien_http=".urlencode($GLOBALS["lien_redirect"])."\r\n";
- $mix_headerclient.="Connection: Close\r\n";
- fclose($fp);
- }
- $mix_headerclient.=$mix_strcookie;
- header($mix_headerclient);
- if ($mix_redirect) {
- exit;
- }
- return $mix_result;
- }
- function DisplayServicePA ($MyfpMixad) {
- while(!feof($MyfpMixad)) {
- $line = fgets($MyfpMixad,4096);
- echo($line);
- if ($line == "</html>\r\n" ) {
- break;
- }
- }
- fclose($MyfpMixad);
- }
- $fpMixad=GetServicePA();
- ?>
- <body>
- <?DisplayServicePA($fpMixad);?>
- </body>
- </html>
|
voilà c le code la page en entier ..
Merci |