Jump to content

Parse error: parse error in d:\Customers\user1180256\www\pages\search.php on lin


mastercool

Recommended Posts

When I conduct a search on my site I receive the error: Parse error: parse error in d:\Customers\user1180256\www\pages\search.php on line 103

 

below is the code from the search.php page. any insight would be greatly appreciated. i am extremely new to php coding and have used the existing code from our previous search page for this new one.

 

<html>
<head>
<title>Mastercool Inc., Search</title>
</head>

<body background="../media/gradient_dark.png" link="#003366">
<table width="691" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td colspan="3"><img src="../media/header.gif" alt="" height="100" width="700" usemap="#headerc2dc93f3" border="0"><map name="headerc2dc93f3"><area shape="rect" coords="10,10,270,71" href="http://www.mastercool.com" alt=""></map></td>
</tr>
<tr>
<td colspan="3" nowrap bgcolor="#003366">
<div align="center">
<menumachine name="mastercoolmenu071607" id="m26v3267">
<csobj t="Component" csref="../menumachine/mastercoolmenu071607/menuspecs.menudata"><noscript>
<p><a class="mm_no_js_link" href="../menumachine/mastercoolmenu071607/navigation.html">Site Navigation</a></p>
</noscript> </csobj> 
<script type="text/javascript"><!--
var mmfolder=/*URL*/"../menumachine/",zidx=1000;
//--></script>
<script type="text/javascript" src="../menumachine/menumachine2.js"></script>
<script type="text/javascript" src="../menumachine/mastercoolmenu071607/menuspecs.js"></script>
</menumachine>
</div>
</td>
</tr>
<tr bgcolor="#999999">
<td colspan="3" nowrap bgcolor="#999999">
<table width="70%" border="0" cellspacing="0" cellpadding="2" align="right" bgcolor="#edf8fe">
<form action="search.php" method="get">
<tr>
<td align="right" class="search" nowrap bgcolor="#999999" width="62%">
<div align="right">
<font size="1" color="#003366" face="Arial, Helvetica, Geneva, Arial, SunSans-Regular, sans-serif"><b>SEARCH</b></font><font size="1">  </font></div>
</td>
<td bgcolor="#999999" width="135">
<div align="center">
<input type="text" name="keyword" size="20" maxlength="40" class="input"></div>
</td>
<td align="left" bgcolor="#999999">
<div align="left">
<input type="image" src="../media/search_icon.gif" class="inputs"></div>
</td>
</tr>
</form>
</table></td>
</tr>
<tr bgcolor="#999999">
<td colspan="3" nowrap bgcolor="white"><?php
$keyword = $found = $count = $file = $filescope = 0; 
$titl = array();
$keyword = @$HTTP_GET_VARS['keyword'];
if ($keyword and strlen($keyword) > 2) : ?>
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="20" align="center" class="tabletitle"></td>
<td width="2" align="center" class="tabletitle"></td>
<td height="22" align="center" class="tabletitle">   <font color="black">search result(s) for word:</font>  <b><? echo $keyword ?></b></td>
</tr>
<tr>
<td height="2" colspan="3"></td>
</tr>
<tr>
<td></td>
<td colspan="2" class="txt">    found on page(s)</td>
</tr>
<?php
if(!isset($_SERVER["DOCUMENT_ROOT"])) {
$_SERVER["DOCUMENT_ROOT"]=substr($_SERVER['PATH_TRANSLATED'] , 0 , -strlen($_SERVER['PHP_SELF'])+1 );
}

$DOCROOT = $_SERVER['DOCUMENT_ROOT'];
$patch=opendir($DOCROOT);

while ($file = readdir($patch)) :
$tmpfile = $DOCROOT . $file;
    if (is_file($tmpfile) and preg_match("/.*\.html/i", $tmpfile)) {
	$fop = fopen($tmpfile, "r");
	$search = fread($fop, filesize($tmpfile));
	fclose($fop);
	$filecope2 = $search;
	$search = preg_replace("/<option.*>(.*)\n/i", "", $search);
	$search = strip_tags($search, "<title>");
	$filecope = $search;
	if (preg_match("/\s($keyword)\s/i", $search, $result)) {
//			echo $result[1];/\<title\>(+*)\</i
		if (!$found) { $found="yes"; }
		preg_match("/<title>(.*)/i", $filecope2, $result);
?><!--  -->
<tr>
<td height="6" colspan="3"></td>
</tr>
<tr>
<td align="center" class="count"><?php 
		$count++; 
		echo $count; ?></td>
<td></td>
<td>   <a href="<?php echo $file ?>"><?php=$result[1]?></a> </td>
</tr>
<tr>
<td height="6" colspan="3"></td>
</tr>
<?php 
	}
}
endwhile;

closedir($patch); 

if (!$found) : ?>
<tr>
<td height="5" colspan="3"></td>
</tr>
<td colspan="3" class="txt"><b>The required word is not found</b></td>

</tr>
<?php endif; ?>
<tr>
<td height="5" colspan="3"></td>
</tr>
<tr>
<td colspan="3"><img src="../media/index_bottom_rule.jpg" alt="" height="19" width="700" border="0"></td>
</tr>
<tr>
<td><font size="1" color="black" face="Arial, Helvetica, Geneva, Arial, SunSans-Regular, sans-serif">© Mastercool Inc. 2007</font></td>
<td></td>
<td>
<table width="180" border="0" cellspacing="0" cellpadding="3" align="right">
<tr>
<td><font size="1" color="#003366" face="Arial, Helvetica, Geneva, Arial, SunSans-Regular, sans-serif"><a href="featured_items.html">Featured Items</a></font></td>
<td><font size="1" color="#003366" face="Arial, Helvetica, Geneva, Arial, SunSans-Regular, sans-serif"><a href="sitemap.html">Site Map</a></font></td>
</tr>
<?php endif; ?>	 
</table>
</body>

