Question : PHP Array Syntax Issue

I have a broken search page here:

http://greenwashingindex.com/search.php?

Depending on what browser you use, you will either see the header of the page and then nothing after it, or you will see nothing at all.

I've tracked the problem down to this line:

$adsList = $ads->GetList(array(array("adId",">",0)));

I think there is something wrong with it but am not sure what Eclipse is not giving me any errors.

I've attached the code of the entire page if that will help .

Any suggestions would be greatly appreciated. I have a very tight deadline on this issue.

Thanks,
Lisa

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
<?php 

$pageClass = "ads"; 
$pageTitle = "Search Results";
include("header.php");

$ads = new Ad();
$adsList = $ads->GetList(array(array("adId",">",0)));

$top_results = array();
$other_results = array();
$bottom_results = array();
$used_values = array();
?>

			<div id="content">

<?php
foreach ($adsList as $theAd) {
	
	$tags_array = explode(",",$theAd->tags);
	foreach($tags_array as $theTag) {

		$tag = new Tag();
		$tag->Get($theTag);
		if (strtolower($tag->tagText) == strtolower($_GET['s']) || strtolower($theAd->companyName) == strtolower($_GET['s'])) {
			array_push($top_results,$theAd);		
			array_push($used_values,$theAd->adId);	
		}//close if
	}//close foreach tag
	
}//close if in tags or company name
	
foreach ($adsList as $theAd) {
		
		if (strpos(strtolower($theAd->Title), strtolower($_GET['s'])) || strpos(strtolower($theAd->Description), strtolower($_GET['s']))) {
			
			if (!in_array($theAd->adId,$used_values)) {
				array_push($other_results,$theAd);
				array_push($used_values,$theAd->adId);
			}//close if
	
		}//close if in title or description
}//close foreach

$search_terms = explode(" ", $_GET['s']);
foreach ($adsList as $theAd) {
	foreach($search_terms as $term) {
		
		if (strpos(strtolower($theAd->Title), strtolower($term)) || strpos(strtolower($theAd->Description), strtolower($term))) {
			
			if (!in_array($theAd->adId,$used_values)) {
				array_push($bottom_results,$theAd);
				array_push($used_values,$theAd->adId);
			}//close if
	
		}//close if in title or description
	}//close foreach search term
}//close foreach

$all_results = array_merge($top_results,$other_results);

?>	

<?php
if (count($all_results) > 0 && count($bottom_results) > 0) {
?>
<h3>Top Results for <?php echo $_GET['s'] . " (" . count($all_results); ?>)</h3>
<?php
}//close if
elseif (count($all_results) > 0) {
?>
<h3>Search Results for <?php echo $_GET['s'] . " (" . count($all_results); ?>)</h3>
<?php	
}


	foreach ($all_results as $theAd) {

		$ratings = new Rating();
		$ratingsList = $ratings->GetList(array(array("AdId","=",$theAd->adId)));
		
		$submitter = new User();
		$submitter->Get($theAd->PostedBy);
	?>			
									<dl>
										<dt><a href="ad_single.php?id=<?php echo $theAd->adId; ?>" title="<?php echo $theAd->Title; ?>"><?php echo $theAd->Title; ?></a></dt>
										
										<dd class="image"><a href="ad_single.php?id=<?php echo $theAd->adId; ?>" title="<?php echo $theAd->Title; ?>">
								<?php
								if ($theAd->Type == "0") {
									embed_video_thumbnail($theAd->URL);
								}//close if video
								if ($theAd->Type == "1") {
									embed_image_thumbnail($theAd->URL, $theAd->Title);
								}//close if image
								?>
								</a></dd>
										
										<dd class="date"><?php echo date("F j, Y", strtotime($theAd->PostedDate)); ?></dd>
										<dd class="user">Submitted by <span><?php echo $submitter->Username; ?></span></dd>
										<dd>Greenwashing Index Rating: <span><?php if ($theAd->AvgRating != 0) { echo round($theAd->AvgRating,2); } else {echo "Not yet rated"; } ?></span></dd>
	<?php if ($theAd->AvgRating != 0) {?>
										<dd><a href="ad_single.php?id=<?php echo $theAd->adId; ?>#ratings" title="Number of ratings"><?php echo count($ratingsList) + 1; ?> rating<?php if (count($ratingsList) != 0) {?>s<?php }?></a></dd>
	<?php } ?>
									</dl>
	
<?php	
   	}//close for each ad
   	if (count($bottom_results) > 0) {

if (count($all_results) <= 0) {
?>
<h3>Search Results for <?php echo $_GET['s'] . " (" . count($bottom_results); ?>)</h3>
<?php
}//close if
else {
?>
<h3><a href="#" title="Show All Results" id="show_all_results">Show All Results (<?php echo count($bottom_results); ?>)</a></h3>
<?php	
}//close else
?>
<div id="more_results" <?php if (count($all_results) > 0) { echo "class='initial_hide'"; } ?>>
	<?php	
	foreach ($bottom_results as $theAd) {

		$ratings = new Rating();
		$ratingsList = $ratings->GetList(array(array("AdId","=",$theAd->adId)));
		
		$submitter = new User();
		$submitter->Get($theAd->PostedBy);
	?>			
									<dl>
										<dt><a href="ad_single.php?id=<?php echo $theAd->adId; ?>" title="<?php echo $theAd->Title; ?>"><?php echo $theAd->Title; ?></a></dt>
										
										<dd class="image"><a href="ad_single.php?id=<?php echo $theAd->adId; ?>" title="<?php echo $theAd->Title; ?>">
								<?php
								if ($theAd->Type == "0") {
									embed_video_thumbnail($theAd->URL);
								}//close if video
								if ($theAd->Type == "1") {
									embed_image_thumbnail($theAd->URL, $theAd->Title);
								}//close if image
								?>
								</a></dd>
										
										<dd class="date"><?php echo date("F j, Y", strtotime($theAd->PostedDate)); ?></dd>
										<dd class="user">Submitted by <span><?php echo $submitter->Username; ?></span></dd>
										<!--<dd><?php echo $theAd->Description; ?></dd>-->
										<dd>Greenwashing Index Rating: <span><?php if ($theAd->AvgRating != 0) { echo round($theAd->AvgRating,2); } else {echo "Not yet rated"; } ?></span></dd>
	<?php if ($theAd->AvgRating != 0) {?>
										<dd><a href="ad_single.php?id=<?php echo $theAd->adId; ?>#ratings" title="Number of ratings"><?php echo count($ratingsList) + 1; ?> rating<?php if (count($ratingsList) != 0) {?>s<?php }?></a></dd>
	<?php } ?>
									</dl>
	
<?php	
   	}//close for each ad
?>
</div><!--close #more_results-->

<?php
   	}//close if more results
   	if (count($all_results) <= 0 && count($bottom_results) <= 0) {
   	?>
   	<h3>No search results</h3>
   	<?php
   	}//close if
?>

			</div><!--close content-->	
			
<?php include("sidebar.php"); ?>	

	<?php include("footer.php"); ?>

Answer : PHP Array Syntax Issue

No, it doesn't work that way.  If you include an email address on the page that comes from the server, it can be read.  I put the actual email address  on my in the server side code (PHP) so that it can't be seen.

The email address that the user entered can't be seen on the page because it is never there except on their computer.  'https' can protect against it being read in transmission to your server.

The reCAPTCHA was invented to prevent automated submissions.  While that works on the form page, serious spammers skip the form page and submit directly to your 'action' page.  It is important for spam protection to filter and check what you get from the forms.
Random Solutions  
 
programming4us programming4us