|
|
Re: [PHP-INSTALL] FW: Problem with exciting PHP code after new install.: msg#00003
php.install
|
Subject: |
Re: [PHP-INSTALL] FW: Problem with exciting PHP code after new install. |
Amanda E. Lloyd wrote:
------------------------------------------------------------------------
*From:* Amanda E. Lloyd
*Sent:* Friday, October 01, 2004 1:51 PM
*To:* 'php-install@xxxxxxxxxxxxx'
*Subject:* Problem with exciting PHP code after new install.
------------------------------------------------------------------------
*From:* Amanda E. Lloyd
*Sent:* Friday, October 01, 2004 9:23 AM
*To:* 'php-install@xxxxxxxxxxxxxxxxx'
*Subject:* Problem with exciting PHP code after new install.
OS: Windows 2003
PHP Version: 5.0.2
Web Server: IIS 6.0
Running PHP as server Module
I have installed PHP on our web server. Everything seems to look ok. I
am able to pull up the phpinfo.php and my pages that were created on a
hosting site look as if they will work properly. Once I try to submit
the form nothing happens. Its like it is completely skipping over the
php code. I do not receive an error message nor is anything in the log
file.
The hosting site was running PHP Version 4.3.7 I don’t know if this
could have something to do with it or not. I created these pages using
PHP4. I do not have private or public classes declared…
The page contains a form that a user must fill out once they submit
the form the PHP should then check to make sure all of the required
fields are filled in and send an email to the address declared within
the code. The page worked on the hosting site but once I moved it over
to our web server it does not perform the task I have described above.
I am using the php.ini recommended file for configuration. I have only
modified what I have listed below.
I have setup the SMTP server and the send mail from. I don’t know if
some other settings need to be changed…or if my coding in php4 is not
compatible with this version… This is the first time I have ever had
to setup PHP on an IIS web server.
Here is the PHP code below:
<?PHP
if($submit_1){
$full_number = "$number_1.$number_2.$number_3.$number_4";
$completep_number = "$number_11-$number_22-$number_33";
///////////////TEST THE FORM TO SEE THAT ALL REQUIRED INFORMATION HAS
BEEN FILLED IN
///////CHECK FOR THE Requster's Name
if(strlen($s_name) < "1"){$alert = "Requester's Name is a required
Field.";
echo "<script
language=\"javascript\">alert(\"$alert\");history.back()</script>";
exit;}
///////CHECK FOR THE Requster's Email Address
if(strlen($r_email) < "1"){$alert = "Requester's Email Address is a
required Field.";
echo "<script
language=\"javascript\">alert(\"$alert\");history.back()</script>";
exit;}
///////CHECK FOR THE FIRST NAME
if(strlen($f_name) < "1"){$alert = "First Name is a required Field.";
echo "<script
language=\"javascript\">alert(\"$alert\");history.back()</script>";
exit;}
///////CHECK FOR THE Middle Initial
if(strlen($m_initial) < "1"){$alert = "Middle Initial is a required
field. If there is no Middle Initial please place an X in this field.";
echo "<script
language=\"javascript\">alert(\"$alert\");history.back()</script>";
exit;}
///////CHECK FOR THE LAST NAME
if(strlen($l_name) < "1"){$alert = "Last Name is a required Field.";
echo "<script
language=\"javascript\">alert(\"$alert\");history.back()</script>";
exit;}
///////CHECK Y or N if Employee is replacing another employee.
if(strlen($ry_n) < "1"){$alert = "Is the new employee replacing
another employee?";
echo "<script
language=\"javascript\">alert(\"$alert\");history.back()</script>";
exit;}
$rep_name = trim($rep_name);
///////CHECK IF NEW EMPLOYEE IS REPLACING ANOTHER EMPLOYEE
if($ry_n == "Yes"){
if(strlen($rep_name) < "1"){
$alert = "You must enter the name of the person the new employee is
replacing in the correct field";
echo "<script
language=\"javascript\">alert(\"$alert\");history.back()</script>";
exit;
}
}
///////CHECK FOR THE HOME OFFICE
if(strlen($h_office) < "1"){$alert = "Home Office is a required Field.";
echo "<script
language=\"javascript\">alert(\"$alert\");history.back()</script>";
exit;}
///////CHECK FOR THE DEPARTMENT
if(strlen($department) < "1"){$alert = "Department is a required Field.";
echo "<script
language=\"javascript\">alert(\"$alert\");history.back()</script>";
exit;}
///////CHECK FOR EMPLOYEE TITLE
if(strlen($title) < "1"){$alert = "Title is a required Field.";
echo "<script
language=\"javascript\">alert(\"$alert\");history.back()</script>";
exit;}
///////CHECK FOR PHONE #
if(strlen($number_11) < "1"){
$alert = "You must enter a complete phone number that you or the new
employee can be reached at.";
echo "<script
language=\"javascript\">alert(\"$alert\");history.back()</script>";
exit;}
if(strlen($number_22) < "1"){
$alert = "You must enter a complete phone number that you or the new
employee can be reached at.";
echo "<script
language=\"javascript\">alert(\"$alert\");history.back()</script>";
exit;}
if(strlen($number_33) < "1"){
$alert = "You must enter a complete phone number that you or the new
employee can be reached at.";
echo "<script
language=\"javascript\">alert(\"$alert\");history.back()</script>";
exit;}
///////CHECK Y or N if New Employee will require a new computer.
if(strlen($yy_n) < "1"){$alert = "Will a new PC be required?";
echo "<script
language=\"javascript\">alert(\"$alert\");history.back()</script>";
exit;}
//////////IF NO NEW COMPUTER IS REQUIRED THEN IP ADDRESS IS REQUIRED
$full_number = trim($full_number);
///////CHECK IF NEW EMPLOYEE IS REPLACING ANOTHER EMPLOYEE
if($yy_n == "No"){
if(strlen($asset_tag) < "1"){
$alert = "You must enter the Asset Tag #.";
echo "<script
language=\"javascript\">alert(\"$alert\");history.back()</script>";
exit;}
}
//////////YOU CAN ADD MORE TESTS BY COPYING AND PASTING - CHANGING THE
VARIABLE NAMES
/////////////////TELL THE FORM TO EMAIL THE DATA
////////////FUNCTION USED TO SEND THE EMAIL
function sendmail($to,$from,$subject,$body,$html,$r_email){
$recipient = "$to";
$subject = "$subject";
$message = "$body";
$headers = "From: $s_name\n";
$headers .= "X-Mailer: myMail($sys_host)\n"; //mailer
$headers .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal
if($html == "true"){
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; }
$headers .= "Cc: $r_email\r\n";
#$headers .= "Bcc: @something.com\r\n";
$additional = "-f$from";
mail ($recipient, $subject, $message, $headers, $additional);
}
///////////ENTER WHO THE EMAIL IT TO BE SENT TO, WHO IT IS COMMING
FROM AND THE SUBJECT LINE OF THE EMAIL
$to = "support@xxxxxxxxxxxxx";
$from = $s_name;
$subject = "$f_name $l_name \"NARF\" ";
$html = "true";
//////////////////THE MESSAGE WILL CONTAIN ALL OF THE USER ENTERED
INFORMATION
$body = "
=====================================================
Requesters Name: $s_name
Requesters Email: $r_email
=====================================================
New Employee Information will be listed below:
_____________________________________________________
First Name: $f_name
Middle Initial: $m_initial
Last Name: $l_name
_____________________________________________________
Is this person replacing a terminated employee? $ry_n
Name of the person being replaced: $rep_name
_____________________________________________________
_____________________________________________________
Email Address: $e_address
Phone#: $completep_number
Home Office: $h_office
Department: $department
Title: $title
_____________________________________________________
_____________________________________________________
New PC Required? $yy_n
IP Address: $full_number
Asset Tag: (FSB) $asset_tag
_____________________________________________________
_____________________________________________________
Additional Information: $add_info
_____________________________________________________
";
////////////CALL TO FUNCTION THAT SENDS THE MAIL
////////////I HAVE IT COMMENTED OUT SO IT DOESNT SEND ONE ACCIDENTALLY
sendmail($to, $from, $subject, $body, $html, $r_email);
//////////END OF IF SUBMIT
}
?>
</font>
</body>
</html>
I have also attached a copy of the php configuration file.
Any help with this would be great as I have been working on this
problem for 1 week now.
Thanks,
**Amanda Lloyd**
FSB IT Services
alloyd@xxxxxxxxxxxxx <mailto:alloyd@xxxxxxxxxxxxx>
Hi Amanda,
register_globals is not on by default any more so your "if ($submit_1)"
will always be false as $submit_1 does not exist. So you will need to
either:
1. turn on register globals in php.ini (not really a good idea)
2. use $_GET['varname'] or $_POST['varname'] or $_REQUEST['varname'] to
refer to your from variables
3. place extract($_REQUEST) at start of the script which will make all
GET, POST and Cookie data available as variables in the current scope.
Hope this helps you out.
Cheers,
Brad
--
|> Brad Kowalczyk
|> Web Developer
|> brad@xxxxxxxxxxxx
|> www.ibiscode.com
smime.p7s
Description: S/MIME Cryptographic Signature
|
|