3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php if(isset ($_POST["send"])) { $upload_name=$_FILES["upload"]["name"]; $upload_type=$_FILES["upload"]["type"]; $upload_size=$_FILES["upload"]["size"]; $upload_temp=$_FILES["upload"]["tmp_name"]; $message=$_POST["msg"]; $subject = $_POST["subject"]; $to=$_POST["to"]; $from=$_POST["from"]; if($message==""||$subject==""||$to==""||$from=="") { echo '<font style="font-family:Verdana, Arial; font-size:11px; color:#F3363F; font-weight:bold">Please fill all fields</font>'; } else { $fp = fopen($upload_temp, "rb"); $file = fread($fp, $upload_size); $file = chunk_split(base64_encode($file)); $num = md5(time()); //Normal headers $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: multipart/mixed; "; $headers .= "boundary=".$num."\r\n"; $headers .= "--$num\r\n"; $headers ="Return-Path: <".clean_msg($from).">\n"; $headers .="From: ".clean_msg($from)." <".clean_msg($youremail).">\n"; $headers .="X-Mailer: PHP/".phpversion()."\n"; $headers .="X-Sender: ".$_SERVER['REMOTE_ADDR']."\n"; // This two steps to help avoid spam $headers .= "Message-ID: <".gettimeofday()." TheSystem@".$_SERVER['SERVER_NAME'].">\r\n"; $headers .= "X-Mailer: PHP v".phpversion()."\r\n"; // With message $headers .= "Content-Type: text/html; charset=iso-8859-1\r\n"; $headers .= "Content-Transfer-Encoding: 8bit\r\n"; $headers .= "".$message."\n"; $headers .= "--".$num."\n"; // Attachment headers $headers .= "Content-Type:".$upload_type." "; $headers .= "name=\"".$upload_name."\"r\n"; $headers .= "Content-Transfer-Encoding: base64\r\n"; $headers .= "Content-Disposition: attachment; "; $headers .= "filename=\"".$upload_name."\"\r\n\n"; $headers .= "".$file."\r\n"; $headers .= "--".$num."--"; // SEND MAIL @mail($to, $subject, $message, $headers); fclose($fp); echo '<font style="font-family:Verdana, Arial; font-size:11px; color:#333333; font-weight:bold">Mail sent please check inbox and spam both <br /></font>'; } } ?> <form id="attach" name="attach" method="post" action="<?php echo $_SERVER["PHP_SELF"]; ?>" enctype="multipart/form-data"> <table> <tr> <td>From</td><td>:</td><td><input type="text" name="from" id="from"></td> </tr> <tr> <td>To</td><td>:</td><td><input type="text" name="to" id="to"></td> </tr> <tr> <td>Subject</td><td>:</td><td><input type="text" name="subject" id="subject"></td> </tr> <tr> <td>Message</td><td>:</td><td><input type="text" name="msg" id="msg"></td> </tr> <tr> <td>Attachment<span class="imp">*</span></td><td>:</td><td><input type="file" name="upload" id="upload"></td> </tr> <tr> <td></td><td></td><td><input type="submit" value="Submit" id="send" name="send"></td> </tr> </table> </form>
Output for 5.2.3 - 7.1.0
<form id="attach" name="attach" method="post" action="/in/MsotD" enctype="multipart/form-data"> <table> <tr> <td>From</td><td>:</td><td><input type="text" name="from" id="from"></td> </tr> <tr> <td>To</td><td>:</td><td><input type="text" name="to" id="to"></td> </tr> <tr> <td>Subject</td><td>:</td><td><input type="text" name="subject" id="subject"></td> </tr> <tr> <td>Message</td><td>:</td><td><input type="text" name="msg" id="msg"></td> </tr> <tr> <td>Attachment<span class="imp">*</span></td><td>:</td><td><input type="file" name="upload" id="upload"></td> </tr> <tr> <td></td><td></td><td><input type="submit" value="Submit" id="send" name="send"></td> </tr> </table> </form>
Output for 4.3.0 - 5.2.2
<form id="attach" name="attach" method="post" action="" enctype="multipart/form-data"> <table> <tr> <td>From</td><td>:</td><td><input type="text" name="from" id="from"></td> </tr> <tr> <td>To</td><td>:</td><td><input type="text" name="to" id="to"></td> </tr> <tr> <td>Subject</td><td>:</td><td><input type="text" name="subject" id="subject"></td> </tr> <tr> <td>Message</td><td>:</td><td><input type="text" name="msg" id="msg"></td> </tr> <tr> <td>Attachment<span class="imp">*</span></td><td>:</td><td><input type="file" name="upload" id="upload"></td> </tr> <tr> <td></td><td></td><td><input type="submit" value="Submit" id="send" name="send"></td> </tr> </table> </form>