</html>

 

EDITED BY akitchin:  use code tags, it's the law.

Link to comment
Share on other sites

Try this:

 

<html>
<head>
<title>Mastercool Inc., Search</title>
</head>

<body background="../media/gradient_dark.png" link="#003366">
<table width="691" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td colspan="3"><img src="../media/header.gif" alt="" height="100" width="700" usemap="#headerc2dc93f3" border="0"><map name="headerc2dc93f3"><area shape="rect" coords="10,10,270,71" href="http://www.mastercool.com" alt=""></map></td>
</tr>
<tr>
<td colspan="3" nowrap bgcolor="#003366">
<div align="center">
<menumachine name="mastercoolmenu071607" id="m26v3267">
<csobj t="Component" csref="../menumachine/mastercoolmenu071607/menuspecs.menudata"><noscript>
<p><a class="mm_no_js_link" href="../menumachine/mastercoolmenu071607/navigation.html">Site Navigation</a></p>
</noscript> </csobj> 
<script type="text/javascript"><!--
var mmfolder=/*URL*/"../menumachine/",zidx=1000;
//--></script>
<script type="text/javascript" src="../menumachine/menumachine2.js"></script>
<script type="text/javascript" src="../menumachine/mastercoolmenu071607/menuspecs.js"></script>
</menumachine>
</div>
</td>
</tr>
<tr bgcolor="#999999">
<td colspan="3" nowrap bgcolor="#999999">
<table width="70%" border="0" cellspacing="0" cellpadding="2" align="right" bgcolor="#edf8fe">
<form action="search.php" method="get">
<tr>
<td align="right" class="search" nowrap bgcolor="#999999" width="62%">
<div align="right">
<font size="1" color="#003366" face="Arial, Helvetica, Geneva, Arial, SunSans-Regular, sans-serif"><b>SEARCH</b></font><font size="1">  </font></div>
</td>
<td bgcolor="#999999" width="135">
<div align="center">
<input type="text" name="keyword" size="20" maxlength="40" class="input"></div>
</td>
<td align="left" bgcolor="#999999">
<div align="left">
<input type="image" src="../media/search_icon.gif" class="inputs"></div>
</td>
</tr>
</form>
</table></td>
</tr>
<tr bgcolor="#999999">
<td colspan="3" nowrap bgcolor="white"><?php
$keyword = $found = $count = $file = $filescope = 0; 
$titl = array();
$keyword = @$HTTP_GET_VARS['keyword'];
if ($keyword and strlen($keyword) > 2) : ?>
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="20" align="center" class="tabletitle"></td>
<td width="2" align="center" class="tabletitle"></td>
<td height="22" align="center" class="tabletitle">   <font color="black">search result(s) for word:</font>  <b><? echo $keyword ?></b></td>
</tr>
<tr>
<td height="2" colspan="3"></td>
</tr>
<tr>
<td></td>
<td colspan="2" class="txt">    found on page(s)</td>
</tr>
<?php
if(!isset($_SERVER["DOCUMENT_ROOT"])) {
$_SERVER["DOCUMENT_ROOT"]=substr($_SERVER['PATH_TRANSLATED'] , 0 , -strlen($_SERVER['PHP_SELF'])+1 );
}

$DOCROOT = $_SERVER['DOCUMENT_ROOT'];
$patch=opendir($DOCROOT);

while ($file = readdir($patch)) :
$tmpfile = $DOCROOT . $file;
    if (is_file($tmpfile) and preg_match("/.*\.html/i", $tmpfile)) {
	$fop = fopen($tmpfile, "r");
	$search = fread($fop, filesize($tmpfile));
	fclose($fop);
	$filecope2 = $search;
	$search = preg_replace("/<option.*>(.*)\n/i", "", $search);
	$search = strip_tags($search, "<title>");
	$filecope = $search;
	if (preg_match("/\s($keyword)\s/i", $search, $result)) {
//			echo $result[1];/\<title\>(+*)\</i
		if (!$found) { $found="yes"; }
		preg_match("/<title>(.*)/i", $filecope2, $result);
?><!--  -->
<tr>
<td height="6" colspan="3"></td>
</tr>
<tr>
<td align="center" class="count"><?php 
		$count++; 
		echo $count; ?></td>
<td></td>
<?php echo "<td>   <a href='$file'>$result[1]</a> </td>"; ?>
</tr>
<tr>
<td height="6" colspan="3"></td>
</tr>
<?php 
	}
}
endwhile;

closedir($patch); 

if (!$found) : ?>
<tr>
<td height="5" colspan="3"></td>
</tr>
<td colspan="3" class="txt"><b>The required word is not found</b></td>

</tr>
<?php endif; ?>
<tr>
<td height="5" colspan="3"></td>
</tr>
<tr>
<td colspan="3"><img src="../media/index_bottom_rule.jpg" alt="" height="19" width="700" border="0"></td>
</tr>
<tr>
<td><font size="1" color="black" face="Arial, Helvetica, Geneva, Arial, SunSans-Regular, sans-serif">© Mastercool Inc. 2007</font></td>
<td></td>
<td>
<table width="180" border="0" cellspacing="0" cellpadding="3" align="right">
<tr>
<td><font size="1" color="#003366" face="Arial, Helvetica, Geneva, Arial, SunSans-Regular, sans-serif"><a href="featured_items.html">Featured Items</a></font></td>
<td><font size="1" color="#003366" face="Arial, Helvetica, Geneva, Arial, SunSans-Regular, sans-serif"><a href="sitemap.html">Site Map</a></font></td>
</tr>
<?php endif; ?>	 
</table>
</body>

</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.