Requests Section\n"); print("

Make a request  View my requests

"); print("

Sort by Votes, Request Name, or Date Added

"); print("

Hide Filled

"); $categ = (int) $_GET["category"]; $requestorid = (int) $_GET["requestorid"]; $sort = htmlspecialchars($_GET["sort"]); $search = mysql_escape_string( htmlspecialchars( $_GET["search"]) ); $filter = htmlspecialchars($_GET["filter"]); $search = " AND requests.request like '%$search%' "; if ($sort == "votes") $sort = " order by hits desc "; else if ($sort == "request") $sort = " order by request "; else $sort = " order by added desc "; if ($filter == "true") $filter = " AND requests.filledby = 0 "; else $filter = ""; if ($requestorid <> NULL) { if (($categ <> NULL) && ($categ <> 0)) $categ = "WHERE requests.cat = " . $categ . " AND requests.userid = " . $requestorid; else $categ = "WHERE requests.userid = " . $requestorid; } else if ($categ == 0) $categ = ''; else $categ = "WHERE requests.cat = " . $categ; /* if ($categ == 0) $categ = 'WHERE requests.cat > 0 '; else $categ = "WHERE requests.cat = " . $categ; */ $res = do_mysql_query("SELECT count(requests.id) FROM requests LEFT JOIN categories on requests.cat = categories.id LEFT JOIN users on requests.userid = users.id $categ $filter $search") or die(mysql_error()); $row = mysql_fetch_array($res); $count = $row[0]; $perpage = 25; list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, $_SERVER["PHP_SELF"] ."?" . "category=" . $category . "&sort=" . $sort . "&" ); echo $pagertop; $res = do_mysql_query("SELECT users.downloaded, users.uploaded, IF( users.downloaded > 0, ROUND(users.uploaded / users.downloaded, 3), '---') as ratio, users.username, requests.filled, requests.filledurl, requests.filledby, requests.id, requests.userid, requests.request, requests.added, UNIX_TIMESTAMP(requests.added) as utadded, requests.hits, categories.name as nam, categories.id as catid, categories.name as cat, categories.stylesheet as stylesheet FROM requests LEFT JOIN categories on requests.cat = categories.id LEFT JOIN users on requests.userid = users.id $categ $filter $search $sort $limit") or sqlerr(); $num = mysql_num_rows($res); print("
"); ?> \n"); print("
\n

"); print("
"); print("Search Requests: "); print("\n"); print("


"); print("
"); print("\n"); print("\n"); if (get_user_class() >= UC_MODERATOR ) { print("\n"); } print("\n"); for ($i = 0; $i < $num; ++$i) { $arr = mysql_fetch_assoc($res); $ratio = "".$arr['ratio'].""; $timezone = $arr['added']; $res2 = do_mysql_query("SELECT username from users where id=" . $arr['filledby']); $arr2 = mysql_fetch_assoc($res2); if ($arr2['username']) $filledby = $arr2[username]; else $filledby = " "; $addedby = ""; $filled = $arr['filled']; if ($arr['filled'] == 'yes') $filled = "Yes"; else $filled = "No"; print(" ".$addedby." \n"); if (get_user_class() >= UC_MODERATOR ) { print("\n"); } print("\n"); } print("
RequestsCategoryAddedAdded ByFilled?Filled ByVotesDel
".$arr['username']." (".$ratio.")
".$arr['request']." ".$timezone."".$filled." ".$arr2['username']." ".$arr['hits']."
[Add vote]
\n"); if (get_user_class() >= UC_MODERATOR ) { print("

"); } print("
"); echo $pagerbottom; stdfoot(); ?>