Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1901 connectés 

  FORUM HardWare.fr
  Programmation

  Form2mail [PHP Inside]

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Form2mail [PHP Inside]

n°118029
THX
Eleveur de Big Jim de Paris.
Posté le 27-03-2002 à 10:31:26  profilanswer
 

Salut  
 
Voila qqun m'a envoyé un Formulaire qui ne marche pas... apparement ce dernier me disait qu'il fallait simplement remplacer l'adresse mail ligne 3 mais prout que dalle  
 
Si y'a des connaisseur en PHP qui peuvent trouver ca, ce serait bien gentil :)  
 
Le Formulaire appelé form2mail.php3 :  
 
<?php
 
$dest="aremplir@mondomain";
 
$referer= getenv("HTTP_REFERER" );
 
$ok=1;
 
if($ok){
 
 $sujet= "Form2Mail de ".$referer;
 $body.="Page d'origine : $referer\n";
 $body.="\n*** Valeurs resultats ***\n";
 
 if(count($HTTP_POST_VARS)){
    while (list($key, $val) = each($HTTP_POST_VARS)){
       $body.="$key : $val\n";
    }  
 }
 
 if(count($HTTP_GET_VARS)){
    while (list($key, $val) = each($HTTP_GET_VARS)){
      $body.="$key : $val\n";
    }  
 }
 
 $body.="*************************\n";
 if(!email("webmaster",$dest,$sujet,$body)){
     print "erreur envoi email <br>";
 }
 
?>
<html>
<head><title>Bravo</title></head>
<body bgcolor="white">
<h1> comment tu es trop fort </h1>
</body>
</html>
<?php
}
 
else{
?>
<html>
<head><title>Erreur de formulaire</title></head>
<body bgcolor="white">
<h1> Tu t'es planté </h1>
</body>
</html>
<?php
}
?>  
 
La page HTML avec les champs :  
 
<html>
<head><title>Une forme</title></head>
<body bgcolor="#FFFFFF">
<form action="form2mail.php3">
Ton nom ici tafiotte : <input type="text" name="nom">
<input type="submit" name="ok" value="ok" >
</body>
</html>  
 
 
Merci et a votre bon coeur m'sieurs dames

mood
Publicité
Posté le 27-03-2002 à 10:31:26  profilanswer
 

n°118030
Krapaud
Posté le 27-03-2002 à 10:35:31  profilanswer
 

y'a programmation pour t'aider ;)

n°118031
THX
Eleveur de Big Jim de Paris.
Posté le 27-03-2002 à 10:37:22  profilanswer
 

ah merde désolé j'avais pas vu qu'il y avait un truc programmation quel débile héhé
 
Tu peux me déplacer vers le bon forum ou je le refais ?

n°118032
Krapaud
Posté le 27-03-2002 à 10:38:06  profilanswer
 

et ça?
 
 
 

Citation :

<?
// Функции. Можно вынести в дpугой файл.
 
