hello people

I Have this error mssg can anybody help me see what i am not seeing here that is wrong? thanks


Parse error: syntax error, unexpected $end in /home/www/t.php on line 434

this is my php page

<?php
session_start();
/******************************************************************************
*                                                                             *
*                                                                             *
*                                                                             *
******************************************************************************/

/******************************************************************************
*                                                                             *
*                                                                             *  
*                                                                             *
*                                                                             *
*                                                                             *
*                                                                             *
*                                                                             *
******************************************************************************/
include('myconfig.php');
include('../Connections/recruit.php');
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; 					  
//check certification					  
$certification = $HTTP_POST_VARS['certification'];					  
if($certification != "accept")					 
{		 echo(" Your application has been terminated as a result of uncertified information!");?> </font></div>
                        

<? end;					  
} 
else{					  
//post time					  
$date_posted = date ("l, jS of , Y h:i:s A");
include('response.php');
if(isset($_POST['Submit']))
{
if(($_POST['check']) == $_SESSION['check']) { 
echo '<br>';
}else{ 
echo '<center><font face=" verdana, tahoma" font size="-2">Input Wrong<BR>';
echo '<a href="javascript:history.go(-1)">Go Back</a></font></center>'; 
die;
        }
$subject = $_POST['subject'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$address = $_POST['address'];
$fax = $_POST['fax'];
$phone = $_POST['phone'];
$website = $_POST['website'];
$emaile = $_POST['emaile'];
$comments = $_POST['comments'];
$time = date ("h:i A"); 
$date = date ("l, F jS, Y");
$name=array($subject,$firstname,$lastname,$city,$state,$zip,$address,$fax,$phone,$website,$comments);
foreach ($name as $name) 
{
if (ereg("^\.",$name)) {
echo "<center>Invalid Characters:<a href=\"javascript:history.go(-1)\">Go Back</a></center>";  
 Die();
}
if (ereg("\<", $name)) {
echo "<center>Invalid Characters: <font color = \"red\"><strong><</strong></font> <a href=\"javascript:history.go(-1)\">Go Back</a></center>";  
 Die();
}
if (ereg("\>", $name)) {
echo "<center>Invalid Characters: <font color = \"red\"><strong>></strong></font> <a href=\"javascript:history.go(-1)\">Go Back</a></center>";  
 Die();
}
if (ereg("\[", $name)) {
echo "<center>Invalid Characters: <font color = \"red\"><strong>[</strong></font> <a href=\"javascript:history.go(-1)\">Go Back</a></center>";  
 Die();
}
if (ereg("\]", $name)) {
echo "<center>Invalid Characters: <font color = \"red\"><strong>]</strong></font> <a href=\"javascript:history.go(-1)\">Go Back</a></center>";  
 Die();
}
if (ereg("\quot", $name)) {
echo "<center>Invalid Characters:<a href=\"javascript:history.go(-1)\">Go Back</a></center>";  
 Die();
}
}
if (strlen($name) < 3) {
echo "<center>Field must be at least 3 characters long:
<a href=\"javascript:history.go(-1)\">Go Back</a></center>";  
 Die();
}
if (strlen($name) > 120) {
echo "<center>Max Characters in Field: 120
<a href=\"javascript:history.go(-1)\">Go Back</a></center>";  
 Die();
}
/////////////////////
$current_file=$_FILES['file']['name'];
$extension = substr(strrchr($current_file, '.'), 1);
if (($extension!= "txt") && ($extension != "doc"))  
{
die('Unknown extension');
}
$time = date("fYhis");
$new_file = $time . "." . $extension;
$destination="uploads/".$new_file;
$action = copy($_FILES['file']['tmp_name'], $destination);
if (!$action) 
{
die('File copy failed');
}else{
//echo "File copy successful";
}
echo"<br>";


echo "<center><font size=\"1\" font face=\"tahoma\">&nbsp;&nbsp;Thank you for contacting us. We have received your information and we will get back to you as quickly as possible.</b>";

/////////////////////
$headers='MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf8' . "\r\n";
$headers .= 'From: System <noreply@example.com>' . "\r\n";
$body = "
Contact Message<br> <br> 
Message:$comments<br> $date at $time.<br> From E Address: $emaile
<br> First Name: $firstname
<br> Last Name: $lastname
<br> City: $city
<br> State: $state
<br> Zip: $zip\n\n
<br> Address: $address
<br> Fax: $fax
<br> Phone: $phone
<br> Website: $website
<br> File: $path/$new_file
"; 

mail($email, $subject, $body, $headers);
mail($emaile, $subject, $bodys, $headers);
include('config.php');
if (get_magic_quotes_gpc()) {
$subject = addslashes($subject);
$firstname = addslashes($firstname);
$lastname = addslashes($lastname);
$city = addslashes($city);
$state = addslashes($state);
$zip = addslashes($zip);
$address = addslashes($address);
$fax = addslashes($fax);
$phone = addslashes($phone);
$website = addslashes($website);
$emaile = addslashes($emaile);
$comments = addslashes($comments);
$newfile = addslashes($new_file);
}
$subject = mysql_real_escape_string($subject);
$firstname = mysql_real_escape_string($firstname);
$lastname = mysql_real_escape_string($lastname);
$city = mysql_real_escape_string($city);
$state = mysql_real_escape_string($state);
$zip = mysql_real_escape_string($zip);
$address = mysql_real_escape_string($address);
$fax = mysql_real_escape_string($fax);
$phone = mysql_real_escape_string($phone);
$website = mysql_real_escape_string($website);
$emaile = mysql_real_escape_string($emaile);
$comments = mysql_real_escape_string($comments);
$newfile = mysql_real_escape_string($new_file);
$result = mysql_query("INSERT INTO files 
(subject,firstname,lastname,city,state,zip,address,fax,phone,website,emaile,comments,newfile,date_posted) 
VALUES 
('$subject','$firstname','$lastname','$city','$state','$zip','$address','$fax','$phone','$website','$emaile','$comments','$new_file','$date_posted')")
or die(mysql_error());
session_destroy(); 
}else{
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="PHPForm.net" />
<title><?php echo $title; ?></title>
<SCRIPT LANGUAGE="JavaScript">
function checkEmail(myForm) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.emaile.value)){
return (true)
}
alert("Invalid E-mail Address! Please re-enter.")
return (false)
}
//  End -->
</script>
<style>
#ST_able{
font-family: tahoma;
font-size: 12px;
color:#808080;
}
</style>
</head>
<form name="myForm" enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" onSubmit="return checkEmail(this)">
<table align="center" id="ST_able" width="444" cellSpacing=0 cellPadding=0 border="0">
<tr>
  <td>
<h3 style="font-family: tahoma;color:#F27E02"><?php echo $title; ?></h3>
  </td>
</tr>
<tr>
  <td>&nbsp;</td>
</tr>
<tr>
  <td>
<?
//start session
  session_start();	
  //pass post data into session variables
  $HTTP_SESSION_VARS['stitle'] = addslashes($HTTP_POST_VARS['title']);
  $HTTP_SESSION_VARS['sfirstname'] = addslashes($HTTP_POST_VARS['firstname']);
  $HTTP_SESSION_VARS['smiddlename'] = addslashes($HTTP_POST_VARS['middlename']);
  $HTTP_SESSION_VARS['ssurname'] = addslashes($HTTP_POST_VARS['surname']);
  
?>
 
        <table width="780" border="0" cellpadding="0" cellspacing="2" id="table1">
    <tr> 
      <td height="27"> <div align="center"> 
          <table width="96%" border="1" cellpadding="2" cellspacing="0" bordercolor="#CCCCCC" id="table2">
            <tr> 
              <td height="25"> <div align="center"> 
                  <table width="1021" border="0" cellpadding="2" cellspacing="2" bgcolor="#FFFFFF" id="table3">
                    <tr> 
                      <td width="11%" height="26" bgcolor="#CCCCCC"> 
						<img border="0" src="../images/Epic%20Logo.jpg" width="111" height="83"></td>
                      
                      <td width="88%" height="26" bgcolor="#CCCCCC"> <div align="left">
                          <table border=0 cellspacing=0 cellpadding=0 width="860" id="table4">
                            <tr>
                              <td width=217 bgcolor="#CCCCCC">&nbsp;</td>
                              <td width=170 bgcolor="#006699">&nbsp;<script language=JavaScript 
      src="../scripts/vnu_datestamp.js"></script></td>
                              <td width="69" align="center" bgcolor="#FFFFFF"><font color="#000066" size="2" face="arial">
								Step 1</font></td>
                              <td width="18" bgcolor="#006699">&nbsp;</td>
                              <td width="86" align="center" bgcolor="#FFFFFF"><font color="#000066" size="2" face="arial">
								Step 2</font></td>
                              <td width="16" bgcolor="#006699">&nbsp;</td>
                              <td width="104" align="center" bgcolor="#FFFFFF"><font color="#000066" size="2" face="arial">
								Step 3</font></td>
                              <td width="17" bgcolor="#006699">&nbsp;</td>
                              <td width="97" align="center" bgcolor="#FF0000"><font color="#FFFFFF" size="2" face="arial">
								Step 4</font></td>
                              <td width="16" bgcolor="#006699">&nbsp;</td>
                            </tr>
                            <tr> 
                              <td height="1" colspan="10" bgcolor="#CCCCCC">
								<table height="1" width="100%" border="0" cellspacing="0" cellpadding="0" id="table5">
                                  <tr>
                                    <td> </td>
                                  </tr>
                                </table></td>
                            </tr>
                          </table>
                          
                        </div>
                      </td>
                      
                    </tr>
                    <tr> 
                      <td height="121" bgcolor="#999999" valign="top" colspan="2"> 
                        <blockquote> 
                          <div align="left">
                              <table width="571" border="0" cellspacing="3" cellpadding="3" id="table6">
                                <tr> 
                                  <td colspan="2" bgcolor="#000066">&nbsp;<font size="2" face="arial" color="#FFFFFF"><b>Step 
									4: Review &amp; Certification</b></font></td>
                                </tr>
                                <tr bgcolor="#66CC00"> 
                                  <td colspan="2" bgcolor="#006699">&nbsp;<font size="2" face="arial" color="#000066"><b>Review: </b>
									(Please review the information you supplied 
									below)</font></td>
                                </tr>
                                <tr bgcolor="#666666"> 
                                  <td colspan="2"><font color="#FFFFFF">&nbsp;<font size="2" face="arial"><b>Personal 
									Data</b></font></font></td>
                                </tr>
                                <tr> 
                                  <td width="140">
									<font face="Arial" color="#000066" size="2">
									Title: Mr/Mrs/Miss</font></td>
                                  <td width="410">&nbsp;&nbsp;<font size="2" face="arial" color="#000066">&nbsp;<? echo $HTTP_SESSION_VARS['stitle']; ?> </font></td>
                                </tr>
                                <tr> 
                                  <td width="140">
									<font size="2" face="arial" color="#000066">First 
									name: </font></td>
                                  <td width="410">&nbsp;&nbsp;<font size="2" face="arial" color="#000066">&nbsp;<? echo $HTTP_SESSION_VARS['sfirstname']; ?> </font> </td>
                                </tr>
                                <tr> 
                                  <td>
									<font face="Arial" size="2" color="#000066">Middle Name:</font></td>
                                  <td>&nbsp;&nbsp;<font size="2" face="arial" color="#000066">&nbsp;<? echo $HTTP_SESSION_VARS['smiddlename']; ?> </font></td>
                                </tr>
                                <tr> 
                                  <td>
									<font size="2" face="arial" color="#000066">Surname: </font></td>
                                  <td>&nbsp;&nbsp;<font size="2" face="arial" color="#000066">&nbsp;<? echo $HTTP_SESSION_VARS['ssurname']; ?> </font></td>
                                </tr>
                                </table>
                             
                              <table width="959" border="0" cellspacing="3" cellpadding="3" id="table7">
                                <tr> 
                                  <td bgcolor="#666666">
									<font color="#FFFFFF"><b>Legal Documents:</b></font></td>
                                </tr>
                                <tr>
  <td width="160" valign="top">File(*doc *txt)</td>
  <td><input type="file" name="file" ></td>
								</tr>
								<tr>
