gemma134uk Posted April 3, 2008 Share Posted April 3, 2008 hi below is my nzbdetails.php im trying to make it look better as it looks a bit boring 1st thing i would like to do is change a clickable button to a clickable image (its not a <h aref=....> is a button that used a querry i think well it downloads a nzb from my site) the 2 buttons are "Download Selected in Zip File" and "Download Selected as NZB" there the 2 i want to make into a image <?php /*************************************************************************** * NZB Details Page * ======================================== * NZB Mod - Public v.TS-1.0b * TorrentStrike version * ======================================== * created by dodgy * http://www.webdeviation.com * Special thanks to all who have had a hand in TBDev/TorrentStrike ***************************************************************************/ ob_start("ob_gzhandler"); ?> <script LANGUAGE="JavaScript"> <!-- Begin var checkflag = "false"; function check(field) { if (checkflag == "false") { for (i = 0; i < field.length; i++) { field[i].checked = true;} checkflag = "true"; return "Uncheck All"; } else { for (i = 0; i < field.length; i++) { field[i].checked = false; } checkflag = "false"; return "Check All"; } } // End --> </script> <? require_once("include/bittorrent.php"); include_once("imdb/imdb.class.php"); // ----- For display of row with missing segments: function missing_segments($segments, $subjseg) { if ($segments == $subjseg) $display = ">($segments/$subjseg)"; elseif ($segments < $subjseg) $display = " color=\"red\">($segments/$subjseg)"; elseif ($segments > $subseg) $display = " color=\"green\">($segments/$subjseg)"; return $display; } // ----- Cleans NZB Subjects (not finished - add your own): function clean_nzb_subj($string) { $string = str_replace(""", " ", $string); $string = str_replace("è", "e", $string); $string = str_replace(""", "\"", $string); $string = str_replace("_", " ", $string); return $string; } /* ---- To retrieve piece information from dB & display it on nzb page, with form that will record which pieces are selected by user & therefore which pieces will be retrieved. ---- */ function showpieces($id, $nzbname, $nzbvernum) { $pl = "<form name=\"partnzb\" action=\"partnzbdload.php\" method=\"post\" enctype=\"multipart/form-data\">\n"; $pl .= "<table width=\"100%\" class=\"main\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\">\n"; $pl .= "<tr><td width=\"3%\" class=\"colhead\" align=\"right\">Dl?</td>". "<td class=\"colhead\">Subject</td>". "<td width=\"8%\" class=\"colhead\" align=\"right\">Size</td>". "<td width=\"8%\" class=\"colhead\" align=\"right\">Date</td>". "<td width=\"6%\" class=\"colhead\" align=\"right\">Parts</td></tr>\n"; $piecelist = @mysql_query("SELECT nzb_piece, piece_date, piece_subject, piece_size, piece_segments, piece_subjseg FROM nzbpiecelist WHERE nzb = $id ORDER BY nzb_piece"); while ($plist = mysql_fetch_array($piecelist)) { // Convert date: $dateunix = $plist['piece_date']; $dateposted = date("Y-m-d G:i:s", $dateunix); // Segment display/calculation: $segments = 0 + $plist['piece_segments']; $subjseg = 0 + $plist['piece_subjseg']; // the rows: $pl .= "<tr><td>".(getNzbPermissions("part")==1 && $CURUSER["nzbstodaydl"] < getNzbPermissions("maxdlpday")?"<input type=\"checkbox\" name=\"nzbpieces[]\" ". "value=\"" . $plist['nzb_piece'] . "\" />":"")."</td>". "<td><font class=\"small\">" . safe(clean_nzb_subj($plist['piece_subject'])) . "</font></td>". "<td align=right><font class=\"small\">" . mksize($plist['piece_size']) . "</font></td>". "<td align=right><font class=\"small\">" . $dateposted . "</font></td>". "<td align=right><font class=\"small\"" . missing_segments($segments, $subjseg) . "</font></td></tr>\n"; } $pl .= "</table>\n". "<input type=\"hidden\" name=\"nzb\" value=\"" . $id ."\" />". "<input type=\"hidden\" name=\"nzb_name\" value=\"" . $nzbname ."\" />". "<input type=\"hidden\" name=\"nzbvernum\" value=\"" . $nzbvernum ."\" />". "<input type=\"button\" value=\"Check all\" onClick=\"this.value=check(partnzb)\" class=\"codebuttons\" style=\"width:90px;height:25px;\" />"; if (getNzbPermissions("part") == 1 && $CURUSER["nzbstodaydl"] < getNzbPermissions("maxdlpday")) { $pl .= "<br /><div align=\"center\"><input type=\"submit\" name=\"dlzip\" value=\"Download Selected in Zip File\" class=\"codebuttons\" style=\"width:200px;height:25px;\" />". " <input type=\"submit\" name=\"dlnzb\" value=\"Download Selected as NZB\" class=\"codebuttons\" style=\"width:200px;height:25px;\" /></div><br /><br />\n"; } elseif (getNzbPermissions("part") == 1 && $CURUSER["nzbstodaydl"] >= getNzbPermissions("maxdlpday")) { $pl .= "<br /><div align=\"center\">".getNzbPermissions("maxmsg")."</div><br /><br />\n"; } else { $pl .= "<br /><div align=\"center\">".getNzbPermissions("partmsg")."</div><br /><br />\n"; } $pl .= "<a href=\"nzbdetails.php?id=$id\" class=\"sublink\">[Hide list]</a>". "</form>\n"; return $pl; } loggedinorreturn(); $id = 0 + $_GET["id"]; if (!isset($id) || !$id) die(); $res = mysql_query("SELECT nzbs.owner, nzbs.name, nzbs.descr, nzbs.category, LENGTH(nzbs.nfo)AS nfosz, nzbs.filename, nzbs.size, nzbs.numfiles, nzbs.poster, nzbs.postdate, nzbs.groups, nzbs.id, nzbs.added, nzbs.views, nzbs.hits, nzbs.pars, nzbs.partotsize, nzbs.nzbvernum, nzbs.autoimdb, nzbs.url, nzbs.imdbrating, nzbs.genre, nzbs.addtext, nzbs.format, nzbcategories.name AS cat_name, users.username FROM nzbs LEFT JOIN nzbcategories ON nzbs.category = nzbcategories.id LEFT JOIN users ON nzbs.owner = users.id WHERE nzbs.id = $id") or sqlerr(); /* $res = mysql_query("SELECT nzbs.owner, nzbs.name, nzbs.descr, nzbs.category, LENGTH(nzbs.nfo)AS nfosz, nzbs.filename, nzbs.size, nzbs.numfiles, nzbs.poster, nzbs.postdate, nzbs.groups, nzbs.id, nzbs.added, nzbs.views, nzbs.hits, nzbs.pars, nzbs.partotsize, nzbs.nzbvernum, nzbs.autoimdb, nzbs.url, nzbs.imdbrating, nzbs.genre, nzbs.addtext, nzbs.format, nzbcategories.name AS cat_name, users.username, users.advertisename FROM nzbs LEFT JOIN nzbcategories ON nzbs.category = nzbcategories.id LEFT JOIN users ON nzbs.owner = users.id WHERE nzbs.id = $id") or sqlerr(); // USE THIS QUERY IF ANONYMOUS UPLOADER MOD PRESENT */ $row = mysql_fetch_array($res); // -------------------------------Auto IMDB Mod--------------------------------------------// if ($row["autoimdb"] == "yes") { if (($row["url"] != "")AND(strpos($row["url"], "imdb"))AND(strpos($row["url"], "title"))) { $thenumbers = ltrim(strrchr($row["url"],'tt'),'tt'); $thenumbers = ereg_replace("[^A-Za-z0-9]", "", $thenumbers); $movie = new imdb ($thenumbers); $movieid = $thenumbers; $movie->setid ($movieid); $country = $movie->country (); $director = $movie->director(); $write = $movie->writing(); //$produce = $movie->producer(); $cast = $movie->cast(); $plot = $movie->plot (); $genres = $movie->genres (); $photoremurl = $movie->photo (); if ($photoremurl) { $autodata = "[img=".$photoremurl."]"; } $autodata .= "[img=pic/sml_info.gif]"; // This'll also be useful for storage further down: $movtitle = (string) $movie->title (); $movtitle = str_replace(array(""", "&", "[", "]"), array("\"", "&", "(", ")"), $movtitle); $autodata .= "[b][color=DimGray] Title: [/color][color=DarkSlateBlue] " . "".$movtitle."[/color][/b]\n"; $autodata .= "[b][color=DimGray] Alt Titles : [/color][color=DarkSlateBlue] "; if ($movie->alsoknow() != "") { foreach ( $movie->alsoknow() as $ak){ $autodata .= "".str_replace(array(""", "[", "]"), array("\"", "(", ")"), $ak["title"])."" . "".$ak["year"]."" . "".$ak["country"]."" . " (" . "".$ak["comment"]."" . ")" . ", "; } } $autodata .= "[/color][/b]\n[b][color=DimGray] Year: [/color][color=DarkSlateBlue] " . "".$movie->year ()."[/color][/b]\n"; $autodata .= "[b][color=DimGray] Runtime: [/color][color=DarkSlateBlue] " . "".$movie->runtime ()."" . " mins[/color][/b]\n"; // store rating for later use $movrating = $movie->rating (); $desc_rating = ($movrating == ""?"Not Yet Rated":$movrating); $autodata .= "[b][color=DimGray] User Rating: [/color][color=DarkSlateBlue] " . "".$desc_rating."[/color][/b]\n"; $desc_votes = (string) $movie->votes (); $desc_votes = (strlen($desc_votes)>7?substr($desc_votes,0, 7):$desc_votes); $desc_votes = str_replace(array(""", "&", "[", "]"), array("\"", "&", "(", ")"), $desc_votes); $autodata .= "[b][color=DimGray] Votes: [/color][color=DarkSlateBlue] " . "".$desc_votes."[/color][/b]\n"; $autodata .= "[b][color=DimGray] Language: [/color][color=DarkSlateBlue] " . "".$movie->language ()."[/color][/b]\n"; $autodata .= "[b][color=DimGray] Country: [/color][color=DarkSlateBlue] "; for ($i = 0; $i < count ($country); $i++) { $autodata .= "$country[$i]"; } for ($i = 0; $i < count ($genres); $i++) { $the_genres .= "$genres[$i] "; } $autodata .= "[/color][/b]\n[b][color=DimGray] Genre: [/color][color=DarkSlateBlue]" . "".$the_genres."[/color][/b]\n"; $tagline = $movie->tagline (); $tagline = str_replace(array(""", "&", "[", "]"), array("\"", "&", "(", ")"), $tagline); $autodata .= "[b][color=DimGray] Tagline: [/color][color=DarkSlateBlue] ".$tagline."[/color][/b]\n"; $autodata .= "[b][color=DimGray] Director(s): [/color][color=DarkSlateBlue]"; for ($i = 0; $i < count ($director); $i++) { $autodata .= "[url=http://us.imdb.com/Name?" . "".$director[$i]["imdb"]."" ."]" . "".$director[$i]["name"]."" . "[/url] "; } $autodata .= "[/color][/b]\n[b][color=DimGray] Writer(s): [/color][/b]"; for ($i = 0; $i < count ($write); $i++) { $autodata .= "[url=http://us.imdb.com/Name?" . "".$write[$i]["imdb"]."" ."]" . "".$write[$i]["name"]."" . "[/url] "; } $autodata .= "\n[b][color=DimGray] Trailer (if any): [/color][color=DarkSlateBlue][url=http://www.imdb.com/title/tt$thenumbers/trailers]Click here[/url][/color][/b]"; /* $autodata .= "\n[b][color=DimGray] Producer(s): [/color][/b]"; for ($i = 0; $i < count ($produce); $i++) { $autodata .= "[url=http://us.imdb.com/Name?" . "".$produce[$i]["imdb"]."" ."]" . "".$produce[$i]["name"]."" . "[/url] "; } */ $autodata .= "\n\n\n[img=pic/sml_desc.gif]"; // $autodata .= "[b][color=darkred] Plot Outline: [/color][/b]"; for ($i = 0; $i < count ($plot); $i++) { $the_plot .= "$plot[$i]"; } if ($the_plot == "") $the_plot = "No plot summary available"; // If you're wondering what this $big_letter is for, it's something I did for BB-Code on Drugs, coming soon $big_letter = substr($the_plot, 0, 1); $rest_of_plot = substr($the_plot, 1); $rest_of_plot = str_replace(array("[", "]"), array("(", ")"), $rest_of_plot); $autodata .= str_replace(""", "\"", "[color=DimGray][b]".$big_letter."".strip_tags($rest_of_plot)."[/b][/color]"); $autodata .= "\n\n\n\n[img=pic/sml_cast.gif]"; for ($i = 0; $i < count ($cast); $i++) { if ($i > 9) { break; } $autodata .= "[color=DimGray]•[/color] " . "[url=http://us.imdb.com/Name?" . "".$cast[$i]["imdb"]."" ."]" . "".$cast[$i]["name"]."" . "[/url] " . " as [b][color=DimGray]" . "".$cast[$i]["role"]."" . " [/color][/b]\n"; } $autodata .= "\n\n\n"; // to update nzbs table fields on upload/edit $checkme = 0; if (($row["imdbrating"] == "" && $row["genre"] == "") || !empty($_GET["edited"])) { // get some variables to update database $movyear = (string) $movie->year (); $movgenre = (string) $movie->genre (); $movietitle = sqlesc($movtitle." ($movyear)"); $moviegenre = sqlesc(substr($movgenre, 0, 20)); $movrating = ($movrating == ""?"NYR":$movrating); $movierating = sqlesc(strval($movrating)); mysql_query("UPDATE nzbs SET name = $movietitle, imdbrating = $movierating, genre = $moviegenre WHERE id = ".$row["id"]); $checkme = 1; } if ($_GET["uploaded"] && $checkme == 1) header("Location: $BASEURL/nzbdetails.php?id=".$row["id"]."&uploaded=1"); if ($_GET["edited"] && $checkme == 1) header("Location: $BASEURL/nzbdetails.php?id=".$row["id"]."&edited=1"); if ($checkme == 1) header("Location: $BASEURL/nzbdetails.php?id=".$row["id"].""); } } // ------------------------------------------------------------------------------------------// $owned = $moderator = 0; if (get_user_class() >= UC_MODERATOR) $owned = $moderator = 1; elseif ($CURUSER["id"] == $row["owner"]) $owned = 1; if ($_GET["hit"]) { mysql_query("UPDATE nzbs SET views = views + 1 WHERE id = $id"); if ($_GET["tocomm"]) header("Location: $BASEURL/nzbdetails.php?id=$id&page=0#startcomments"); elseif ($_GET["filelist"]) header("Location: $BASEURL/nzbdetails.php?id=$id&filelist=1#filelist"); else header("Location: $BASEURL/nzbdetails.php?id=$id"); exit(); } if (!isset($_GET["page"])) { stdhead("Details for nzb \"" . $row["name"] . "\""); $spacer = " "; if ($_GET["uploaded"]) { print("<h2>Successfully uploaded!</h2>\n"); } elseif ($_GET["edited"]) { print("<h2>Successfully edited!</h2>\n"); if (isset($_GET["returnto"])) print("<p><b>Go back to <a href=\"" . safe($_GET["returnto"]) . "\">whence you came</a>.</b></p>\n"); } elseif (isset($_GET["searched"])) { print("<h2>Your search for \"" . safe($_GET["searched"]) . "\" gave a single result:</h2>\n"); } $addtext = safe($row["addtext"])." "; $format = ($row["format"]!="na"?" <img src=\"".$pic_base_url."sml_".$row["format"].".gif\" alt=\"".$row["format"]."\" />":""); $s=$row["name"]; print("<h1>$s</h1>\n"); print("<h3>.: $addtext $format :.</h3><br /><br />\n"); print("<table width=\"750\" border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n"); $url = "nzbedit.php?id=" . $row["id"]; if (isset($_GET["returnto"])) { $addthis = "&returnto=" . urlencode($_GET["returnto"]); $url .= $addthis; $keepget .= $addthis; } $editlink = "a href=\"$url\" class=\"sublink\""; // Get permissions for download link display if ((getNzbPermissions("zip") == 1 || getNzbPermissions("nzb") == 1) && $CURUSER["nzbstodaydl"] < getNzbPermissions("maxdlpday")) { print("<form action=\"nzbdownload.php/$id/" . rawurlencode($row["name"]) . ".nzb\" method=\"post\">"); print("<tr><td class=\"rowhead\" width=\"1%\">Download</td><td width=\"99%\" align=\"center\">"); if (getNzbPermissions("zip") == 1) print("<input type=\"submit\" name=\"dlzip\" value=\"Download As Zip File\" class=\"codebuttons\" style=\"width:150px;height:25px;\" />"); if (getNzbPermissions("nzb") == 1) print(" <input type=\"submit\" name=\"dlnzb\" value=\"Download As NZB\" class=\"codebuttons\" style=\"width:150px;height:25px;\" />"); print(" "); print("</td></tr>"); print("</form>\n"); } elseif ((getNzbPermissions("zip") == 1 || getNzbPermissions("nzb") == 1) && $CURUSER["nzbstodaydl"] >= getNzbPermissions("maxdlpday")) { print("<tr><td class=\"rowhead\" width=\"1%\">Download</td><td width=\"99%\" align=\"center\">"); print(getNzbPermissions("maxmsg")."</td></tr>"); } else { print("<tr><td class=\"rowhead\" width=\"1%\">Download</td><td width=\"99%\" align=\"center\">"); print(getNzbPermissions("nzbmsg")."</td></tr>"); } if (!empty($row["image"])) tr("Picture:", "<img src='".$row["image"]."'>", 1); else tr("Picture:", "<img src=image.jpg>", 1); if (!empty($row["descr"])) $descr = $row["descr"]; else $descr = " "; $autodata = ($row["autoimdb"] == "yes"?format_comment($autodata)."":""); $descri = format_comment($descr); tr("Description", $autodata."".$descri, 1); if ($row["nfosz"] > 0) print("<tr><td class=\"rowhead\" align=\"right\">NFO</td><td align=\"left\">".(getNzbPermissions("nfo") != 0?"<a href=nzbviewnfo.php?id=$row[id]><b>View NFO</b></a> (" . mksize($row["nfosz"]) . ")":getNzbPermissions("nfomsg"))."</td></tr>\n"); if ($row["url"] != "") tr("Info URL", format_urls(safe($row["url"])), 1); if (isset($row["cat_name"])) tr("Type", $row["cat_name"]); else tr("Type", "(none selected)"); if ($row["autoimdb"] == "no" && $row["genre"] != "") tr("Genre", safe($row["genre"]), 1); tr("Size",mksize($row["size"]) . " (" . number_format($row["size"]) . " bytes)"); tr("Poster", $row["poster"]); $datenix = $row["postdate"]; $agepost = show_age($datenix); $datepost = date("Y-m-d H:i:s", $datenix); tr("Posted", $datepost." ($agepost days ago)"); $groups = unserialize($row['groups']); if (is_array($groups)) { $grp = ""; foreach ($groups as $key=>$val) { $grp .= "$val\n"; } } else { $grp = $groups; } tr("Groups", safe($grp)); if ($row["pars"] > 0) { $percentpars = sprintf( "%.2f", (($row["partotsize"] / ($row["size"] - $row["partotsize"])) * 100)); } tr("par2 Files", ($row['pars'] == 0?"None":$row['pars'].", ".mksize($row["partotsize"])." in total (Can rebuild approx $percentpars% of total filesize)")); tr("NZB Added", $row["added"]); tr("Views", $row["views"]); tr("Grabs", $row["hits"]); $uprow = (isset($row["username"]) ? ("<a href=userdetails.php?id=" . $row["owner"] . "><b>" . safe($row["username"]) . "</b></a>") : "<i>unknown</i>"); /* USE ABOVE ^^^ OR BELOW vvv DEPENDING ON WHETHER YOU HAVE THE ANONYMOUS UPLOADER MOD */ /* $addnam = $row['advertisename']; $keepget = ""; $uprow = ("<i>Anonymous</i>"); if (get_user_class() >= UC_MODERATOR) $uprow = (isset($row["username"]) ? ("<a href=userdetails.php?id=" . $row["owner"] . "><b>" . safe($row["username"]) . "</b></a>") : "<i>unknown</i>"); if ($addnam == "yes") $uprow = (isset($row["username"]) ? ("<a href=userdetails.php?id=" . $row["owner"] . "><b>" . safe($row["username"]) . "</b></a>") : "<i>unknown</i>"); */ if ($owned) $uprow .= " $spacer<$editlink><b>[Edit this NZB]</b></a>"; tr("Upped by", $uprow, 1); //tr("Report<br />NZB", "Click <a href=\"report.php?typ=nzb&id=$id\"><b><font color=\"#ff0532\">here</font></b></a> to report this NZB to staff for violation of the rules", 1); if (!$_GET["filelist"]) { tr("Num files<br /><a href=\"nzbdetails.php?id=$id&filelist=1$keepget#filelist\" class=\"sublink\">[see full list]</a>", $row["numfiles"] . " files", 1); } else { tr("Num files", $row["numfiles"] . " files", 1); tr("<a name=\"filelist\">File list</a><br /><a href=\"nzbdetails.php?id=$id$keepget\" class=\"sublink\">[Hide list]</a>", showpieces($id, $row["name"], $row['nzbvernum']), 1); } print("</table></p>\n"); /* The comparison value of '0' with $datenix is so that failed uploads with no nzbs.datepost value can be deleted by the uploader */ if (($datenix!=0) && (get_user_class() >= UC_MODERATOR)) { print("<p>\n"); print("<form method=\"post\" action=\"nzbdelete.php\">\n"); print("<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n"); print("<tr><td class=\"row2\" colspan=\"2\"><b>Delete NZB.</b> Reason:</td></tr>"); // print("<td><input name=\"reasontype\" type=\"radio\" value=\"1\"> Expired </td><td>$SITENZBRETENTION days old</td></tr>\n"); print("<tr><td><input name=\"reasontype\" type=\"radio\" value=\"2\"> Dupe</td><td><input type=\"text\" size=\"40\" name=\"reason[]\"></td></tr>\n"); print("<tr><td><input name=\"reasontype\" type=\"radio\" value=\"3\"> Nuked</td><td><input type=\"text\" size=\"40\" name=\"reason[]\"></td></tr>\n"); print("<tr><td><input name=\"reasontype\" type=\"radio\" value=\"4\"> Rules</td><td><input type=\"text\" size=\"40\" name=\"reason[]\">(req)</td></tr>"); print("<tr><td><input name=\"reasontype\" type=\"radio\" value=\"5\" checked=\"checked\" /> Other:</td><td><input type=\"text\" size=\"40\" name=\"reason[]\">(req)</td></tr>\n"); print("<input type=\"hidden\" name=\"id\" value=\"$id\" />\n"); if (isset($_GET["returnto"])) print("<input type=\"hidden\" name=\"returnto\" value=\"" . safe($_GET["returnto"]) . "\" />\n"); print("<td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"Delete it!\" class=\"codebuttons\" style=\"width:120px;height:25px;\" /></td></tr>\n"); print("</table>"); print("</form>\n"); print("</p>\n"); } elseif (($datenix==0) && (getNzbPermissions("ulnzb")==1)) { print("<p>\n"); print("<form method=\"post\" action=\"nzbdelete.php\">\n"); print("<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n"); print("<tr><td class=\"row2\" colspan=\"2\"><b>Delete Failed NZB.</b> Reason:</td></tr>"); print("<tr><td><input name=\"reasontype\" type=\"hidden\" value=\"5\" /> What happened?:</td><td><input type=\"text\" size=\"40\" name=\"reason[]\">(req)</td></tr>\n"); print("<input type=\"hidden\" name=\"id\" value=\"$id\" />\n"); if (isset($_GET["returnto"])) print("<input type=\"hidden\" name=\"returnto\" value=\"" . safe($_GET["returnto"]) . "\" />\n"); print("<td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"Delete it!\" class=\"codebuttons\" style=\"width:120px;height:25px;\" /></td></tr>\n"); print("</table>"); print("</form>\n"); print("</p>\n"); } } else { stdhead("Comments for NZB \"" . $row["name"] . "\""); print("<h1>Comments for <a href=\"nzbdetails.php?id=$id\">" . $row["name"] . "</a></h1>\n"); } print("<p><a name=\"startcomments\"></a></p>\n"); $commentbar = "<p align=\"center\"><a class=\"index\" href=\"nzbcomment.php?action=add&tid=$id\">Add a comment</a></p>\n"; $subres = mysql_query("SELECT COUNT(*) FROM nzbcomments WHERE nzb = $id"); $subrow = mysql_fetch_array($subres); $count = $subrow[0]; if (!$count) { print("<h2>No comments yet</h2>\n"); } else { list($pagertop, $pagerbottom, $limit) = pager(20, $count, "nzbdetails.php?id=$id&", array(lastpagedefault => 1)); $subres = mysql_query("SELECT nzbcomments.id, text, user, nzbcomments.added, editedby, editedat, avatar, warned, ". "username, title, class, donor FROM nzbcomments LEFT JOIN users ON nzbcomments.user = users.id WHERE nzb = " . "$id ORDER BY nzbcomments.id $limit") or sqlerr(__FILE__, __LINE__); /* USE ABOVE ^^^ OR BELOW vvv DEPENDING ON WHETHER YOU HAVE THE ANONYMOUS UPLOADER MOD */ /* $subres = mysql_query("SELECT nzbcomments.id, text, user, nzbcomments.added, editedby, editedat, avatar, warned, ". "username, title, class, donor, advertisename FROM nzbcomments LEFT JOIN users ON nzbcomments.user = users.id WHERE nzb = " . "$id ORDER BY nzbcomments.id $limit") or sqlerr(__FILE__, __LINE__); */ $allrows = array(); while ($subrow = mysql_fetch_array($subres)) $allrows[] = $subrow; print($commentbar); print($pagertop); nzbcommenttable($allrows, $row["owner"]); print($pagerbottom); } print($commentbar); stdfoot(); ?> any help would be much appreciated ive been trying this for days but either the page goes blank or when i get the image on there when i click the image instead of downloading the nzb it takes me to a blank page thanx in advance gemma x Quote Link to comment https://forums.phpfreaks.com/topic/99377-php-help/ Share on other sites More sharing options...
paul2463 Posted April 3, 2008 Share Posted April 3, 2008 change this line $pl .= "<br /><div align=\"center\"><input type=\"submit\" name=\"dlzip\" value=\"Download Selected in Zip File\" class=\"codebuttons\" style=\"width:200px;height:25px;\" />". " <input type=\"submit\" name=\"dlnzb\" value=\"Download Selected as NZB\" class=\"codebuttons\" style=\"width:200px;height:25px;\" /></div><br /><br />\n"; to this $pl .= "<br /><div align=\"center\"><input type=\"image\" name=\"dlzip\" src=\"image location\" style=\"width:200px;height:25px;\" alt=\"ZIP\"/>". " <input type=\"image\" name=\"dlnzb\" src=\"image location\" style=\"width:200px;height:25px;\" alt=\"NZB\"/></div><br /><br />\n"; not forgetting to place the image locations in where it says "image location" Quote Link to comment https://forums.phpfreaks.com/topic/99377-php-help/#findComment-508491 Share on other sites More sharing options...
gemma134uk Posted April 3, 2008 Author Share Posted April 3, 2008 thanx for the fast reply but the buttons are still there do you think the buttons are loacated lower down in code? EDIT: below is the code i need editing sorry about that // Get permissions for download link display if ((getNzbPermissions("zip") == 1 || getNzbPermissions("nzb") == 1) && $CURUSER["nzbstodaydl"] < getNzbPermissions("maxdlpday")) { print("<form action=\"nzbdownload.php/$id/" . rawurlencode($row["name"]) . ".nzb\" method=\"post\">"); print("<tr><td class=\"rowhead\" width=\"1%\">Download</td><td width=\"99%\" align=\"center\">"); if (getNzbPermissions("zip") == 1) print("<input type=\"submit\" name=\"dlzip\" value=\"Download As Zip File\" class=\"codebuttons\" style=\"width:150px;height:25px;\" />"); if (getNzbPermissions("nzb") == 1) print(" <input type=\"submit\" name=\"dlnzb\" value=\"Download As NZB\" class=\"codebuttons\" style=\"width:150px;height:25px;\" />"); print(" "); print("</td></tr>"); print("</form>\n"); } elseif ((getNzbPermissions("zip") == 1 || getNzbPermissions("nzb") == 1) && $CURUSER["nzbstodaydl"] >= getNzbPermissions("maxdlpday")) { print("<tr><td class=\"rowhead\" width=\"1%\">Download</td><td width=\"99%\" align=\"center\">"); print(getNzbPermissions("maxmsg")."</td></tr>"); } else { print("<tr><td class=\"rowhead\" width=\"1%\">Download</td><td width=\"99%\" align=\"center\">"); print(getNzbPermissions("nzbmsg")."</td></tr>"); } Quote Link to comment https://forums.phpfreaks.com/topic/99377-php-help/#findComment-508502 Share on other sites More sharing options...
paul2463 Posted April 3, 2008 Share Posted April 3, 2008 what you need to do is to find all references to < input type=\"submit\" which mention the download parts and replace it with < input type=\"image\" then also remove the value part and replace with src=\"image location\" for ech button hope that helps Quote Link to comment https://forums.phpfreaks.com/topic/99377-php-help/#findComment-508518 Share on other sites More sharing options...
gemma134uk Posted April 3, 2008 Author Share Posted April 3, 2008 when i change the input to image instead of displaying the images ect it just shows me the code < input type="image" name="dlzip" value="Download As Zip File" class="codebuttons" style="width:150px;height:25px;" /> < input type="image" name="dlnzb" value="Download As NZB" class="codebuttons" style="width:150px;height:25px;" /> sorry to be a pain but any chance you could edit the nzbdetails.php in the 1st post to what you think will work so i can just try the nzbdetails.php you paste to see if it works as im a bit of a php noob and am probly doing it wrong thanx gemma x or not normally this trusting but if you have a email addy il give you the ftp details to try it yourself as its doing my head in now lol Quote Link to comment https://forums.phpfreaks.com/topic/99377-php-help/#findComment-508535 Share on other sites More sharing options...
paul2463 Posted April 3, 2008 Share Posted April 3, 2008 unfortunately if you want someone to write your code for you then you need to be in freelancing and pay for it, here we help each other to learn by pointing out the mistakes and going away and correcting them, you did not follow my instructions fully all you did was to change the word "submit" for the word "image" now go back and remove all the "value" coding and replace it with "src" coding as I did in the first post I replied to you, if you then add an "alt" coding to it , if it cant find the image that's the word it will put there, again as I did in the first post I made on this. I am not trying to make excuses so I don't have to write it for you - I don't - but I have pointed out what you need to do and you will learn more by doing it for yourself Quote Link to comment https://forums.phpfreaks.com/topic/99377-php-help/#findComment-508544 Share on other sites More sharing options...
gemma134uk Posted April 3, 2008 Author Share Posted April 3, 2008 ok the images are now in place the code is below but when i click the download nzb or download zip it takes me to a page not found rather than the nzb if (getNzbPermissions("zip") == 1) print("<input type=\"image\" name=\"dlzip\" src=\"/image/zip.gif\" style=\"width:200px;height:25px;\" alt=\"ZIP\"/>"); if (getNzbPermissions("nzb") == 1) print(" <input type=\"image\" name=\"dlnzb\" src=\"/images/nzb.gif\" style=\"width:200px;height:25px;\" alt=\"NZB\"/>"); thanx for your help so far i am learning (slowly lol) Quote Link to comment https://forums.phpfreaks.com/topic/99377-php-help/#findComment-508561 Share on other sites More sharing options...
paul2463 Posted April 3, 2008 Share Posted April 3, 2008 that then is a problem with the form coding as long as the clicking the image takes you somewhere then that bit works, you now have to look at the "FORM ACTION=\"somewhere.php\" and see where it is supposed to send you, when you have loaded the page have a look at the page source and see where it is going to send you and see if that is where you want to go. Quote Link to comment https://forums.phpfreaks.com/topic/99377-php-help/#findComment-508565 Share on other sites More sharing options...
gemma134uk Posted April 3, 2008 Author Share Posted April 3, 2008 the form from the nzbdetails.php with the normal buttons is (it downloads the nzb with this 1) nzbdownload.php/50/Tom%20Clancys%20Rainbow%20Six%20Vegas%202%20PAL%20X360%20Allstars.nzb the form from the edited nzbdetails.php that we just added the images is nzbdownload.php/50/Tom%20Clancys%20Rainbow%20Six%20Vegas%202%20PAL%20X360%20Allstars.nzb its the same but if i type www.topnzbs.com/nzbdownload.php/50/Tom%20Clancys%20Rainbow%20Six%20Vegas%202%20PAL%20X360%20Allstars.nzb in my address bar it goes to the blank page to so im guesing it has to go through the nzbdownload.php to get the nzb?so how come it works fine with the old buttons and not with the new images when all we have changed is the button to image? thanx gemma Quote Link to comment https://forums.phpfreaks.com/topic/99377-php-help/#findComment-508572 Share on other sites More sharing options...
paul2463 Posted April 3, 2008 Share Posted April 3, 2008 I think I know what the problem is, when you change it to an image instead of sending the name it sends the names location here is what I mean, please ignore the test data involved for the minute with button Array ( [dlzip] => Download As Zip File ) with image Array ( [dlzip_x] => 24 [dlzip_y] => 13 ) notice that the dlzip part has now been split into an x and a y value, if your checking page needs the posted value of "DLZIP" or "DLNZB" then you will have to do the following under each instance of the changed image you have done put either one of the two folloing line which is appropriate print("<input type="hidden", name="dlzip" value="Download As Zip File" />"); print("<input type="hidden", name="dlnzb" value="Download As NZB" />"); so your code above would read if (getNzbPermissions("zip") == 1) print("<input type=\"image\" name=\"dlzip\" src=\"/image/zip.gif\" style=\"width:200px;height:25px;\" alt=\"ZIP\"/>"); print("<input type="hidden", name="dlzip" value="Download As Zip File" />"); if (getNzbPermissions("nzb") == 1) print(" <input type=\"image\" name=\"dlnzb\" src=\"/images/nzb.gif\" style=\"width:200px;height:25px;\" alt=\"NZB\"/>"); print("<input type="hidden", name="dlnzb" value="Download As NZB" />"); these will send the right value across with the image such as now it prints out Array ( [dlzip] => Download As Zip File [dlzip_x] => 15 [dlzip_y] => 16 ) i hope all that makes sense Quote Link to comment https://forums.phpfreaks.com/topic/99377-php-help/#findComment-508583 Share on other sites More sharing options...
gemma134uk Posted April 3, 2008 Author Share Posted April 3, 2008 ok ive added the code you just put in and the whole page goes blank if (getNzbPermissions("zip") == 1) print("<input type=\"image\" name=\"dlzip\" src=\"/image/zip.gif\" style=\"width:200px;height:25px;\" alt=\"ZIP\"/>"); print("<input type="hidden", name="dlzip" value="Download As Zip File" />"); if (getNzbPermissions("nzb") == 1) print(" <input type=\"image\" name=\"dlnzb\" src=\"/images/nzb.gif\" style=\"width:200px;height:25px;\" alt=\"NZB\"/>"); print("<input type="hidden", name="dlnzb" value="Download As NZB" />"); below is the code in the whole .php have i done it right? <?php /*************************************************************************** * NZB Details Page * ======================================== * NZB Mod - Public v.TS-1.0b * TorrentStrike version * ======================================== * created by dodgy * http://www.webdeviation.com * Special thanks to all who have had a hand in TBDev/TorrentStrike ***************************************************************************/ ob_start("ob_gzhandler"); ?> <script LANGUAGE="JavaScript"> <!-- Begin var checkflag = "false"; function check(field) { if (checkflag == "false") { for (i = 0; i < field.length; i++) { field[i].checked = true;} checkflag = "true"; return "Uncheck All"; } else { for (i = 0; i < field.length; i++) { field[i].checked = false; } checkflag = "false"; return "Check All"; } } // End --> </script> <? require_once("include/bittorrent.php"); include_once("imdb/imdb.class.php"); // ----- For display of row with missing segments: function missing_segments($segments, $subjseg) { if ($segments == $subjseg) $display = ">($segments/$subjseg)"; elseif ($segments < $subjseg) $display = " color=\"red\">($segments/$subjseg)"; elseif ($segments > $subseg) $display = " color=\"green\">($segments/$subjseg)"; return $display; } // ----- Cleans NZB Subjects (not finished - add your own): function clean_nzb_subj($string) { $string = str_replace(""", " ", $string); $string = str_replace("è", "e", $string); $string = str_replace(""", "\"", $string); $string = str_replace("_", " ", $string); return $string; } /* ---- To retrieve piece information from dB & display it on nzb page, with form that will record which pieces are selected by user & therefore which pieces will be retrieved. ---- */ function showpieces($id, $nzbname, $nzbvernum) { $pl = "<form name=\"partnzb\" action=\"partnzbdload.php\" method=\"post\" enctype=\"multipart/form-data\">\n"; $pl .= "<table width=\"100%\" class=\"main\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\">\n"; $pl .= "<tr><td width=\"3%\" class=\"colhead\" align=\"right\">Dl?</td>". "<td class=\"colhead\">Subject</td>". "<td width=\"8%\" class=\"colhead\" align=\"right\">Size</td>". "<td width=\"8%\" class=\"colhead\" align=\"right\">Date</td>". "<td width=\"6%\" class=\"colhead\" align=\"right\">Parts</td></tr>\n"; $piecelist = @mysql_query("SELECT nzb_piece, piece_date, piece_subject, piece_size, piece_segments, piece_subjseg FROM nzbpiecelist WHERE nzb = $id ORDER BY nzb_piece"); while ($plist = mysql_fetch_array($piecelist)) { // Convert date: $dateunix = $plist['piece_date']; $dateposted = date("Y-m-d G:i:s", $dateunix); // Segment display/calculation: $segments = 0 + $plist['piece_segments']; $subjseg = 0 + $plist['piece_subjseg']; // the rows: $pl .= "<tr><td>".(getNzbPermissions("part")==1 && $CURUSER["nzbstodaydl"] < getNzbPermissions("maxdlpday")?"<input type=\"checkbox\" name=\"nzbpieces[]\" ". "value=\"" . $plist['nzb_piece'] . "\" />":"")."</td>". "<td><font class=\"small\">" . safe(clean_nzb_subj($plist['piece_subject'])) . "</font></td>". "<td align=right><font class=\"small\">" . mksize($plist['piece_size']) . "</font></td>". "<td align=right><font class=\"small\">" . $dateposted . "</font></td>". "<td align=right><font class=\"small\"" . missing_segments($segments, $subjseg) . "</font></td></tr>\n"; } $pl .= "</table>\n". "<input type=\"hidden\" name=\"nzb\" value=\"" . $id ."\" />". "<input type=\"hidden\" name=\"nzb_name\" value=\"" . $nzbname ."\" />". "<input type=\"hidden\" name=\"nzbvernum\" value=\"" . $nzbvernum ."\" />". "<input type=\"button\" value=\"Check all\" onClick=\"this.value=check(partnzb)\" class=\"codebuttons\" style=\"width:90px;height:25px;\" />"; if (getNzbPermissions("part") == 1 && $CURUSER["nzbstodaydl"] < getNzbPermissions("maxdlpday")) { $pl .= "<br /><div align=\"center\"><input type=\"submit\" name=\"dlzip\" value=\"Download Selected in Zip File\" class=\"codebuttons\" style=\"width:200px;height:25px;\" />". " <input type=\"submit\" name=\"dlnzb\" value=\"Download Selected as NZB\" class=\"codebuttons\" style=\"width:200px;height:25px;\" /></div><br /><br />\n"; } elseif (getNzbPermissions("part") == 1 && $CURUSER["nzbstodaydl"] >= getNzbPermissions("maxdlpday")) { $pl .= "<br /><div align=\"center\">".getNzbPermissions("maxmsg")."</div><br /><br />\n"; } else { $pl .= "<br /><div align=\"center\">".getNzbPermissions("partmsg")."</div><br /><br />\n"; } $pl .= "<a href=\"nzbdetails.php?id=$id\" class=\"sublink\">[Hide list]</a>". "</form>\n"; return $pl; } loggedinorreturn(); $id = 0 + $_GET["id"]; if (!isset($id) || !$id) die(); $res = mysql_query("SELECT nzbs.owner, nzbs.name, nzbs.descr, nzbs.category, LENGTH(nzbs.nfo)AS nfosz, nzbs.filename, nzbs.size, nzbs.numfiles, nzbs.poster, nzbs.postdate, nzbs.groups, nzbs.id, nzbs.added, nzbs.views, nzbs.hits, nzbs.pars, nzbs.partotsize, nzbs.nzbvernum, nzbs.autoimdb, nzbs.url, nzbs.imdbrating, nzbs.genre, nzbs.addtext, nzbs.format, nzbcategories.name AS cat_name, users.username FROM nzbs LEFT JOIN nzbcategories ON nzbs.category = nzbcategories.id LEFT JOIN users ON nzbs.owner = users.id WHERE nzbs.id = $id") or sqlerr(); /* $res = mysql_query("SELECT nzbs.owner, nzbs.name, nzbs.descr, nzbs.category, LENGTH(nzbs.nfo)AS nfosz, nzbs.filename, nzbs.size, nzbs.numfiles, nzbs.poster, nzbs.postdate, nzbs.groups, nzbs.id, nzbs.added, nzbs.views, nzbs.hits, nzbs.pars, nzbs.partotsize, nzbs.nzbvernum, nzbs.autoimdb, nzbs.url, nzbs.imdbrating, nzbs.genre, nzbs.addtext, nzbs.format, nzbcategories.name AS cat_name, users.username, users.advertisename FROM nzbs LEFT JOIN nzbcategories ON nzbs.category = nzbcategories.id LEFT JOIN users ON nzbs.owner = users.id WHERE nzbs.id = $id") or sqlerr(); // USE THIS QUERY IF ANONYMOUS UPLOADER MOD PRESENT */ $row = mysql_fetch_array($res); // -------------------------------Auto IMDB Mod--------------------------------------------// if ($row["autoimdb"] == "yes") { if (($row["url"] != "")AND(strpos($row["url"], "imdb"))AND(strpos($row["url"], "title"))) { $thenumbers = ltrim(strrchr($row["url"],'tt'),'tt'); $thenumbers = ereg_replace("[^A-Za-z0-9]", "", $thenumbers); $movie = new imdb ($thenumbers); $movieid = $thenumbers; $movie->setid ($movieid); $country = $movie->country (); $director = $movie->director(); $write = $movie->writing(); //$produce = $movie->producer(); $cast = $movie->cast(); $plot = $movie->plot (); $genres = $movie->genres (); $photoremurl = $movie->photo (); if ($photoremurl) { $autodata = "[img=".$photoremurl."]"; } $autodata .= "[img=pic/sml_info.gif]"; // This'll also be useful for storage further down: $movtitle = (string) $movie->title (); $movtitle = str_replace(array(""", "&", "[", "]"), array("\"", "&", "(", ")"), $movtitle); $autodata .= "[b][color=DimGray] Title: [/color][color=DarkSlateBlue] " . "".$movtitle."[/color][/b]\n"; $autodata .= "[b][color=DimGray] Alt Titles : [/color][color=DarkSlateBlue] "; if ($movie->alsoknow() != "") { foreach ( $movie->alsoknow() as $ak){ $autodata .= "".str_replace(array(""", "[", "]"), array("\"", "(", ")"), $ak["title"])."" . "".$ak["year"]."" . "".$ak["country"]."" . " (" . "".$ak["comment"]."" . ")" . ", "; } } $autodata .= "[/color][/b]\n[b][color=DimGray] Year: [/color][color=DarkSlateBlue] " . "".$movie->year ()."[/color][/b]\n"; $autodata .= "[b][color=DimGray] Runtime: [/color][color=DarkSlateBlue] " . "".$movie->runtime ()."" . " mins[/color][/b]\n"; // store rating for later use $movrating = $movie->rating (); $desc_rating = ($movrating == ""?"Not Yet Rated":$movrating); $autodata .= "[b][color=DimGray] User Rating: [/color][color=DarkSlateBlue] " . "".$desc_rating."[/color][/b]\n"; $desc_votes = (string) $movie->votes (); $desc_votes = (strlen($desc_votes)>7?substr($desc_votes,0, 7):$desc_votes); $desc_votes = str_replace(array(""", "&", "[", "]"), array("\"", "&", "(", ")"), $desc_votes); $autodata .= "[b][color=DimGray] Votes: [/color][color=DarkSlateBlue] " . "".$desc_votes."[/color][/b]\n"; $autodata .= "[b][color=DimGray] Language: [/color][color=DarkSlateBlue] " . "".$movie->language ()."[/color][/b]\n"; $autodata .= "[b][color=DimGray] Country: [/color][color=DarkSlateBlue] "; for ($i = 0; $i < count ($country); $i++) { $autodata .= "$country[$i]"; } for ($i = 0; $i < count ($genres); $i++) { $the_genres .= "$genres[$i] "; } $autodata .= "[/color][/b]\n[b][color=DimGray] Genre: [/color][color=DarkSlateBlue]" . "".$the_genres."[/color][/b]\n"; $tagline = $movie->tagline (); $tagline = str_replace(array(""", "&", "[", "]"), array("\"", "&", "(", ")"), $tagline); $autodata .= "[b][color=DimGray] Tagline: [/color][color=DarkSlateBlue] ".$tagline."[/color][/b]\n"; $autodata .= "[b][color=DimGray] Director(s): [/color][color=DarkSlateBlue]"; for ($i = 0; $i < count ($director); $i++) { $autodata .= "[url=http://us.imdb.com/Name?" . "".$director[$i]["imdb"]."" ."]" . "".$director[$i]["name"]."" . "[/url] "; } $autodata .= "[/color][/b]\n[b][color=DimGray] Writer(s): [/color][/b]"; for ($i = 0; $i < count ($write); $i++) { $autodata .= "[url=http://us.imdb.com/Name?" . "".$write[$i]["imdb"]."" ."]" . "".$write[$i]["name"]."" . "[/url] "; } $autodata .= "\n[b][color=DimGray] Trailer (if any): [/color][color=DarkSlateBlue][url=http://www.imdb.com/title/tt$thenumbers/trailers]Click here[/url][/color][/b]"; /* $autodata .= "\n[b][color=DimGray] Producer(s): [/color][/b]"; for ($i = 0; $i < count ($produce); $i++) { $autodata .= "[url=http://us.imdb.com/Name?" . "".$produce[$i]["imdb"]."" ."]" . "".$produce[$i]["name"]."" . "[/url] "; } */ $autodata .= "\n\n\n[img=pic/sml_desc.gif]"; // $autodata .= "[b][color=darkred] Plot Outline: [/color][/b]"; for ($i = 0; $i < count ($plot); $i++) { $the_plot .= "$plot[$i]"; } if ($the_plot == "") $the_plot = "No plot summary available"; // If you're wondering what this $big_letter is for, it's something I did for BB-Code on Drugs, coming soon $big_letter = substr($the_plot, 0, 1); $rest_of_plot = substr($the_plot, 1); $rest_of_plot = str_replace(array("[", "]"), array("(", ")"), $rest_of_plot); $autodata .= str_replace(""", "\"", "[color=DimGray][b]".$big_letter."".strip_tags($rest_of_plot)."[/b][/color]"); $autodata .= "\n\n\n\n[img=pic/sml_cast.gif]"; for ($i = 0; $i < count ($cast); $i++) { if ($i > 9) { break; } $autodata .= "[color=DimGray]•[/color] " . "[url=http://us.imdb.com/Name?" . "".$cast[$i]["imdb"]."" ."]" . "".$cast[$i]["name"]."" . "[/url] " . " as [b][color=DimGray]" . "".$cast[$i]["role"]."" . " [/color][/b]\n"; } $autodata .= "\n\n\n"; // to update nzbs table fields on upload/edit $checkme = 0; if (($row["imdbrating"] == "" && $row["genre"] == "") || !empty($_GET["edited"])) { // get some variables to update database $movyear = (string) $movie->year (); $movgenre = (string) $movie->genre (); $movietitle = sqlesc($movtitle." ($movyear)"); $moviegenre = sqlesc(substr($movgenre, 0, 20)); $movrating = ($movrating == ""?"NYR":$movrating); $movierating = sqlesc(strval($movrating)); mysql_query("UPDATE nzbs SET name = $movietitle, imdbrating = $movierating, genre = $moviegenre WHERE id = ".$row["id"]); $checkme = 1; } if ($_GET["uploaded"] && $checkme == 1) header("Location: $BASEURL/nzbdetails.php?id=".$row["id"]."&uploaded=1"); if ($_GET["edited"] && $checkme == 1) header("Location: $BASEURL/nzbdetails.php?id=".$row["id"]."&edited=1"); if ($checkme == 1) header("Location: $BASEURL/nzbdetails.php?id=".$row["id"].""); } } // ------------------------------------------------------------------------------------------// $owned = $moderator = 0; if (get_user_class() >= UC_MODERATOR) $owned = $moderator = 1; elseif ($CURUSER["id"] == $row["owner"]) $owned = 1; if ($_GET["hit"]) { mysql_query("UPDATE nzbs SET views = views + 1 WHERE id = $id"); if ($_GET["tocomm"]) header("Location: $BASEURL/nzbdetails.php?id=$id&page=0#startcomments"); elseif ($_GET["filelist"]) header("Location: $BASEURL/nzbdetails.php?id=$id&filelist=1#filelist"); else header("Location: $BASEURL/nzbdetails.php?id=$id"); exit(); } if (!isset($_GET["page"])) { stdhead("Details for nzb \"" . $row["name"] . "\""); $spacer = " "; if ($_GET["uploaded"]) { print("<h2>Successfully uploaded!</h2>\n"); } elseif ($_GET["edited"]) { print("<h2>Successfully edited!</h2>\n"); if (isset($_GET["returnto"])) print("<p><b>Go back to <a href=\"" . safe($_GET["returnto"]) . "\">whence you came</a>.</b></p>\n"); } elseif (isset($_GET["searched"])) { print("<h2>Your search for \"" . safe($_GET["searched"]) . "\" gave a single result:</h2>\n"); } $addtext = safe($row["addtext"])." "; $format = ($row["format"]!="na"?" <img src=\"".$pic_base_url."sml_".$row["format"].".gif\" alt=\"".$row["format"]."\" />":""); $s=$row["name"]; print("<h1>$s</h1>\n"); print("<h3>.: $addtext $format :.</h3><br /><br />\n"); print("<table width=\"750\" border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n"); $url = "nzbedit.php?id=" . $row["id"]; if (isset($_GET["returnto"])) { $addthis = "&returnto=" . urlencode($_GET["returnto"]); $url .= $addthis; $keepget .= $addthis; } $editlink = "a href=\"$url\" class=\"sublink\""; // Get permissions for download link display if ((getNzbPermissions("zip") == 1 || getNzbPermissions("nzb") == 1) && $CURUSER["nzbstodaydl"] < getNzbPermissions("maxdlpday")) { print("<form action=\"nzbdownload.php/$id/" . rawurlencode($row["name"]) . ".nzb\" method=\"post\">"); print("<tr><td class=\"rowhead\" width=\"1%\">Download</td><td width=\"99%\" align=\"center\">"); if (getNzbPermissions("zip") == 1) print("<input type=\"image\" name=\"dlzip\" src=\"/image/zip.gif\" style=\"width:200px;height:25px;\" alt=\"ZIP\"/>"); print("<input type="hidden", name="dlzip" value="Download As Zip File" />"); if (getNzbPermissions("nzb") == 1) print(" <input type=\"image\" name=\"dlnzb\" src=\"/images/nzb.gif\" style=\"width:200px;height:25px;\" alt=\"NZB\"/>"); print("<input type="hidden", name="dlnzb" value="Download As NZB" />"); print(" "); print("</td></tr>"); print("</form>\n"); } elseif ((getNzbPermissions("zip") == 1 || getNzbPermissions("nzb") == 1) && $CURUSER["nzbstodaydl"] >= getNzbPermissions("maxdlpday")) { print("<tr><td class=\"rowhead\" width=\"1%\">Download</td><td width=\"99%\" align=\"center\">"); print(getNzbPermissions("maxmsg")."</td></tr>"); } else { print("<tr><td class=\"rowhead\" width=\"1%\">Download</td><td width=\"99%\" align=\"center\">"); print(getNzbPermissions("nzbmsg")."</td></tr>"); } if (!empty($row["image"])) tr("Picture:", "<img src='".$row["image"]."'>", 1); else tr("Picture:", "<img src=image.jpg>", 1); if (!empty($row["descr"])) $descr = $row["descr"]; else $descr = " "; $autodata = ($row["autoimdb"] == "yes"?format_comment($autodata)."":""); $descri = format_comment($descr); tr("Description", $autodata."".$descri, 1); if ($row["nfosz"] > 0) print("<tr><td class=\"rowhead\" align=\"right\">NFO</td><td align=\"left\">".(getNzbPermissions("nfo") != 0?"<a href=nzbviewnfo.php?id=$row[id]><b>View NFO</b></a> (" . mksize($row["nfosz"]) . ")":getNzbPermissions("nfomsg"))."</td></tr>\n"); if ($row["url"] != "") tr("Info URL", format_urls(safe($row["url"])), 1); if (isset($row["cat_name"])) tr("Type", $row["cat_name"]); else tr("Type", "(none selected)"); if ($row["autoimdb"] == "no" && $row["genre"] != "") tr("Genre", safe($row["genre"]), 1); tr("Size",mksize($row["size"]) . " (" . number_format($row["size"]) . " bytes)"); tr("Poster", $row["poster"]); $datenix = $row["postdate"]; $agepost = show_age($datenix); $datepost = date("Y-m-d H:i:s", $datenix); tr("Posted", $datepost." ($agepost days ago)"); $groups = unserialize($row['groups']); if (is_array($groups)) { $grp = ""; foreach ($groups as $key=>$val) { $grp .= "$val\n"; } } else { $grp = $groups; } tr("Groups", safe($grp)); if ($row["pars"] > 0) { $percentpars = sprintf( "%.2f", (($row["partotsize"] / ($row["size"] - $row["partotsize"])) * 100)); } tr("par2 Files", ($row['pars'] == 0?"None":$row['pars'].", ".mksize($row["partotsize"])." in total (Can rebuild approx $percentpars% of total filesize)")); tr("NZB Added", $row["added"]); tr("Views", $row["views"]); tr("Grabs", $row["hits"]); $uprow = (isset($row["username"]) ? ("<a href=userdetails.php?id=" . $row["owner"] . "><b>" . safe($row["username"]) . "</b></a>") : "<i>unknown</i>"); /* USE ABOVE ^^^ OR BELOW vvv DEPENDING ON WHETHER YOU HAVE THE ANONYMOUS UPLOADER MOD */ /* $addnam = $row['advertisename']; $keepget = ""; $uprow = ("<i>Anonymous</i>"); if (get_user_class() >= UC_MODERATOR) $uprow = (isset($row["username"]) ? ("<a href=userdetails.php?id=" . $row["owner"] . "><b>" . safe($row["username"]) . "</b></a>") : "<i>unknown</i>"); if ($addnam == "yes") $uprow = (isset($row["username"]) ? ("<a href=userdetails.php?id=" . $row["owner"] . "><b>" . safe($row["username"]) . "</b></a>") : "<i>unknown</i>"); */ if ($owned) $uprow .= " $spacer<$editlink><b>[Edit this NZB]</b></a>"; tr("Upped by", $uprow, 1); //tr("Report<br />NZB", "Click <a href=\"report.php?typ=nzb&id=$id\"><b><font color=\"#ff0532\">here</font></b></a> to report this NZB to staff for violation of the rules", 1); if (!$_GET["filelist"]) { tr("Num files<br /><a href=\"nzbdetails.php?id=$id&filelist=1$keepget#filelist\" class=\"sublink\">[see full list]</a>", $row["numfiles"] . " files", 1); } else { tr("Num files", $row["numfiles"] . " files", 1); tr("<a name=\"filelist\">File list</a><br /><a href=\"nzbdetails.php?id=$id$keepget\" class=\"sublink\">[Hide list]</a>", showpieces($id, $row["name"], $row['nzbvernum']), 1); } print("</table></p>\n"); /* The comparison value of '0' with $datenix is so that failed uploads with no nzbs.datepost value can be deleted by the uploader */ if (($datenix!=0) && (get_user_class() >= UC_MODERATOR)) { print("<p>\n"); print("<form method=\"post\" action=\"nzbdelete.php\">\n"); print("<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n"); print("<tr><td class=\"row2\" colspan=\"2\"><b>Delete NZB.</b> Reason:</td></tr>"); // print("<td><input name=\"reasontype\" type=\"radio\" value=\"1\"> Expired </td><td>$SITENZBRETENTION days old</td></tr>\n"); print("<tr><td><input name=\"reasontype\" type=\"radio\" value=\"2\"> Dupe</td><td><input type=\"text\" size=\"40\" name=\"reason[]\"></td></tr>\n"); print("<tr><td><input name=\"reasontype\" type=\"radio\" value=\"3\"> Nuked</td><td><input type=\"text\" size=\"40\" name=\"reason[]\"></td></tr>\n"); print("<tr><td><input name=\"reasontype\" type=\"radio\" value=\"4\"> Rules</td><td><input type=\"text\" size=\"40\" name=\"reason[]\">(req)</td></tr>"); print("<tr><td><input name=\"reasontype\" type=\"radio\" value=\"5\" checked=\"checked\" /> Other:</td><td><input type=\"text\" size=\"40\" name=\"reason[]\">(req)</td></tr>\n"); print("<input type=\"hidden\" name=\"id\" value=\"$id\" />\n"); if (isset($_GET["returnto"])) print("<input type=\"hidden\" name=\"returnto\" value=\"" . safe($_GET["returnto"]) . "\" />\n"); print("<td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"Delete it!\" class=\"codebuttons\" style=\"width:120px;height:25px;\" /></td></tr>\n"); print("</table>"); print("</form>\n"); print("</p>\n"); } elseif (($datenix==0) && (getNzbPermissions("ulnzb")==1)) { print("<p>\n"); print("<form method=\"post\" action=\"nzbdelete.php\">\n"); print("<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n"); print("<tr><td class=\"row2\" colspan=\"2\"><b>Delete Failed NZB.</b> Reason:</td></tr>"); print("<tr><td><input name=\"reasontype\" type=\"hidden\" value=\"5\" /> What happened?:</td><td><input type=\"text\" size=\"40\" name=\"reason[]\">(req)</td></tr>\n"); print("<input type=\"hidden\" name=\"id\" value=\"$id\" />\n"); if (isset($_GET["returnto"])) print("<input type=\"hidden\" name=\"returnto\" value=\"" . safe($_GET["returnto"]) . "\" />\n"); print("<td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"Delete it!\" class=\"codebuttons\" style=\"width:120px;height:25px;\" /></td></tr>\n"); print("</table>"); print("</form>\n"); print("</p>\n"); } } else { stdhead("Comments for NZB \"" . $row["name"] . "\""); print("<h1>Comments for <a href=\"nzbdetails.php?id=$id\">" . $row["name"] . "</a></h1>\n"); } print("<p><a name=\"startcomments\"></a></p>\n"); $commentbar = "<p align=\"center\"><a class=\"index\" href=\"nzbcomment.php?action=add&tid=$id\">Add a comment</a></p>\n"; $subres = mysql_query("SELECT COUNT(*) FROM nzbcomments WHERE nzb = $id"); $subrow = mysql_fetch_array($subres); $count = $subrow[0]; if (!$count) { print("<h2>No comments yet</h2>\n"); } else { list($pagertop, $pagerbottom, $limit) = pager(20, $count, "nzbdetails.php?id=$id&", array(lastpagedefault => 1)); $subres = mysql_query("SELECT nzbcomments.id, text, user, nzbcomments.added, editedby, editedat, avatar, warned, ". "username, title, class, donor FROM nzbcomments LEFT JOIN users ON nzbcomments.user = users.id WHERE nzb = " . "$id ORDER BY nzbcomments.id $limit") or sqlerr(__FILE__, __LINE__); /* USE ABOVE ^^^ OR BELOW vvv DEPENDING ON WHETHER YOU HAVE THE ANONYMOUS UPLOADER MOD */ /* $subres = mysql_query("SELECT nzbcomments.id, text, user, nzbcomments.added, editedby, editedat, avatar, warned, ". "username, title, class, donor, advertisename FROM nzbcomments LEFT JOIN users ON nzbcomments.user = users.id WHERE nzb = " . "$id ORDER BY nzbcomments.id $limit") or sqlerr(__FILE__, __LINE__); */ $allrows = array(); while ($subrow = mysql_fetch_array($subres)) $allrows[] = $subrow; print($commentbar); print($pagertop); nzbcommenttable($allrows, $row["owner"]); print($pagerbottom); } print($commentbar); stdfoot(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/99377-php-help/#findComment-508605 Share on other sites More sharing options...
paul2463 Posted April 3, 2008 Share Posted April 3, 2008 yeah sorry remove the commas after the type="hidden" thats one thing and an other is that at the top of the page (lines 98 and 99) there are other button calls for this problem you have you may need to change them too to the following if (getNzbPermissions("part") == 1 && $CURUSER["nzbstodaydl"] < getNzbPermissions("maxdlpday")) { $pl .= "<br /><div align=\"center\"><input type=\"image\" name=\"dlzip\" src=\"/image/zip.gif\" style=\"width:200px;height:25px;\" alt=\"ZIP\"/><input type="hidden", name="dlzip" value="Download As Zip File" />". " <input type=\"image\" name=\"dlnzb\" src=\"/images/nzb.gif\" style=\"width:200px;height:25px;\" alt=\"NZB\"/><input type="hidden", name="dlnzb" value="Download As NZB" /></div><br /><br />\n"; but becasue all you have done is put in he hidden fields then the comma may sort it out for you Quote Link to comment https://forums.phpfreaks.com/topic/99377-php-help/#findComment-508614 Share on other sites More sharing options...
gemma134uk Posted April 3, 2008 Author Share Posted April 3, 2008 still blank after removing the " what if i make this print("<input type="hidden", name="dlzip" value="Download As Zip File" />"); like this print("<input type=\"hidden\" name=\"dlzip\" value="Download As Zip File" />"); do you think that would work and the same with print("<input type="hidden", name="dlnzb" value="Download As NZB" />"); ? Quote Link to comment https://forums.phpfreaks.com/topic/99377-php-help/#findComment-508632 Share on other sites More sharing options...
paul2463 Posted April 3, 2008 Share Posted April 3, 2008 yes sorry how stupid of me, they should look like the rest of it, sorry print("<input type=\"hidden\" name=\"dlzip\" value=\"Download As Zip File\" />"); and print("<input type=\"hidden\", name=\"dlnzb\" value=\"Download As NZB\" />"); Quote Link to comment https://forums.phpfreaks.com/topic/99377-php-help/#findComment-508634 Share on other sites More sharing options...
gemma134uk Posted April 3, 2008 Author Share Posted April 3, 2008 ok thank you works now and its downloading .nzbs but the zip download also downloads a nzb? nearlly there now thank you so much Quote Link to comment https://forums.phpfreaks.com/topic/99377-php-help/#findComment-508642 Share on other sites More sharing options...
gemma134uk Posted April 3, 2008 Author Share Posted April 3, 2008 i just need the zip button to download url.nzb.zip instead of url.nzb Quote Link to comment https://forums.phpfreaks.com/topic/99377-php-help/#findComment-508666 Share on other sites More sharing options...
paul2463 Posted April 4, 2008 Share Posted April 4, 2008 I have no idea why it would do that I am afraid as I cant see the code on the page where it is directed to go, there is some working out done there and I made assumptions about the hidden fields passing the correct data across, but I cant work out what happens when actually downloading files Quote Link to comment https://forums.phpfreaks.com/topic/99377-php-help/#findComment-509229 Share on other sites More sharing options...
gemma134uk Posted April 4, 2008 Author Share Posted April 4, 2008 ok il have a play with it and thanks for all your help Quote Link to comment https://forums.phpfreaks.com/topic/99377-php-help/#findComment-509241 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.