pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

PHP pastebin - collaborative debugging tool View Help


Posted by BuggyCoder on Tue 19 Aug 22:34
report abuse | View followups from nnn | download | new post

  1. <head>
  2. <title>
  3. ::PHP Mailor with attachment::
  4. </title>
  5. <style>
  6. body{background-color:#111111; color:#FFFFFF; font-family:Verdana;}
  7.                         table{background-color:#222222}
  8.                         input{border-color:#000000; color:#FFFFFF; border-width:1; background-color:#222222}
  9.                         textarea{border-color:#FFFFFF; color:#FFFFFF; border-width:1; background-color:#222222}
  10. </style>
  11. </head>
  12. <body>
  13.  
  14.                 <table border=0 align=top>
  15. <B>Assembled by BuggyCoder <br><a href="http://bug-code.blogspot.com">Bug-Code Blog</B>
  16.  
  17. <form name="form1" method="post" action="" enctype="multipart/form-data">
  18.  
  19. <tr>
  20. <td align=right valign=middle>mailfrom:</td>
  21. <td align=left valign=middle><input type=value name=mailfrom size=40></td>
  22. </tr>
  23. <tr>
  24. <td align=right valign=middle>mailto:</td>
  25. <td align=left valign=middle><input type=value name=mailto size=40></td>
  26. </tr>
  27. <tr>
  28. <td align=right valign=middle>subject:</td>
  29. <td align=left valign=middle><input type=value name=mailsubject size=40></td>
  30.  
  31. </tr>
  32. <tr>
  33. <td align=right valign=top>msg:</td>
  34. <td align=right valign=middle><textarea rows=10 cols=50  name=mailmessage size=20></textarea></td>
  35. </tr>
  36. <br>
  37. <br>
  38. <tr><td align=right valign=middle>Attach File:</td><td> <input type=file name=imagefile size=20></td></tr>
  39. <tr>
  40. <td align=right valign=middle colspan=2><input type="submit" name="submit" value="submit"> </td>
  41. </tr>
  42. <br>
  43.  
  44. <?
  45. if ($_POST['submit']=="submit"){
  46.                 $mail_from = $_POST[mailfrom];
  47.                 $mail_to = $_POST[mailto];
  48.                 $mail_subject = $_POST[mailsubject];
  49.                 $mail_message = $_POST[mailmessage];
  50.  
  51. if ($_FILES['imagefile']['name']=="")
  52. {
  53. mail($mail_to, $mail_subject, $mail_message, "From: $mail_from");
  54. die ("Sent mail with no attachment!!\n");
  55. }
  56.     copy ($_FILES['imagefile']['tmp_name'], getcwd()."/".$_FILES['imagefile']['name'])
  57.  
  58.     or die ("Could not copy");
  59.  
  60.  
  61.    
  62.  
  63.  
  64.                 ini_set("SMTP", "localhost");
  65.                 ini_set("sendmail_from", $mail_from);
  66. $file = $_FILES['imagefile']['name'];
  67.     $file_size = filesize($file);
  68.     $handle = fopen($file, "r");
  69.     $content = fread($handle, $file_size);
  70.     fclose($handle);
  71.     $content = chunk_split(base64_encode($content));
  72.     $uid = md5(uniqid(time()));
  73.     $name = basename($file);
  74.     $header = "From:  <".$mail_from.">\r\n";
  75.     $header .= "MIME-Version: 1.0\r\n";
  76.     $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
  77.     $header .= "This is a multi-part message in MIME format.\r\n";
  78.     $header .= "--".$uid."\r\n";
  79.     $header .= "Content-type:text/plain; charset=iso-8859-1\r\n";
  80.     $header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
  81.     $header .= $mail_message."\r\n\r\n";
  82.     $header .= "--".$uid."\r\n";
  83. $header .= "Content-Type: application/octet-stream; name=\"".$file."\"\r\n"; // use
  84.     $header .= "Content-Transfer-Encoding: base64\r\n";
  85. $header .= "Content-Disposition: attachment; filename=\"".$file."\"\r\n\r\n";
  86.     $header .= $content."\r\n\r\n";
  87.     $header .= "--".$uid."--";
  88.     if (mail($mail_to, $mail_subject, "", $header)) {
  89.         echo  "mail send with attachment ... OK"; // or use booleans here
  90.     } else {
  91.         echo "mail send ... ERROR!";}
  92.        
  93.  
  94. unlink($file);
  95.  
  96. }
  97. //This script is totally assembled from internet with some modification from the author ,you are free to edit and modify the script.
  98. //The Author holds no responsbilty from the illegal use of this script .
  99.  
  100.  
  101.  ?> </form>
  102. </table>
  103. </body>

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post