SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | if(isset($_POST['submit2'])) | |
| 3 | { | |
| 4 | //The form has been submitted, prep a nice thank you message | |
| 5 | $output = '<h1>Thanks for your file and message!</h1>'; | |
| 6 | ||
| 7 | //Set the form flag to no display (cheap way!) | |
| 8 | $flags = 'style="display:none;"'; | |
| 9 | ||
| 10 | //Deal with the email | |
| 11 | $to = '[email protected]'; | |
| 12 | $subject = 'Article Submission'; | |
| 13 | ||
| 14 | $message = $_POST['name'].'n'.$_POST['email'].'nn'.$_POST['title'].'n'.$_POST['remarks']; | |
| 15 | $attachment = chunk_split(base64_encode(file_get_contents($_FILES['file']['tmp_name']))); | |
| 16 | $filename = $_FILES['file']['name']; | |
| 17 | ||
| 18 | $boundary =md5(date('r', time())); | |
| 19 | ||
| 20 | $headers = "From: [email protected]: [email protected]"; | |
| 21 | $headers .= "rnMIME-Version: 1.0rnContent-Type: multipart/mixed; boundary="_1_$boundary""; | |
| 22 | ||
| 23 | $message="This is a multi-part message in MIME format. | |
| 24 | ||
| 25 | --_1_$boundary | |
| 26 | Content-Type: multipart/alternative; boundary="_2_$boundary" | |
| 27 | ||
| 28 | --_2_$boundary | |
| 29 | Content-Type: text/plain; charset="iso-8859-1" | |
| 30 | Content-Transfer-Encoding: 7bit | |
| 31 | ||
| 32 | $message | |
| 33 | ||
| 34 | --_2_$boundary-- | |
| 35 | --_1_$boundary | |
| 36 | Content-Type: application/octet-stream; name="$filename" | |
| 37 | Content-Transfer-Encoding: base64 | |
| 38 | Content-Disposition: attachment | |
| 39 | ||
| 40 | $attachment | |
| 41 | --_1_$boundary--"; | |
| 42 | ||
| 43 | mail($to, $subject, $message, $headers); | |
| 44 | } | |
| 45 | ?> | |
| 46 | ||
| 47 | ||
| 48 | <h2> Article Submission </h2> | |
| 49 | (*) Required Fields<br> | |
| 50 | <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data"> | |
| 51 | <table> | |
| 52 | ||
| 53 | <tr> | |
| 54 | <td> Name </td> | |
| 55 | <td> <input type="text" name="name" size="30"> * </td> | |
| 56 | </tr> | |
| 57 | <tr> | |
| 58 | <td> Email </td> | |
| 59 | <td> <input type="text" name="email" size="30"> * </td> | |
| 60 | </tr> | |
| 61 | ||
| 62 | - | <tr> <td> </td><td> </td> </tr> |
| 62 | + | <tr> <td> </td><td> </td> </tr> |
| 63 | ||
| 64 | <tr> | |
| 65 | <td> Title of Article </td> | |
| 66 | <td> <input type="text" name="title" size="40"> * </td> | |
| 67 | </tr> | |
| 68 | <tr> | |
| 69 | <td> Program </td> | |
| 70 | <td></td> | |
| 71 | </tr> | |
| 72 | <tr> | |
| 73 | <td> Course </td> | |
| 74 | <td> </td> | |
| 75 | </tr> | |
| 76 | <tr> | |
| 77 | <td> File </td> | |
| 78 | <td> <input type="file" name="file" id="file"> </td> | |
| 79 | </tr> | |
| 80 | ||
| 81 | - | <tr> <td> </td><td> </td> </tr> |
| 81 | + | <tr> <td> </td><td> </td> </tr> |
| 82 | ||
| 83 | <tr> | |
| 84 | <td valign="top"> Remarks </td> | |
| 85 | <td> <textarea rows="6" cols="40" name="remarks"> </textarea> | |
| 86 | </tr> | |
| 87 | <tr> | |
| 88 | <td> <input type="submit" name="submit2" value="Submit" id="submit"> </td> | |
| 89 | </tr> | |
| 90 | ||
| 91 | </table> | |
| 92 | </form> | |
| 93 | ||
| 94 | </div> | |
| 95 | <?php include('include/main_footer.php'); ?> |