Hi, i built a simple "submit form" on http://demo-verse.com/nite.php
The inputed form data gets sent to my email address upon hitting the submit: but fails to redirect to the "success url". It instead shows this error:
if this makes it easier for you guys to help me out, here are all the info from the code editor in my cpanel that make up the page.
The inputed form data gets sent to my email address upon hitting the submit: but fails to redirect to the "success url". It instead shows this error:
PHP Code:
Warning: mail(/var/log/phpmail.log) [function.mail]: failed to open stream: Permission denied in /home/demovers/public_html/nite.php on line 80
Warning: Cannot modify header information - headers already sent by (output started at /home/demovers/public_html/nite.php:80) in /home/demovers/public_html/nite.php on line 81
if this makes it easier for you guys to help me out, here are all the info from the code editor in my cpanel that make up the page.
PHP Code:
<?php
function ValidateEmail($email)
{
$pattern = '/^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i';
return preg_match($pattern, $email);
}
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$mailto = 'lucas9000********.co.uk';
$mailfrom = isset($_POST['email']) ? $_POST['email'] : $mailto;
$subject = 'Website form';
$message = 'Values submitted from web site form:';
$success_url = 'http://demo-verse.com/success.html';
$error_url = '';
$error = '';
$eol = "\n";
$max_filesize = isset($_POST['filesize']) ? $_POST['filesize'] * 1024 : 1024000;
$boundary = md5(uniqid(time()));
$header = 'From: '.$mailfrom.$eol;
$header .= 'Reply-To: '.$mailfrom.$eol;
$header .= 'MIME-Version: 1.0'.$eol;
$header .= 'Content-Type: multipart/mixed; boundary="'.$boundary.'"'.$eol;
$header .= 'X-Mailer: PHP v'.phpversion().$eol;
if (!ValidateEmail($mailfrom))
{
$error .= "The specified email address is invalid!\n<br>";
}
if (!empty($error))
{
$errorcode = file_get_contents($error_url);
$replace = "##error##";
$errorcode = str_replace($replace, $error, $errorcode);
echo $errorcode;
exit;
}
$internalfields = array ("submit", "reset", "filesize", "upload_folder", "send", "captcha_code");
$message .= $eol;
$message .= "IP Address : ";
$message .= $_SERVER['REMOTE_ADDR'];
$message .= $eol;
foreach ($_POST as $key => $value)
{
if (!in_array(strtolower($key), $internalfields))
{
if (!is_array($value))
{
$message .= ucwords(str_replace("_", " ", $key)) . " : " . $value . $eol;
}
else
{
$message .= ucwords(str_replace("_", " ", $key)) . " : " . implode(",", $value) . $eol;
}
}
}
$body = 'This is a multi-part message in MIME format.'.$eol.$eol;
$body .= '--'.$boundary.$eol;
$body .= 'Content-Type: text/plain; charset=ISO-8859-1'.$eol;
$body .= 'Content-Transfer-Encoding: 8bit'.$eol;
$body .= $eol.stripslashes($message).$eol;
if (!empty($_FILES))
{
foreach ($_FILES as $key => $value)
{
if ($_FILES[$key]['error'] == 0 && $_FILES[$key]['size'] <= $max_filesize)
{
$body .= '--'.$boundary.$eol;
$body .= 'Content-Type: '.$_FILES[$key]['type'].'; name='.$_FILES[$key]['name'].$eol;
$body .= 'Content-Transfer-Encoding: base64'.$eol;
$body .= 'Content-Disposition: attachment; filename='.$_FILES[$key]['name'].$eol;
$body .= $eol.chunk_split(base64_encode(file_get_contents($_FILES[$key]['tmp_name']))).$eol;
}
}
}
$body .= '--'.$boundary.'--'.$eol;
mail($mailto, $subject, $body, $header);
header('Location: '.$success_url);
exit;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Untitled Page</title>
<meta name="GENERATOR" content="Created by BlueVoda Website builder http://www.bluevoda.com">
<meta name="HOSTING" content="Hosting Provided By VodaHost http://www.vodahost.com">
<style type="text/css">
div#container
{
width: 800px;
height: 600px;
margin-top: 0px;
margin-left: 0px;
text-align: left;
}
</style>
<style type="text/css">
body
{
background-color: #FFFFFF;
color: #000000;
}
</style>
<style type="text/css">
a:hover
{
color: #845698;
}
</style>
</head>
<body>
<div id="container">
<div id="bv_Form1" style="position:absolute;background-color:#F0F0F0;left:28px;top:46px;width:572px;height:139px;z-index:3">
<form name="Form1" method="post" action="<?php echo basename(__FILE__); ?>" enctype="multipart/form-data" id="Form1">
<div id="bv_Text1" style="margin:0;padding:0;position:absolute;left:10px;top:15px;width:65px;height:16px;text-align:left;z-index:0;">
<font style="font-size:13px" color="#000000" face="Arial">New Label</font></div>
<textarea name="TextArea1" id="TextArea1" style="position:absolute;left:85px;top:15px;width:422px;height:43px;border:1px #C0C0C0 solid;font-family:'Courier New';font-size:16px;z-index:1" rows="1" cols="38"></textarea>
<input type="submit" id="Button1" name="Button1" value="Submit" style="position:absolute;left:240px;top:79px;width:96px;height:25px;font-family:Arial;font-size:13px;z-index:2">
</form>
</div>
</div>
</body>
</html>
Comment