Asearch.php
<form id=areasearch action=http://andimproudofit.com/searcharea.php method=post target=_blank>
Search By Area Code:<br>
<table><tr><td align=left width=50>
<input type=text name=asearch value="" size="3" class="required validate-number"></td><td align=right size=50><input type=submit value=GO! class="button_login"></input></td></tr></table>
</form>
searcharea.php:
<?php
if (strlen($_POST['asearch']) == "3"){
$mystring = $_POST["asearch"];
} else {
$mystring = "0";
}
include('header.php');
if($_POST['submit']){
if(!isset($_SESSION['user']['username'])) $username = "Anonymous";
else $username = $_SESSION['user']['username'];
@$query = mysql_query("INSERT INTO `comps`(time,message,accepted,votes1,votes2,via,user,cat,numcoms,subcat) VALUES ('". time() ."', '". clean($_POST['comp']) ."', 'No', 0, 0, 'internet', '". $username ."', '". clean($_POST['cat']) ."', '0', '0')") or die(mysql_error());
echo "<strong>Your submission has been received!</strong>
<script type=\"text/javascript\"><!--
setTimeout('Redirect()',1000);
function Redirect()
{
opener.location.href='./';
window.close();
}
// --></script>";
} else {
}
$cnt = '<form action="submitCompliment.php" class="submit_form" method="POST" target="sendCommentIFrame">
<table id="submissionform">
<tr><td class="input" colspan=5>
<textarea onfocus="javascript:document.getElementById(\'commbox\').value=\'\';" name="comp" rows="13" height="75" cols="20" id="commbox">'. $names[4] .'</textarea>
</td></tr>
<tr><td>
<input name="cat" type="hidden" value="'. key($catlist) .'" >';
$cnt .= '
</select></td></tr> <tr><td><input type="submit" name="Ok" value="Submit!" class="button_login2"/>
</td></tr>
<tr><td>
<div id="loadingsubmit_article" style="display:none;"><img src="images/loader.gif"/></div>
<div id="resultsubmit_article" style="display:none;"></div>
</td></tr>
</table>
</form><iframe name="sendCommentIFrame" style="display:none"></iframe>';
//$maincontent = "<h1><a href=\"javascript:submitToggle();\" class=\"submit\" style=\"font-weight: bold;\">" . $submitpop . "</a></h1><div style=\"display: none;\" id=\"submit\" class=\"post\"><div id=\"result2\" class=\"result\">" . $cnt . "</div></div>";
$maincontent .= "<div id=\"mainresultlist\">\n";
$comp = $_GET['comp'];
if(!$comp){
$page = $_GET['page'];
if(!$page) $page = 1;
$npage = $page - 1;
$c = mysql_real_escape_string($_GET['c']);
if($c){
$addsql = " AND `cat` = (SELECT id FROM cats WHERE cat='". $c ."')";
$addhtml = "&c=". $c;
}
$limit1 = $npage * 10;
$limit2 = $npage + 10;
$q = "SELECT * FROM `comps` WHERE `area` = $mystring". $addsql ." ORDER BY `time` DESC LIMIT ". $limit1 .", ". $limit2;
$r = mysql_query($q);
$voting_array = mysql_fetch_array(mysql_query("SELECT * FROM `votes` WHERE `ip`='$ip'"));
$vote_explode = explode(',', $voting_array['comp_id']);
foreach($vote_explode as $vote_ex){
$vote_ex = explode(":", $vote_ex);
$compnum = $vote_ex[0];
$compvote = $vote_ex[1];
$compvotearray[$compnum] = $compvote;
}
if(mysql_num_rows($r) > 0)
{
while($row = mysql_fetch_array($r, MYSQL_ASSOC)){
// count the comments
$commentsCountQuery = "select * from comments where comp_id=" . $row['id'];
$commentsCountResult = mysql_query($commentsCountQuery);
$commentsCount = mysql_num_rows($commentsCountResult);
$maincontent .= "<br />\n<div id=\"result". $row['id'] ."\" class=\"result\">\n";
$maincontent .= '<div class="areacodee">This A#$ Hole is from area code: <span>'. "(" . $row['area'] . ")" . '</span></div><br>';
$maincontent .= '<a href="comment/'. $row['id'] .'" class="commlink">';
$maincontent .= stripslashes($row['message']) ."\n<br /><br />\n";
$maincontent .= '</a>';
$maincontent .= '<span class="sentBy"><span class="lside"><a href="comment/'. $row['id'] .'" class="commlink">read comments ('. $commentsCount .') <br><table><tr><td>ShareThis! </td><td><img src="images/share10.png"/></td></tr></table></a></span>';
if(!$compvotearray[$row['id']]){
$maincontent .= '<span id="vote_buttons'. $row['id'] .'" class="vote_buttons">
<span id="a1votes_count'. $row['id'] .'">
<a id=":'. $row['id'] .':1:'. $row['votes1'] .':'. $row['votes2'] .':" class="vote_up" title="'. $phrase1 .':'. $phrase2 .'" href="javascript:;">
'. $phrase1 .' ('. $row['votes1'] .')</a></span>';
$maincontent .= ' - <span id="a2votes_count'. $row['id'] .'">
<a id=":'. $row['id'] .':2:'. $row['votes1'] .':'. $row['votes2'] .':" class="vote_down" title="'. $phrase1 .':'. $phrase2 .'" href="javascript:;">
'. $phrase2 .' ('. $row['votes2'] .')</a>
</span></span><br />';
} else {
$maincontent .= '<span id="vote_buttons'. $row['id'] .'" class="vote_buttons voted">
<span id="a1votes_count'. $row['id'] .'">
'. $phrase1 .' ('. $row['votes1'] .')</span>';
$maincontent .= ' - <span id="a2votes_count'. $row['id'] .'" class="vote_buttons voted">
'. $phrase2 .' ('. $row['votes2'] .')
</span></span><br />';
}
$maincontent .= '<span class="mesdetail">'. date('F j, Y \a\t g:i a ', $row['time']) .'by <a href="'.linkbasepath.'user/' . $row['user'] .'">'.$row['user'].'</a>
</span>';
$maincontent .= '<span class="mesdetail"> <a href="'.linkbasepath.''. $catlist[$row['cat']] .'">'. $catlist[$row['cat']] .'</a></span>';
$maincontent .= "</span>";
if($sharelinks == 'yes') $maincontent .= '<span id="addslider'. $row['id'] .'">
<a class="addslide" onclick="Slide(\'result'. $row['id'] .'\',\'down\');" href="javascript:;" style="">[+]</a>
</span>
<div id="sharelinks'. $row['id'] .'" class="sharelinks">'. $sharelinkscode .'</div>';
$maincontent .= "</div>";
}
} else {
$maincontent .= "<strong>There are no results in this category.</strong>";
}
$q = "SELECT COUNT(*) FROM `comps` WHERE `accepted` = 'Yes'". $addsql;
$r = mysql_query($q);
$num = mysql_fetch_array($r);
$nbrPages = ceil($num[0] / 10);
$i = 1;
$maincontent .= "<br />";
// Pagination links.
$nbrPages = $nbrPages;
$thisPage = "";
include("pagination.php");
$maincontent .= $paginationLinks;
// while($i <= $nbrPages){
// if($i == 1) $maincontent .= "Pages: ";
// if($i != $page) $maincontent .= "<a href=\"?page=". $i . $addhtml ."\">". $i ."</a>\n ";
// else $maincontent .= $i ." ";
// $i++;
// }
} elseif ($comp){
include('comment.php');
}
$maincontent .= "\n</div>";
$layout = str_replace("[[main-content]]", $maincontent, $layout);
echo $layout;
?>
|