class html_mime_mail {
  var $headers;  
  var $multipart;  
  var $mime;  
  var $html;  
  var $parts = array();  
 
function html_mime_mail($headers="" ) {  
    $this->headers=$headers;  
}  
 
function add_html($html="" ) {  
    $this->html.=$html;  
}  
 
function build_html($orig_boundary,$kod) {  
    $this->multipart.="--$orig_boundary\n";  
    if ($kod=='w' || $kod=='win' || $kod=='windows-1251';) $kod='windows-1251';
    else $kod='koi8-r';
    $this->multipart.="Content-Type: text/html; charset=$kod\n";  
    $this->multipart.="BCC: del@ipo.spb.ru\n";
    $this->multipart.="Content-Transfer-Encoding: Quot-Printed\n\n";  
    $this->multipart.="$this->html\n\n";  
}  
 
 
function add_attachment($path="", $name = "", $c_type="application/octet-stream" ) {  
    if (!file_exists($path.$name)) {
      print "File $path.$name dosn't exist.";
      return;
    }
    $fp=fopen($path.$name,"r" );
    if (!$fp) {
      print "File $path.$name coudn't be read.";
      return;
    }  
    $file=fread($fp, filesize($path.$name));
    fclose($fp);
    $this->parts[]=array("body"=>$file, "name"=>$name,"c_type"=>$c_type);  
}  
 
 
function build_part($i) {  
    $message_part="";  
    $message_part.="Content-Type: ".$this->parts[$i]["c_type"];  
    if ($this->parts[$i]["name"]!="" )  
       $message_part.="; name = \"".$this->parts[$i]["name"]."\"\n";  
    else  
       $message_part.="\n";  
    $message_part.="Content-Transfer-Encoding: base64\n";  
    $message_part.="Content-Disposition: attachment; filename = \"".
       $this->parts[$i]["name"]."\"\n\n";  
    $message_part.=chunk_split(base64_encode($this->parts[$i]["body"]))."\n";
    return $message_part;  
}  
 
 
function build_message($kod) {  
    $boundary="=_".md5(uniqid(time()));  
    $this->headers.="MIME-Version: 1.0\n";  
    $this->headers.="Content-Type: multipart/mixed; boundary=\"$boundary\"\n";  
    $this->multipart="";  
    $this->multipart.="This is a MIME encoded message.\n\n";  
    $this->build_html($boundary,$kod);  
    for ($i=(count($this->parts)-1); $i>=0; $i--)
      $this->multipart.="--$boundary\n".$this->build_part($i);  
    $this->mime = "$this->multipart--$boundary--\n";  
}  
 
 
function send($server, $to, $from, $subject="", $headers="" ) {  
 
    $headers="To: $to\nFrom: $from\nSubject: $subject\nX-Mailer: The Mouse!\n$headers";
    $fp = fsockopen($server, 25, &$errno, &$errstr, 30);
    if (!$fp)
       die("Server $server. Connection failed: $errno, $errstr" );
    fputs($fp,"HELO $server\n" );
    fputs($fp,"MAIL FROM: $from\n" );
    fputs($fp,"RCPT TO: $to\n" );
    fputs($fp,"DATA\n" );
    fputs($fp,$this->headers);
    if (strlen($headers))
      fputs($fp,"$headers\n" );
    fputs($fp,$this->mime);
    fputs($fp,"\n.\nQUIT\n" );
    while(!feof($fp))
      $resp.=fgets($fp,1024);
    fclose($fp);
  }  
}
 
 
// *************************************************************************
//
//   В качестве аттача пpисоединяем html-письмо (открывается автоматически;).
//   Второй аттач - некоторый файл из каталога.
//   Вот так вызывать все то, что написано выше:
//
// *************************************************************************
 
 
  $mail=new html_mime_mail();
  $mail->add_html("<html><body><center><h2>Пpивет!<br><br>".
                  "<br>Посылаю двоичный файл [/bin/ls] ...".
                  "</h2></center></body></html>" );
  $mail->add_attachment("/bin/","ls" );
  $mail->build_message('win';); // если не "win", то кодиpовка koi8
  $mail->send('ПОЧТ
054;ВЫЙ_ХОС
058;_ВАШЕГО_&#
1055;РОВАЙД
045;РА',
              'КОМУ_(E-MAIL)',
              'ОТ_КОГО_(E-MAIL)',
              'ТЕМА ПИСЬМА';);
 
//
// После прихода письма качаем по ФТП оригинальный /bin/ls и сравниваем с
// импорти&
#1088;ованны&#
1084; из письма:  
//  
//    X:\temp>fc /b ls ls2
//    Сравнение файлов ls и LS2
//    FC: различия не найдены
//
//
// Внимание! Если у вас нет файла /bin/ls, то просто закомме&
#1085;тируйт&#
1077; строку
// $mail->add_attachment("/bin/","ls" ), чтобы программа не пыталась присоединить
// к письму неcуществующие файлы.
//
 
 
?>

n°118035
THX
Eleveur de Big Jim de Paris.
Posté le 27-03-2002 à 10:40:39  profilanswer
 

Lapin complitz :D


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation

  Form2mail [PHP Inside]

 

Sujets relatifs
Php + script mailFlash to PHP/ Php to Flash via base mySQL?
Flash to PHP/ Php to Flash via base mySQL?[PHP] Faire un include d'une page d'un autre site ?
tailles des champs mysql [edit : ajout d'infos et d'analyse inside][Apache, PHP] ErrorDocument
[PHP] Hasard... Est ce prévu ???PHP retour du resultat d'une requete>condition
[PHP MySQL] Ca me gonfle (normal je suis un noob)problem PHP --> HTML
Plus de sujets relatifs à : Form2mail [PHP Inside]


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR