ok guys .i have used search nickname code here and eddited a few table names etc .to be able to search for a smilie. at the moment its displaying the first 5 in the database . dont matter wot i tyoe in search box.
i know its very rough and prob half the stuff in there dont need to be.
but wot i want is to be able to enter say a word in the search box and it brings up a list of smile images and the code to use them on site that relates to the word that was entered.
i had it working the search part of it but the next page prev page was giving me errors and i kinda messed it all up tryin to fix lol .
cracked it lol . .just needed some food for my brain. just need to sort the catorgories out .
i know its very rough and prob half the stuff in there dont need to be.
but wot i want is to be able to enter say a word in the search box and it brings up a list of smile images and the code to use them on site that relates to the word that was entered.
i had it working the search part of it but the next page prev page was giving me errors and i kinda messed it all up tryin to fix lol .
Code:
///////////////////////////////////////search for smilies
else if($action=="searchsm")
{
addonline(getuid_sid($sid),"smilies search","");
echo "<head>";
echo "<title>Search</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<p>";
echo "<form action=\"smiliesearch.php?action=find&sid=$sid\" method=\"post\">";
echo "Nickname: <input name=\"stext\" maxlength=\"15\"/><br/>";
echo "Order: <select name=\"cat\">";
echo "<option value=\"1\">Member Name</option>";
echo "<option value=\"2\">Last Active</option>";
echo "<option value=\"3\">Join Date</option>";
echo "</select><br/>";
echo "<input type=\"Submit\" name=\"send\" value=\"Find It\"></form>";
echo "</p>";
echo "<p align=\"center\">";
echo "<b>9 </b><a accesskey=\"9\" href=\"index.php?action=search&sid=$sid\"><img src=\"../phpThumb/phpThumb.php?src=../images/search.gif\" alt=\"\"/>Search Menu</a><br/>";
echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&sid=$sid\"><img src=\"../phpThumb/phpThumb.php?src=../images/home.gif\" alt=\"\"/>Home</a>"; echo "</p></body>";
echo "</p></body>";
}//////////////////////////////////////////
else if($action=="find")
{
$stext = $_POST["stext"];
$scode = $_POST["scode"];
$sin = $_POST["sin"];
$cat = $_POST["cat"];
addonline(getuid_sid($sid),"smilie search","");
echo "<head>";
echo "<title>Search</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<p>";
if(trim($stext)=="")
{
echo "<br/>Failed to search for club";
}else{
//begin search
if($page=="" || $page<1)$page=1;
$where_table = "dave_smilies";
$cond = "scode";
$select_fields = "id, scode, cat";
if($cat=="1")
{
$ord_fields = "name";
}else if($cat=="2"){
$ord_fields = "lastact DESC";
}else if($cat=="3"){
$ord_fields = "regdate";
}
$noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ".$where_table." WHERE ".$cond." LIKE '%".$stext."%'"));
$num_items = $noi[0];
$items_per_page = 10;
$num_pages = ceil($num_items/$items_per_page);
if(($page>$num_pages)&&$page!=1)$page= $num_pages;
$limit_start = ($page-1)*$items_per_page;
$sql = "SELECT ".$select_fields." FROM ".$where_table." WHERE ".$cond." LIKE '%".$stext."%' ORDER BY scode LIMIT $limit_start, $items_per_page";
$items = mysql_query($sql);
while($item=mysql_fetch_array($items))
{
//$tlink = "<a href=\"index.php?action=viewuser&sid=$sid&who=$item[0]\">".htmlspecialchars($item[1])."</a><br/>";
// echo $tlink;
echo parsepm ($item[1], $sid);
echo "$item[1]<br/>";
}
echo "<p align=\"center\">";
if($page>1)
{
$ppage = $page-1;
$rets = "<form action=\"search.php?action=$action&sid=$sid&page=$ppage\" method=\"post\">";
$rets .= "<input type=\"hidden\" name=\"stext\" value=\"$stext\"/>";
$rets .= "<input type=\"hidden\" name=\"sin\" value=\"$sin\"/>";
$rets .= "<input type=\"hidden\" name=\"sor\" value=\"$sor\"/>";
$rets .= "<input type=\"Submit\" name=\"Prev\" value=\"Prev\"></form>";
echo $rets;
}
if($page<$num_pages)
{
$npage = $page+1;
$rets = "<form action=\"smiliesearch.php?action=find&sid=$sid&page=$npage\" method=\"post\">";
$rets .= "<input type=\"hidden\" name=\"stext\" value=\"$stext\"/>";
$rets .= "<input type=\"hidden\" name=\"sin\" value=\"$sin\"/>";
$rets .= "<input type=\"hidden\" name=\"sor\" value=\"$sor\"/>";
$rets .= "<input type=\"Submit\" name=\"Next\" value=\"Next\"></form>";
echo $rets;
}
echo "<br/>$page/$num_pages<br/>";
if($num_pages>2)
{
$rets = "<form action=\"smiliesearch.php?action=find&sid=$sid&page=$(pg)\" method=\"post\">";
$rets .= "<input name=\"pg\" style=\"-wap-input-format: '*N'\" size=\"3\"/>";
$rets .= "<input type=\"hidden\" name=\"stext\" value=\"$stext\"/>";
$rets .= "<input type=\"hidden\" name=\"sin\" value=\"$sin\"/>";
$rets .= "<input type=\"hidden\" name=\"sor\" value=\"$sor\"/>";
$rets .= "<input type=\"Submit\" name=\"Send\" value=\"Go To Page\"></form>";
echo $rets;
}
echo "</p>";
}
echo "</p>";
echo "<p align=\"center\">";
echo "<b>9 </b><a accesskey=\"9\" href=\"index.php?action=search&sid=$sid\"><img src=\"../phpThumb/phpThumb.php?src=../images/search.gif\" alt=\"\"/>Search Menu</a><br/>";
echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&sid=$sid\"><img src=\"../phpThumb/phpThumb.php?src=../images/home.gif\" alt=\"\"/>Home</a>";
echo "</p></body>";
}
Comment