You are here: php form mail problem « All PHP « IT news, forums, messages
php form mail problem

Posted by Ren� on 02/28/06 22:59

Dear all, would you be able to help me with the following, i created a small
website with a contact form written in php script. The problem is that a lot
of people tried to hack the script and I think I need some more securities
build in, but as you would guess im new to php and am not sure how or what
to do or implement and make it more secure.

Could somebody help me with this? (script can be found below)

Thanks in advance,

kind regards,
Ren�
-------------------------------------

<?php

$adminemail = 'email address';

$version = '1.10';
$controlvars = ' thankyou submitteremail ccsubmitter ';
$messagetoadmin = $HTTP_POST_VARS['E-mail'] ." blablablablabalbla:


";
$messagetosubmitter = "Thank you for blablabalbalbla.

blablablablabalabla
_____________________________________________________________

";
while(list($key, $value) = each($HTTP_POST_VARS))
{
if (!stristr($controlvars, ' '. $key .' '))
{
$messagetoadmin .= $key .': '. $value .'

';
$messagetosubmitter .= $key .': '. $value .'

';
}
}
mail($adminemail, 'form'. stripslashes($HTTP_POST_VARS['subject']),
stripslashes($messagetoadmin), 'From: '. $HTTP_POST_VARS['E-mail']);

if ($HTTP_POST_VARS['ccsubmitter'] == 'yes')
{
mail($HTTP_POST_VARS['E-mail'], 'Information form'.
stripslashes($HTTP_POST_VARS['subject']), stripslashes($messagetosubmitter),
'From: '. $adminemail);
}
if ($_POST['autoresponse'] != '')
{
$body = geturl($autoresponse);
mail($submitteremail, 'Re: '. stripslashes($HTTP_POST_VARS['subject']),
stripslashes($body), 'From: '. $adminemail);
}
header('Location: '. $HTTP_POST_VARS['thankyou']);
// just in case redirect doesn't work
die('<meta http-eqiv="refresh" content="0;url='. $HTTP_POST_VARS['thankyou']
..'">');
function geturl($url)
{
if (version_compare("4.3.0", phpversion(), "<"))
{
$filecontents = @file_get_contents($url);
}
else
{
$fd = @fopen($url, 'rb');
$filecontents = @fread ($fd, 30000000);
@fclose ($fd);
}
return $filecontents;
}

?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация