GLP23
03-23-2006, 04:42 PM
ok, i just cant get this to work, your help is much appreciated, i have a form to email script that im still trying to work, the following errors are coming up:
Warning: main(/home/bay59170/public_html/include/include.php): failed to open stream: No such file or directory in /home/bay59170/public_html/contact1.php on line 33
Fatal error: main(): Failed opening required '/home/bay59170/public_html/include/include.php' (include_path='.:/usr/lib/php:/usr/local/lib/php:/usr/lib/php4') in /home/bay59170/public_html/contact1.php on line 33
you can view it at www.baysideliving.com.au/contact1.php
the whole code is:
when it was a html page the code was:
<html>
<head>
<link rel="stylesheet" type="text/css" href="stylesheet1.css">
<title>Bayside Living - contact us</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>
#homebutton {position: absolute; left:135px; top:10px;}
#aboutusbutton {position: absolute; left:315px; top:10px;}
#propertiesbutton {position: absolute; left:490px; top:10px;}
#contactbutton {position: absolute; left:667px; top:10px;}
#contactbackground {position: absolute; left:5px; top:0px; z-index:-1}
#contactform {position: absolute; left:445px; top:200px; z-index:-1}
#contacttext {position: absolute; left:40px; top:150px; z-index:-1}
#contactdetails {position: absolute; left:165px; top:550px; z-index:-1}
</style>
<style type="text/css">
<!--
body{
background:url(images/contact-background2.jpg) no-repeat;
}
//-->
</style>
</head>
<body>
<?php
require_once $_SERVER['DOCUMENT_ROOT']."/include/include.php";
head("Email Me", "Email contact form");
################################################################################
#
# mail.php - general-purpose email form and script
#
# copyright June 2005 by Charles Reace
#
# This software available as open source software under the Gnu General Public
# License: http://www.gnu.org/licenses/gpl.html
#
################################################################################
################################################################################
# user-defined variables - update for your email address(es)
################################################################################
# home page for link at top of page:
$home = "http://www.baysideliving.com.au/";
# Modify the following variables to set up where emails will be sent.
# $toName will be concatenated with a "@" and then $toDomain to create
# the complete email address.
$toName = "Jodie"; # the part that goes before the @
$toDomain = "baysideliving.com.au"; # the part that comes after the @
# uncomment and edit the next two lines if you want to cc someone:
# $ccName = "name";
# $ccDomain = "domain.com";
# uncomment and edit the next two lines if you want to bcc someone:
# $bccName = "name";
# $bccDomain = "domain.com";
#################################
# end of user-defined variables #
#################################
# email address validation function
# kudos to http://iamcal.com/publish/articles/...sing_email/pdf/
function is_valid_email_address($email) {
$qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]';
$dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]';
$atom = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c'.
'\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+';
$quoted_pair = '\\x5c\\x00-\\x7f';
$domain_literal = "\\x5b($dtext|$quoted_pair)*\\x5d";
$quoted_string = "\\x22($qtext|$quoted_pair)*\\x22";
$domain_ref = $atom;
$sub_domain = "($domain_ref|$domain_literal)";
$word = "($atom|$quoted_string)";
$domain = "$sub_domain(\\x2e$sub_domain)*";
$local_part = "$word(\\x2e$word)*";
$addr_spec = "$local_part\\x40$domain";
return preg_match("!^$addr_spec$!", $email) ? 1 : 0;
}
# Init. some variables:
$error = "";
$success = FALSE;
# process form if submitted:
if(isset($_POST['submit']))
{
foreach($_POST as $key => $val)
{
if(empty($_POST[$key]))
{
$error .= "You must enter a value for " .
ucwords(str_replace("_"," ",$key)) . ". ";
}
else
{
if(get_magic_quotes_gpc())
{
$_POST[$key] = stripslashes($val);
}
}
if($key != 'message')
{
$_POST[$key] = preg_replace('/[\r\n]/', ' ', $val);
}
}
if($_POST['email_address'] != $_POST['repeat_email'])
{
$error .= "Email Address is not the same as Repeat Email. ";
}
elseif(is_valid_email_address($_POST['email_address']) == 0)
{
$error .= "'{$_POST['email_address']}' does not appear to be a valid email address. ";
}
if(empty($error)) # no errors in input, so go ahead and email it.
{
$to = "$toName@$toDomain";
$headers = "From: ".preg_replace('/[\r\n]+/',' ', $_POST['email_address']);
if(!empty($ccName) and !empty($ccDomain))
{
$headers .= "\r\nCc: $ccName@$ccDomain";
}
if(!empty($bccName) and !empty($bccDomain))
{
$headers .= "\r\nBcc: $bccName@$bccDomain\r\n\r\n";
}
$headers .= "\r\nX-Mailer: PHP/" . phpversion();
$msg = "From {$_POST['name']} ({$_POST['email_address']})";
$msg .= "\n\n\n{$_POST['message']}";
$result = @mail($to,
stripslashes($_POST['subject']),
$msg,
$headers);
if(!$result)
{
$error = "There was an unknown error while attempting to send your email.";
}
else
{
$error = "<span style='color: #930'>Thank you. Your message has been sent.</span>";
foreach($_POST as $key => $val)
{
$_POST[$key] = "";
}
}
}
}
if(!empty($error))
{
echo "<p style='color: #c03;'>$error</p>\n";
}
?>
<h1>Email Me</h1>
<form action='<?php echo $_SERVER['PHP_SELF'] ?>' method=post>
<fieldset>
<legend>Your Contact Information</legend>
<p><label for='name' style="display: block; float: left; width: 9em;">Name:</label>
<input type='text' name='name' id='name' size='30' maxlength='40'<?php
if(!empty($_POST['name']))
{
echo "value='{$_POST['name']}'";
}
?>></p>
<p><label for='email_address' style="display: block; float: left; width: 9em;">Email Address:</label>
<input type='text' name='email_address' id='email_address' size='30' maxlength='40'<?php
if(!empty($_POST['email_address']))
{
echo "value='{$_POST['email_address']}'";
}
?>></p>
<p><label for='repeat_email' style="display: block; float: left; width: 9em;">Repeat Email:</label>
<input type='text' name='repeat_email' id='repeat_email' size='30' maxlength='40'<?php
if(!empty($_POST['repeat_email']))
{
echo "value='{$_POST['repeat_email']}'";
}
?>></p>
</fieldset>
<fieldset>
<legend>Message</legend>
<p><label for='subject' style="display: block; float: left; width: 9em;">Subject:</label>
<input type='text' name='subject' id='subject' size='50' maxlength='60'<?php
if(!empty($_POST['subject']))
{
echo " value='{$_POST['subject']}'";
}
?>></p>
<p><label for='message'>Message:</label><br>
<textarea name='message' id='message' cols='60' rows='8'
style="width: 500px"><?php
if(!empty($_POST['message']))
{
echo $_POST['message'];
}
?></textarea></p>
<p style="text-align: center;"><input type='submit' name='submit' value="Send Email"></p>
</fieldset>
</form>
<?php
foot();
?>
<div id="homebutton">
<a href="index.htm">
<img src="images/index-button.jpg" border=0>
</a>
</div>
<div id="aboutusbutton">
<a href="aboutus.htm">
<img src="images/aboutus-button.jpg" border=0>
</a>
</div>
<div id="propertiesbutton">
<a href="properties.htm">
<img src="images/properties-button.jpg" border=0>
</a>
</div>
<div id="contactbutton">
<a href="contact.htm">
<img src="images/contact-button.jpg" border=0>
</a>
</div>
<div id="contactdetails">
<font style="arial" size="-1" color="#ffffff">
P.O Box 775 Drummoyne 1470
Phone (02)9719 1123
Fax (02)9719 1128
<a href="mailto:enquire@baysideliving.com.au">
<font color="#ffffff">
<b>
<u>
enquire@baysideliving.com.au
</u>
</b>
</font>
</a>
</font>
</font>
<br>
<br>
<i>Website, graphic design and photography completed by
<a href="http://www.greenlightpromotions.com.au" target="_blank">
<font size="-1" color="#0099FF"><b>GLP</b></font></a></i>
</font>
</div>
</body>
</html>
Warning: main(/home/bay59170/public_html/include/include.php): failed to open stream: No such file or directory in /home/bay59170/public_html/contact1.php on line 33
Fatal error: main(): Failed opening required '/home/bay59170/public_html/include/include.php' (include_path='.:/usr/lib/php:/usr/local/lib/php:/usr/lib/php4') in /home/bay59170/public_html/contact1.php on line 33
you can view it at www.baysideliving.com.au/contact1.php
the whole code is:
when it was a html page the code was:
<html>
<head>
<link rel="stylesheet" type="text/css" href="stylesheet1.css">
<title>Bayside Living - contact us</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>
#homebutton {position: absolute; left:135px; top:10px;}
#aboutusbutton {position: absolute; left:315px; top:10px;}
#propertiesbutton {position: absolute; left:490px; top:10px;}
#contactbutton {position: absolute; left:667px; top:10px;}
#contactbackground {position: absolute; left:5px; top:0px; z-index:-1}
#contactform {position: absolute; left:445px; top:200px; z-index:-1}
#contacttext {position: absolute; left:40px; top:150px; z-index:-1}
#contactdetails {position: absolute; left:165px; top:550px; z-index:-1}
</style>
<style type="text/css">
<!--
body{
background:url(images/contact-background2.jpg) no-repeat;
}
//-->
</style>
</head>
<body>
<?php
require_once $_SERVER['DOCUMENT_ROOT']."/include/include.php";
head("Email Me", "Email contact form");
################################################################################
#
# mail.php - general-purpose email form and script
#
# copyright June 2005 by Charles Reace
#
# This software available as open source software under the Gnu General Public
# License: http://www.gnu.org/licenses/gpl.html
#
################################################################################
################################################################################
# user-defined variables - update for your email address(es)
################################################################################
# home page for link at top of page:
$home = "http://www.baysideliving.com.au/";
# Modify the following variables to set up where emails will be sent.
# $toName will be concatenated with a "@" and then $toDomain to create
# the complete email address.
$toName = "Jodie"; # the part that goes before the @
$toDomain = "baysideliving.com.au"; # the part that comes after the @
# uncomment and edit the next two lines if you want to cc someone:
# $ccName = "name";
# $ccDomain = "domain.com";
# uncomment and edit the next two lines if you want to bcc someone:
# $bccName = "name";
# $bccDomain = "domain.com";
#################################
# end of user-defined variables #
#################################
# email address validation function
# kudos to http://iamcal.com/publish/articles/...sing_email/pdf/
function is_valid_email_address($email) {
$qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]';
$dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]';
$atom = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c'.
'\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+';
$quoted_pair = '\\x5c\\x00-\\x7f';
$domain_literal = "\\x5b($dtext|$quoted_pair)*\\x5d";
$quoted_string = "\\x22($qtext|$quoted_pair)*\\x22";
$domain_ref = $atom;
$sub_domain = "($domain_ref|$domain_literal)";
$word = "($atom|$quoted_string)";
$domain = "$sub_domain(\\x2e$sub_domain)*";
$local_part = "$word(\\x2e$word)*";
$addr_spec = "$local_part\\x40$domain";
return preg_match("!^$addr_spec$!", $email) ? 1 : 0;
}
# Init. some variables:
$error = "";
$success = FALSE;
# process form if submitted:
if(isset($_POST['submit']))
{
foreach($_POST as $key => $val)
{
if(empty($_POST[$key]))
{
$error .= "You must enter a value for " .
ucwords(str_replace("_"," ",$key)) . ". ";
}
else
{
if(get_magic_quotes_gpc())
{
$_POST[$key] = stripslashes($val);
}
}
if($key != 'message')
{
$_POST[$key] = preg_replace('/[\r\n]/', ' ', $val);
}
}
if($_POST['email_address'] != $_POST['repeat_email'])
{
$error .= "Email Address is not the same as Repeat Email. ";
}
elseif(is_valid_email_address($_POST['email_address']) == 0)
{
$error .= "'{$_POST['email_address']}' does not appear to be a valid email address. ";
}
if(empty($error)) # no errors in input, so go ahead and email it.
{
$to = "$toName@$toDomain";
$headers = "From: ".preg_replace('/[\r\n]+/',' ', $_POST['email_address']);
if(!empty($ccName) and !empty($ccDomain))
{
$headers .= "\r\nCc: $ccName@$ccDomain";
}
if(!empty($bccName) and !empty($bccDomain))
{
$headers .= "\r\nBcc: $bccName@$bccDomain\r\n\r\n";
}
$headers .= "\r\nX-Mailer: PHP/" . phpversion();
$msg = "From {$_POST['name']} ({$_POST['email_address']})";
$msg .= "\n\n\n{$_POST['message']}";
$result = @mail($to,
stripslashes($_POST['subject']),
$msg,
$headers);
if(!$result)
{
$error = "There was an unknown error while attempting to send your email.";
}
else
{
$error = "<span style='color: #930'>Thank you. Your message has been sent.</span>";
foreach($_POST as $key => $val)
{
$_POST[$key] = "";
}
}
}
}
if(!empty($error))
{
echo "<p style='color: #c03;'>$error</p>\n";
}
?>
<h1>Email Me</h1>
<form action='<?php echo $_SERVER['PHP_SELF'] ?>' method=post>
<fieldset>
<legend>Your Contact Information</legend>
<p><label for='name' style="display: block; float: left; width: 9em;">Name:</label>
<input type='text' name='name' id='name' size='30' maxlength='40'<?php
if(!empty($_POST['name']))
{
echo "value='{$_POST['name']}'";
}
?>></p>
<p><label for='email_address' style="display: block; float: left; width: 9em;">Email Address:</label>
<input type='text' name='email_address' id='email_address' size='30' maxlength='40'<?php
if(!empty($_POST['email_address']))
{
echo "value='{$_POST['email_address']}'";
}
?>></p>
<p><label for='repeat_email' style="display: block; float: left; width: 9em;">Repeat Email:</label>
<input type='text' name='repeat_email' id='repeat_email' size='30' maxlength='40'<?php
if(!empty($_POST['repeat_email']))
{
echo "value='{$_POST['repeat_email']}'";
}
?>></p>
</fieldset>
<fieldset>
<legend>Message</legend>
<p><label for='subject' style="display: block; float: left; width: 9em;">Subject:</label>
<input type='text' name='subject' id='subject' size='50' maxlength='60'<?php
if(!empty($_POST['subject']))
{
echo " value='{$_POST['subject']}'";
}
?>></p>
<p><label for='message'>Message:</label><br>
<textarea name='message' id='message' cols='60' rows='8'
style="width: 500px"><?php
if(!empty($_POST['message']))
{
echo $_POST['message'];
}
?></textarea></p>
<p style="text-align: center;"><input type='submit' name='submit' value="Send Email"></p>
</fieldset>
</form>
<?php
foot();
?>
<div id="homebutton">
<a href="index.htm">
<img src="images/index-button.jpg" border=0>
</a>
</div>
<div id="aboutusbutton">
<a href="aboutus.htm">
<img src="images/aboutus-button.jpg" border=0>
</a>
</div>
<div id="propertiesbutton">
<a href="properties.htm">
<img src="images/properties-button.jpg" border=0>
</a>
</div>
<div id="contactbutton">
<a href="contact.htm">
<img src="images/contact-button.jpg" border=0>
</a>
</div>
<div id="contactdetails">
<font style="arial" size="-1" color="#ffffff">
P.O Box 775 Drummoyne 1470
Phone (02)9719 1123
Fax (02)9719 1128
<a href="mailto:enquire@baysideliving.com.au">
<font color="#ffffff">
<b>
<u>
enquire@baysideliving.com.au
</u>
</b>
</font>
</a>
</font>
</font>
<br>
<br>
<i>Website, graphic design and photography completed by
<a href="http://www.greenlightpromotions.com.au" target="_blank">
<font size="-1" color="#0099FF"><b>GLP</b></font></a></i>
</font>
</div>
</body>
</html>