You are here: Undefined variable « All PHP « IT news, forums, messages
Undefined variable

Posted by Andy on 10/08/87 11:27

I just installed a program "EasyPHP 1.8 and I am disappointed because same
of my scripts which work on the net do not work on my PC localhost server.
For example following script works perfectly on the net but my EasyPHP shows
so many errors.
I am new to PHP and do not know how to fix this problem. Your help will be
appreciated. Thank You.


Notice: Undefined variable: to in c:\easyphp1-8\www\test.02\mail.php on line
37

Notice: Undefined variable: from in c:\easyphp1-8\www\test.02\mail.php on
line 38

Notice: Undefined variable: email in c:\easyphp1-8\www\test.02\mail.php on
line 39

Notice: Undefined variable: subject in c:\easyphp1-8\www\test.02\mail.php on
line 40

Notice: Undefined variable: message in c:\easyphp1-8\www\test.02\mail.php on
line 41

Notice: Undefined variable: fieldfive in c:\easyphp1-8\www\test.02\mail.php
on line 42

Notice: Undefined variable: fieldsix in c:\easyphp1-8\www\test.02\mail.php
on line 43

Notice: Undefined variable: fieldseven in c:\easyphp1-8\www\test.02\mail.php
on line 44

Notice: Undefined variable: fieldeight in c:\easyphp1-8\www\test.02\mail.php
on line 45

Notice: Undefined variable: fieldnine in c:\easyphp1-8\www\test.02\mail.php
on line 46

Notice: Undefined variable: fieldten in c:\easyphp1-8\www\test.02\mail.php
on line 47




<?

//>----------------------------------------------------------------------------<
//> PHP Mailer Version 1.0
<
//> Copyright 2002 Ray Jones ray@rjj.uk.co
<
//>----------------------------------------------------------------------------<
//> COPYRIGHT NOTICE
<
//> Copyright 2002 Ray Jones All Rights Reserved.
<
//>
<
//> PHP Mailer may be used and modified free of charge by anyone so long
<
//> as this copyright notice and the comments above remain intact. By
using <
//> this code you agree to indemnify Ray Jones from any liability that
might <
//> arise from it's use
<
//>----------------------------------------------------------------------------<
//> CONFIGURE THIS SCRIPT
<
//> To configure this script you will need to:
<
//> Modify the variables in the block - $to through $fieldten so they map
to <
//> your preferred form field names.
<
//> Modify $denyall to 1 if you want to block remote calls to this script,
0 <
//> if you do not.
<
//> Modify $siteurl if deny all is set to 1.
<
//> Modify $autoresponse if to 1 if you want to send autoresponse, 0 if you
do<
//> not.
<
//> Modify $index to point to the customised ad index file you want to use.
<
//> Modify $confsubject and $automessage to suit your needs if autoresponse
is<
//> set to 1.
<
//> Modify any or all of the message files referred to in the script to
suit <
//> your site. These are bademail.html, outside.html,
blankfields.html<
//> thankyou.html and autothankyou.html
<
//> FORM ACTION
<
//> Don't forget to change the URL in your form's action field so it points
to<
//> this file
<
//>----------------------------------------------------------------------------<
//> Set up the scripts variables
<
//>----------------------------------------------------------------------------<

$to = $to;
$from = $from;
$email = $email;
$subject = $subject;
$message = $message;
$fieldfive = $fieldfive;
$fieldsix = $fieldsix;
$fieldseven = $fieldseven;
$fieldeight = $fieldeight;
$fieldnine = $fieldnine;
$fieldten = $fieldten;
$today = date ("l, F jS Y");

//>----------------------------------------------------------------------------<
//> Script options
<
//>----------------------------------------------------------------------------<

$denyall = "1";
$siteurl = "www.car.com";
$callingurl = getenv("HTTP_REFERER");

$autoresponse = "1";
$confsubject = "Confirmation of email sent from widget web site";
$automessage = "This email is to confirm the following message : ";

//>----------------------------------------------------------------------------<
//> Check that the script is being accessed from within it's own site
<
//>----------------------------------------------------------------------------<

