BlackEagle 51
| Posté : 29-06-2005 19:34
J'aurais besoin d'un coup de main parceque je patauge completement depuis 2 jours.
Voici mon fichier formulaire.php
<?PHP
/************************************************************** **********/
/* SFORM Extender for NPDS V Contact Example & nbsp; */
/* =========================== &nbs p;   ; */
/* &nb sp; &nbs p;   ; & nbsp; */
/* - 2004 &nb sp; &nbs p;   ; */
/* &nb sp; &nbs p;   ; & nbsp; */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
br />
// Récuperation du nom d'utilisateur sur le site par rapport au cookie
cookiedecode($user);
$username = $cookie[1];
if ($username == "") {
$nom = "";
} else {
$nom = $username;
}
// Récupération de l'adresse email de l'utilisa teur si membre sur le site par rapport au cookie
list($email,$femail) = mysql_fetch_row(mysql_query("SELECT email,femail FROM ".$NPDS_Prefix."users where uname='$username'"));
$m->add_form_field_size(50);
$m->add_title("Soumission de voitures");
$m->add_field('nom', "Nom/Pseudo",$nom,'text',true,150,"","");
$m->add_field('cars', "Nom du véhicule",$cars,'text',true,25,"","");
$m->add_field('type', "Type de véhicule",$type,'text',false,25,"","");
$m->add_extra("<tr><td colspan=2> </td></tr>");
$m->add_field('email', "Adresse de messagerie",$email,'text',true,255,"","email");
$m->add_extra("<tr><td colspan=2> </td></tr>");
$m->add_upload('B1', "Fichier à envoyer", "30", "");
$m->add_extra("<tr><td colspan=2> </td></tr>");
// ----------------------------------------------------------------
// CES CHAMPS sont indispensables --- Don't&nbs p;remove these fields
$m->add_extra("<tr><td align=center colspan=2>");
// Reset bouton
$m->add_field("","","R a z",'reset',false);
// Return bouton
$m->add_extra(" -::- ");
$m->add_extra("<a href=index.php>[ Retour ]</a>");
// Submit bouton
$m->add_extra(" -::- ");
$m->add_field("","","Soumettre",'submit',false);
$m->add_extra("</td></tr>");
// ----------------------------------------------------------------
?>
Et mon fichier contact.php
<?PHP
/************************************************************** **********/
/* SFORM Extender for NPDS V Contact Example . * /
/* =========================== &nbs p;   ; */
/* &nb sp; &nbs p;   ; & nbsp; */
/* 2002 - 2004 &nb sp; &nbs p;   ; */
/* &nb sp; &nbs p;   ; & nbsp; */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
br />/* Dont modify this file is you dont know what you make &nb sp; */
/************************************************************************/
br />
global $ModPath, $ModStart;
$sform_path="modules/sform/";
!include!_once($sform_path."sform.php");
global $m;
$m=new form_handler();
//********************
$m->add_form_title("CONTACT");
$m->add_form_method("post");
$m->add_form_check("true");
$m->add_mess(" * désigne un champ obligatoire < /font>");
$m->add_submit_value("ok");
$m->add_!url(!"modules.php");
$m->add_field("ModStart","",$ModStart,'hidden',false);
$m->add_field("ModPath","",$ModPath,'hidden',false);
/************************************************/
!include!($sform_path."upload/formulaire.php");
/************************************************/
// Manage the <form>
switch($ok) {
case 'Soumettre':
if (!$sformret) {
$m->make_response();
$limite = md5(uniqid(rand()));
$message = $m->aff_response("class=\"LIGNA\"","not_echo","");
//lefichier
if ($B1<>"") {
$attachement = "------=$limite\n";
$attachement .= "!content-type:! application/octet-stream; name=\"$B1\"\n";
$attachement .= "!content-transfer-encoding:!base_64\n";
$attachement ."!content-disposition:! attachment; filename=\"$B1\"";
$attachement .= chunk_split(base_64_encode(implode("", file($B1))));
}
global $notify_ema il;
$message="<html><body>".$message."</body></html>";
send_email($notify_emai l, $m->title,$message.$attachement,"","","html");
opentable();
echo $B1; &nb sp;// verification du nom du fichier
echo "<p align=\"center\">Votre demande est prise en compte. Nous y répondrons au plus vite</p>< font color="#007700">";
closetable();
break;
} else {
$ok="";
}
default:
echo $m->print_form("class=\"LIGNA\"");
break;
}
?>
Lorsque je lance mon formulaire, il m'envoye bien le mail mais le fichier n'est pas attaché au mail. Il apparait comme ceci à l'interieur :
------=7e55e2799f8919c5a0c84f18c0c3ceb3 !content-type:! application/octet-stream; name="/tmp/phpQuoPwI" !content-transfer-encoding:!base_64 PD8NCi8qIE1vZGlmaWV6IGxlcyBwYXJhbeh0cmVzIGQnYXBwZWwgZGUgbGEgZm9uY3Rpb24gc2Vs b24gdm9zIGJlc29pbnMNCg0KTkUgUEFTIEFKT1VURVIgREUgTElHTkVTIFZJREVTIEFVIERFQlVU...
Pouvez vous m'aider |