Jump to content

Recommended Posts

I recently wrote a script that emails the form results to me. I also have a friend who at least acts like he knows PHP and when he looked at the code he said that a command could be entered that would delete the files on the server or on the computor. Is this true? If so, is there a way to correct it or prevent it. The code is below:

------------------------------------------------------------------------

An email has been sent to the Director of Human Resources.
Thank you for apply, you will hear back in a bit.

<?php
$body = "Application Alert!\n\n";
foreach($_POST as $field => $value) {
$body .= sprintf("%s = %s\n", $field, $value);
}

mail("theflea912@gmail.com", "APPLYING PILOT!", $body,
'From: "APPLY" <apply@qantasva.com');
?>
Link to comment
https://forums.phpfreaks.com/topic/5739-mail-security/
Share on other sites

Theres not an exploit like that around as far as i know, one of the very few mail() exploits is mail injection which works like sql injection and can be avoided by validating user input.. which should always be done anyway, if you wanna know more theres a nice little article here about it:

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--][a href=\"http://securephp.damonkohler.com/index.php/Email_Injection\" target=\"_blank\"]http://securephp.damonkohler.com/index.php/Email_Injection[/a][/quote]
Link to comment
https://forums.phpfreaks.com/topic/5739-mail-security/#findComment-20489
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.