if ($denyall == "1") {
$siteurllen = strlen($siteurl);
$striphttp = ereg_replace ("http://", "", $callingurl);
$urltochk = substr($striphttp, 0, $siteurllen);
if ($siteurl != $urltochk) {
readfile("outside.html");
exit;
} else {
}
}

//>----------------------------------------------------------------------------<
//> Check that all fields have been completed
<
//>----------------------------------------------------------------------------<

if (($to == "") || ($from == "") || ($email == "") || ($subject == "") ||
($message == "") || ($fieldfive == "") || ($fieldsix == "") || ($fieldseven
== "") || ($fieldeight == "") || ($fieldnine == "") || ($fieldten == "")) {
readfile("blankfields.html");
exit;
} else {
}

//>----------------------------------------------------------------------------<
//> Check that e-mail address adhere to the minimum format requirements
<
//>----------------------------------------------------------------------------<

if (($email != "")) {
$locationofat = strpos($email, '@');
$locationofdot = strrpos($email, '.');
if (($locationofat == "0") || ($locationofdot < $locationofat) ||
$locationofdot == "0") {
readfile("bademail.html");
exit;
} else {
}
}

//>----------------------------------------------------------------------------<
//> Delete blank fields
<
//>----------------------------------------------------------------------------<

if ($fieldfive == "Blank") {
$fieldfive = "";
}
if ($fieldsix == "Blank") {
$fieldsix = "";
}
if ($fieldseven == "Blank") {
$fieldseven = "";
}
if ($fieldeight == "Blank") {
$fieldeight = "";
}
if ($fieldnine == "Blank") {
$fieldnine = "";
}
if ($fieldten == "Blank") {
$fieldten = "";
}

//>----------------------------------------------------------------------------<
//> Everything checks out ok so send the email
<
//>----------------------------------------------------------------------------<
//> First compile the message body.
<
//> You can arrange these lines in any order you like.
<
//>----------------------------------------------------------------------------<
$msg = "Message\n\n";
$msg .= " $message\n";
if ($fieldfive != "") {
$msg .= " $fieldfive\n";
}
if ($fieldsix != "") {
$msg .= " $fieldsix\n";
}
if ($fieldseven != "") {
$msg .= " $fieldseven\n";
}
if ($fieldeigth != "") {
$msg .= " $fieldeight\n";
}
if ($fieldnine != "") {
$msg .= " $fieldnine\n";
}
if ($fieldten != "") {
$msg .= " $fieldten\n";
}
$msg .= "Sent : $today\n";

//>----------------------------------------------------------------------------<
//> Now send the mail
<
//>----------------------------------------------------------------------------<

$mailheaders = "From: Web Design tools ( $from )<> \n";
$mailheaders .= "Reply-To: $email\n\n";

mail($to, $subject, $msg, $mailheaders);

//>----------------------------------------------------------------------------<
//> Prepare autoresponse if necessary
<
//>----------------------------------------------------------------------------<

if ($autoresponse == "1") {
$to1 = $email;
$email = $to;
$to = $to1;

$subject = $confsubject;

$msg = " $automessage\n\n";
$msg = "Message Sent\n\n";
$msg .= " $message\n";
if ($fieldfive != "") {
$msg .= " $fieldfive\n";
}
if ($fieldsix != "") {
$msg .= " $fieldsix\n";
}
if ($fieldseven != "") {
$msg .= " $fieldseven\n";
}
if ($fieldeigth != "") {
$msg .= " $fieldeight\n";
}
if ($fieldnine != "") {
$msg .= " $fieldnine\n";
}
if ($fieldten != "") {
$msg .= " $fieldten\n";
}
$msg .= "Sent : $today\n";

$mailheaders = "From: Web Design tools ( $email )<> \n";
$mailheaders .= "Reply-To: $email\n\n";

mail($to, $subject, $msg, $mailheaders);

readfile("autothankyou.html");

} else {
readfile("thankyou.html");
}

exit;

 

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

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