Made search.php better + added nice like buttons
parent
4076e055aa
commit
07a90fb42b
Binary file not shown.
After Width: | Height: | Size: 207 B |
Binary file not shown.
After Width: | Height: | Size: 221 B |
Binary file not shown.
After Width: | Height: | Size: 192 B |
Binary file not shown.
After Width: | Height: | Size: 248 B |
|
@ -34,7 +34,7 @@
|
|||
listSearch("","All","All Items in order of popularity",$handle);
|
||||
if ($id=="mod" || $id==""){
|
||||
listSearch("mod","All Mods","All Mods in order of popularity",$handle);
|
||||
listSearch("mpack","All Mod Packs","All Mod Packs in order of popularity",$handle);
|
||||
listSearch("modpack","All Mod Packs","All Mod Packs in order of popularity",$handle);
|
||||
}
|
||||
|
||||
if ($id=="texture" || $id=="")
|
||||
|
|
|
@ -4,7 +4,7 @@ $result=$input;
|
|||
|
||||
$result=str_replace("\\'","'",$result);
|
||||
|
||||
$result=str_replace("[img]","<img style=\"max-width:900px;\" src=\"",$result);
|
||||
$result=str_replace("[img]","<img style=\"max-width:850px;\" src=\"",$result);
|
||||
$result=str_replace("[/img]","\" />",$result);
|
||||
$result=str_replace("[/img-enforce]","\" />",$result);
|
||||
|
||||
|
@ -38,6 +38,8 @@ $result=str_replace("[code]","<p><code style=\"border:solid;\">",$result);
|
|||
$result=str_replace("[/code]","</code></p>",$result);
|
||||
|
||||
$result=str_replace("[color=red]","<font color=\"#FF0000\">",$result);
|
||||
$result=str_replace("[color=green]","<font color=\"#00FF0000\">",$result);
|
||||
$result=str_replace("[color=blue]","<font color=\"#000000FF\">",$result);
|
||||
$result=str_replace("[/color]","</font>",$result);
|
||||
|
||||
return $result;
|
||||
|
|
|
@ -1,7 +1,20 @@
|
|||
<?php
|
||||
echo "<table width=\"100%\"><tr><th colspan=2>Mod Name</th><th>Description</th><th width=200>Tags</th><th>Likes</th></tr>\n";
|
||||
$query= mysql_real_escape_string ($query);
|
||||
$res = mysql_query("SELECT * FROM mods WHERE tags LIKE '%$query%' ORDER BY likes DESC",$handle) or SQLerror("MySQL Query Error","Error on searching database.mods.tags for '$query'");
|
||||
|
||||
if ($mode=="tags"){
|
||||
$qu_str="SELECT * FROM mods WHERE tags LIKE '%$query%'";
|
||||
}else if ($mode=="sb"){
|
||||
if (is_numeric($query)==true){
|
||||
echo "<!--is numeric-->";
|
||||
$qu_str="SELECT * FROM mods WHERE owner=$query";
|
||||
}else{
|
||||
$qu_str="SELECT * FROM mods WHERE tags LIKE '%$query%' OR name LIKE '%$query%'";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$res = mysql_query($qu_str." ORDER BY likes DESC",$handle) or SQLerror("MySQL Query Error","Error on searching database.mods.tags for '$query'");
|
||||
|
||||
$alternate=1;
|
||||
// Get projects loop
|
||||
|
|
|
@ -37,6 +37,7 @@ if (is_logged_in()){
|
|||
|
||||
<div style="position:relative;left:500px;top:70px;width:400px;text-align:right;">
|
||||
<form method="get" action="<?php echo $serverpath;?>/search.php">
|
||||
<input type="hidden" name="mode" value="sb">
|
||||
<input type="text" placeholder="search for something" name="id"> <input type="submit" value="Search">
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -30,6 +30,23 @@ if (strstr($user_d[5],$row[1].",")){
|
|||
echo "\n\nend of execution-->\n\n\n";
|
||||
}
|
||||
|
||||
function checkLike($user,$id,$col,$handle){
|
||||
if (is_numeric($id)==false){
|
||||
echo "<!--[Error]: is not numeric-->\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
$res = mysql_query("SELECT * FROM mods WHERE mod_id=$id",$handle) or SQLerror("MySQL Query Error","Error on searching database.mods.mod_id for '$id'");
|
||||
$row = mysql_fetch_row($res);
|
||||
$user_d = getUser($user,$handle);
|
||||
|
||||
if (!$user_d){
|
||||
return 0;
|
||||
}
|
||||
|
||||
return strstr($user_d[$col],$row[1].",");
|
||||
}
|
||||
|
||||
|
||||
function changeLikes($id,$user,$amount,$handle){
|
||||
echo "\n\n\n function changeLikes($id,$user,$amount,$handle) is executing\n";
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
<?php
|
||||
include "scripts/setup.php";
|
||||
$query=$_GET['id'];
|
||||
$mode=$_GET['mode'];
|
||||
if ($mode=="")
|
||||
$mode="tags";
|
||||
|
||||
$page_title="Search for $query";
|
||||
include "scripts/pageheader.php";
|
||||
|
||||
|
|
3
user.php
3
user.php
|
@ -8,7 +8,7 @@ $id=$_GET['id'];
|
|||
|
||||
if ($id==""){
|
||||
echo "<table width=\"100%\"><tr><th colspan=2>Username</th></tr>\n";
|
||||
$res = mysql_query("SELECT * FROM users",$handle) or SQLerror("MySQL Query Error","Error on getting database.users");
|
||||
$res = mysql_query("SELECT * FROM users ORDER BY level DESC",$handle) or SQLerror("MySQL Query Error","Error on getting database.users");
|
||||
$alternate=1;
|
||||
// Get projects loop
|
||||
while ($hash = mysql_fetch_assoc($res)){
|
||||
|
@ -29,6 +29,7 @@ while ($hash = mysql_fetch_assoc($res)){
|
|||
$hash = mysql_fetch_assoc($res);
|
||||
echo "<h1>{$hash['name']}</h1>";
|
||||
echo "{$hash['name']} is a level {$hash['level']} member.";
|
||||
echo "<p><a href=\"search.php?id=$id&mode=sb\">View {$hash['name']}'s mods</a></p>";
|
||||
}
|
||||
|
||||
include "scripts/pagefooter.php";
|
||||
|
|
15
viewmod.php
15
viewmod.php
|
@ -45,18 +45,23 @@ $links="";
|
|||
}
|
||||
|
||||
|
||||
echo "<table width=\"100%\"><tr><td>";
|
||||
echo "<table width=\"100%\" bgcolor=\"#FFFFBD\"><tr><td width=\"100\"><a href=\"{$row[9]}\">Download</a></td>";
|
||||
echo "<table width=\"900\"><tr><td>";
|
||||
echo "<table width=\"900\" bgcolor=\"#FFFFBD\"><tr><td width=\"100\"><a href=\"{$row[9]}\">Download</a></td>";
|
||||
|
||||
echo "<td width=\"650\">"; // Download Link
|
||||
echo "<h1 align=center>{$row[1]} - by <a href=\"user.php?name={$owner}\" target=\"_blank\">{$owner}</a></h1></td>"; // Title and User Link
|
||||
|
||||
echo "<td width=150>{$row[2]}</td></tr></table></td></tr>"; // Version
|
||||
echo "<td width=\"25\">{$row[2]}</td></tr></table></td></tr>"; // Version
|
||||
|
||||
echo "<tr><td><table width=\"100%\"><tr><td colspan=2><div style=\"width:900px;text-wrap: suppress;\"><p>".formatbb($row[4])."</p></div></td>"; // Description
|
||||
echo "<tr><td><table width=\"900\"><tr><td><div style=\"width:870px;text-wrap: suppress;\"><p>".formatbb($row[4])."</p></div></td>"; // Description
|
||||
|
||||
if (is_logged_in()==true){
|
||||
echo "<td><a href=\"viewmod.php?id=$id&action=like\">+</a></td></tr>"; // Likes
|
||||
$like_ext="";
|
||||
if (checkLike($_SESSION['user'],$id,5,$handle)==true)
|
||||
$like_ext="_high";
|
||||
|
||||
$dislike_ext="";
|
||||
echo "<td width=\"25\" style=\"vertical-align:top;\"><a href=\"viewmod.php?id=$id&action=like\"><img src=\"images/like_mod$like_ext.png\" alt=\"like\" /></a><br /><br /><a href=\"viewmod.php?id=$id&action=dislike\"><img src=\"images/dislike_mod$dislike_ext.png\" alt=\"dislike\" /></a></td></tr>"; // Likes
|
||||
}else{
|
||||
echo "<td></td></tr>"; // Likes
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue