thought this might be useful...
make downloads.php and put this..
make downloads.php and put this..
Code:
if($action=="add") { addonline(getuid_sid($sid),"Adding Items on Downloads",""); echo "<card id=\"natasu\" title=\"Add Item\">"; echo "<p align=\"center\">"; echo "[b]Item Url:[/b] "; echo "<input name=\"file\" value=\"http://\" maxlength=\"255\"/> "; echo "[b]Category:[/b] "; $vid = mysql_fetch_array(mysql_query("SELECT id FROM category ORDER BY id")); $vids = mysql_query("SELECT id, name FROM category"); echo "<select name=\"vid\">"; while ($vid = mysql_fetch_array($vids)) { echo "<option value=\"$vid[0]\">".htmlspecialchars($vid[1])."</option>"; } echo "</select> "; echo " <anchor>Add"; echo "<go href=\"downloads.php?action=additem&sid=$sid\" method=\"post\">"; echo "<postfield name=\"file\" value=\"$(file)\"/>"; echo "<postfield name=\"vid\" value=\"$(vid)\"/>"; echo "</go></anchor> ----- "; echo "<a href=\"downloads.php?action=main&sid=$sid\">Back to Downloads</a> "; echo "<a href=\"index.php?action=main&sid=$sid\">Main Menu</a> "; echo "</p>"; echo "</card>"; }else if($action=="additem") { $file = $_POST['file']; $vid = $_POST['vid']; $uid = getuid_sid($sid); addonline(getuid_sid($sid),"Adding Item",""); echo "<card id=\"main\" title=\"Natasu\">"; echo "<p align=\"center\">"; $res = mysql_query("INSERT INTO downloads SET uid='".$uid."', url='".$file."', time=".time().", category='".$vid."'"); if ($res) { echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Item Added Successfully! "; }else{ echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error! "; } echo "<a href=\"downloads.php?action=main&sid=$sid\">Back to Downloads</a> "; echo "<a href=\"index.php?action=main&sid=$sid\">Main Menu</a> "; echo "</p>"; echo "</card>"; }else if($action=="delete") { $did = $_GET["did"]; addonline(getuid_sid($sid),"Deleting Item",""); echo "<card id=\"main\" title=\"Natasu\">"; echo "<p align=\"center\">"; $itemowner = mysql_fetch_array(mysql_query("SELECT uid FROM downloads WHERE id='".$did."'")); if(ismod(getuid_sid($sid))||getuid_sid($sid)==$itemowner[0]) { $res = mysql_query("DELETE FROM downloads WHERE id='".$did."'"); if($res) { echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Successfully Deleted! "; }else{ echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error! "; } }else{ echo "<img src=\"../images/notok.gif\" alt=\"X\"/>You can't delete this item"; } echo " "; echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"*\"/>"; echo "Home</a>"; echo "</p></card>"; }else if($action=="downloads") { addonline(getuid_sid($sid),"Downloads Category","downloads.php?action=$action"); echo "<card id=\"main\" title=\"Downloads\">"; echo " "; $category = mysql_query("SELECT id, name FROM category ORDER BY id"); while($vcat=mysql_fetch_array($category)) { $link = "<a href=\"downloads.php?action=view&sid=$sid&vid=$vcat[0]\">$vcat[1]</a>"; echo " $link"; } echo "</p>"; echo "<p align=\"center\">"; echo "<a href=\"index.php?action=main&sid=$sid\">Main Menu</a>"; echo "</p>"; echo "</card>"; }else if($action=="view") { $vid = $_GET["vid"]; addonline(getuid_sid($sid),"Downloads","downloads.php?action=$action"); echo "<card id=\"main\" title=\"Viewing Downloads\">"; if($page=="" || $page<=0)$page=1; $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM downloads WHERE category='".$vid."'")); $num_items = $noi[0]; //changable $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 DISTINCT id, name, uid, url FROM downloads WHERE category='".$vid."' ORDER BY time DESC LIMIT $limit_start, $items_per_page"; echo " "; $items = mysql_query($sql); echo mysql_error(); if(mysql_num_rows($items)>0) { while ($item = mysql_fetch_array($items)) { $ext = extension($item[1]); $ime = extensionimg($ext); $lnk = "<a href=\".$item[3]."\">$ime".htmlspecialchars($item[1])."</a>"; if(candelete($uid, $item[0])) { $delnk = "<a href=\"downloads.php?action=delete&sid=$sid&did=$item[0]\">[delete]</a>"; }else{ $delnk = ""; } if($who!="") { $byusr=""; }else{ $unick = getnick_uid($item[2]); $ulnk = "<a href=\"index.php?action=viewuser&sid=$sid&who=$item[2]\">$unick</a>"; $byusr = "- By $ulnk"; } echo "$lnk $byusr $delnk "; } } echo "</p>"; echo "<p align=\"center\">"; if($page>1) { $ppage = $page-1; echo "<a href=\"downloads.php?action=$action&page=$ppage&vid=$vid&sid=$sid\">«PREV</a> "; } if($page<$num_pages) { $npage = $page+1; echo "<a href=\"downloads.php?action=$action&page=$npage&vid=$vid&sid=$sid\">Next»</a>"; } echo " $page/$num_pages "; if($num_pages>2) { $rets = "Jump to page<input name=\"pg\" format=\"*N\" size=\"3\"/>"; $rets .= "<anchor>[GO]"; $rets .= "<go href=\"downloads.php\" method=\"get\">"; $rets .= "<postfield name=\"action\" value=\"$action\"/>"; $rets .= "<postfield name=\"vid\" value=\"vid\"/>"; $rets .= "<postfield name=\"sid\" value=\"$sid\"/>"; $rets .= "<postfield name=\"page\" value=\"$(pg)\"/>"; $rets .= "</go></anchor>"; echo $rets; } echo "</p>"; ////// UNTILL HERE >> echo "<p align=\"center\">"; echo "<a href=\"downloads.php?action=downloads&sid=$sid\">Back to Downloads</a> "; echo "<a href=\"index.php?action=main&sid=$sid\">"; echo "Main Menu</a>"; echo "</p>"; echo "</card>"; }
Comment