<td width="160"><img src="captchas.php"> *</td>

<td><input type="text" style="font-size: 12px; font-family: tahoma,arial; font-weight: normal; color: #808080; BORDER: #808080 1px solid; BACKGROUND-COLOR: #FFFFFF" input name="check" size="30"></td>
								</tr>
								<tr>
  <td>
  </td>
  <td>
&nbsp; 
  </td>
								</tr>
                              </table>
                              <table width="680" border="0" cellspacing="3" cellpadding="3" id="table8">
                                <tr> 
                                  <td><div align="center"></div></td>
                                </tr>
                              </table>
                              <table width="500" border="0" cellspacing="3" cellpadding="3" id="table9">
                                <tr> 
                                  <td bgcolor="#006699"><font color="#000066" size="2" face="arial"><b>
									Certification:</b> This is required for your 
									application to be sent. Check accordingly)</font></td>
                                </tr>
                                <tr> 
                                  <td><font color="#000066" size="2" face="arial">
									I certify that the information supplied in 
									this application are true and correct to the 
									best of my knowledge.<br>
                                    I understand that any deception and 
									misleading statements of material facts in 
									this application or examination process may 
									cause the forfeiture of all rights to my 
									employment or immediate termination if 
									discovered after employment.<br>
                                    <br>
									<label>  
                                    <input type="radio" name="certification" value="accept" checked /> 
									accept</label> <br /> <label> 
                                    <input type="radio" name="certification" value="decline" />
                                    decline</label>
									<vlvalidator name="CertReq" type="required" control="certification" errmsg="You must certify your entry to complete submission!"> 
                                    <vllabel class="default" errclass="defaultErr" validators="CertReq"></vllabel>
                                    </font> &nbsp; 
                                    </td>
                                </tr>
                                <tr>
                                  <td>&nbsp;
<INPUT TYPE="SUBMIT" name="Submit" VALUE="Submit"><INPUT TYPE="RESET" name="reset" VALUE="Reset"></td>
                                </tr>
                                <tr> 
                                  <td><font color="#FF0000" size="2" face="Arial, Helvetica, sans-serif"><vlsummary class="defaultErr" headertext="The following error(s) will prevent your applicaion from being submitted" displaymode="bulletlist"></font></td>
                                </tr>
                              </table>
                              <p>&nbsp;</p>
                              <p>&nbsp;</p>
                            
                          </div>
						  
                        </blockquote></td>
                    </tr>
                    <tr> 
                      <td height="23" background="../online_application/images/cogbg.gif" bgcolor="#FFFFFF">&nbsp;</td>
                      <td height="23" background="../online_application/images/cogbg.gif" bgcolor="#FFFFFF">&nbsp;
						</td>
                    </tr>
                  </table>
                </div></td>
            </tr>
          </table>
        </div></td>
    </tr>
    <tr> 
      <td height="27">
		<table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#999999" bgcolor="#FFFFFF" id="table10">
          <tr> 
            <td><div align="center"> 
                <table width="100%" border="0" cellspacing="0" cellpadding="3" id="table11">
                  <tr> 
                    <td bgcolor="#000066"><div align="center">
						<font size="1" face="verdana" color="#FF0000">© All Rights Reserved.</font></div></td>
                  </tr>
                  <tr> 
                    <td bgcolor="#006699"><div align="center">
						<font color="#FFFFFF" size="1" face="Verdana">
						Site by&nbsp; </font>
						<font color="#FF0000" size="1" face="Verdana">
						<a href="http://www.xphicis.com/" style="text-decoration: none; color: #000055">
						<font color="#FFFFFF">phicis</font></a></font><font color="#FFFFFF" size="1" face="Verdana"> </font></div></td>
                  </tr>
                </table>
              </div></td>
          </tr>
        </table></td>
    </tr>
    <tr> 
      <td height="15"></td>
    </tr>
  </table>
  </td>
</tr>
<tr>
  <td>
<a style="font-size: 10px; font-family: tahoma,arial; font-weight: normal; color: #ccc;" href="http://c.net">
c.net</a>
  </td>
</tr>
</table>
</form>

<!-- Form ends -->
<br>

</font>
</body>
</html>
<?php
}
?>

Where did your first PHP tag close? And check out line 27..

This might not have anything to do with your problem, but you didn't start the "<body>" tag.

Member Avatar for diafol

Ensure that your open braces ({) are equal to the same number of closed braces (}). Count 'em up.

I am new to php,just did a couple of things to get here, can someone read this script for me and locate where this open/close braces is missing?
thank you

Member Avatar for diafol

WHy is it easier for us to count them than for you to do so? You're having a laugh mate.

A quick count from my editor reveals 23 opening and 22 closing brackets. So you definitely got an issue there.

Beyond that I see a lot of other issues.

  1. include is not a function it is a language construct and does not need the parenthesis around the string.
  2. Line 22: $HTTP_POST_VARS has been deprecated since PHP 4.1.0 by $_POST
  3. Line 24: echo is not a function it is a language construct and does not need the parenthesis around the string.
  4. Line 27: end; is not a language construct or a function. Perhaps this should be exit, die or return?
  5. Line 57: Your foreach is iterating over the $name array and creating a local variable called $name
  6. ereg is deprecated as of PHP 5.3 and while it will continue to work refactoring to use preg functions is recommended
  7. Try to keep your function case correct. e.g. use die() instead of Die()
  8. Line 212: Watch having session_start so deep in your code as any output before that call will cause php to error
  9. $HTTP_SESSION_VARS is deprecated in lieu of $_SESSION
  10. Line 287: Use caution with php short tags (<? ?>) as they are not always enabled by default. In your usage you're already using the proper code to echo a variable in tags like <?php ?> If you intend to continue using the short tags use the short echo syntax: <?=$variable?>

A quick run through your code and those are things I noticed. Some are just constructive advice and others will actually cause you errors.

addslashes to response.php

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.