Pomoc - Szukaj - U¿ytkownicy - Kalendarz
Pe³na wersja: PafileDB - problem z modyfikacja
Forum PHP.pl > Forum > Gotowe rozwi±zania
emumax
Witam , mam skrypt wyswietlajacy top20 najczesciej pobieranych plikow z systemu PafileDB , chcial bym zmodyfikowac go aby wyswietlal 20 ostatnio dodanych plikow? tylko nie wiem wlasnie jak sie do tego zabrac....

Z góry dziekuje za pomoc!




  1. <?php
  2.  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
  3. /////Top Files in Main Page Addon for PafileDB (http://www.phparena.net)//////
  4.  //////////Written by Wh1t3w0lf (wh1t3w0lf@decayandcorrupt.com) (fixed by NightWolf www.belesh.net )/////////////////
  5. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  6. //Instructions:
  7. //Change the settings bellow (and the layout in the bottom of this file if you wish).
  8. //After that put include this file in the page and in the place where you want to 
    show the top files
  9. //via the include php command
  10.  
  11. //Settings
  12. $dbhostname= "nazwahosta";  //Your MySQL Host name
  13. $dbusername= "nazwa uzytkownika";  //Your MySQL Username
  14. $dbpassword= "haslo";  //Your MySQL Password
  15. $dbdatabase= "nazwabazy";  //Your MySQL Database Name
  16. $url= "http://www.eadres/forum/dload.php";  //The Url where you have installed pafiledb.php e.g "http://www.yoursite.com/files/pafile.php"
  17. $table ="phpbb_pa_files";  //Table name including the prefix
  18. $topfilecount= 20; // Top X files to show. e.g Top 10
  19.  
  20. //Don't mess with the following tongue.gif
  21. $db = @mysql_connect($dbhostname,$dbusername,$dbpassword);
  22. if (!$db) {
  23. echo( "<p>Unable to connect to the " .
  24. "database server at this time.</p>" );
  25. exit();
  26. }
  27.  if (! @mysql_select_db($dbdatabase) ) {
  28. echo( "<p>Error locating the file " .
  29. "database at this time.</p >" );
  30. exit();
  31. }
  32. $result = @mysql_query("SELECT file_id, file_name, file_dls FROM $table ORDER BY file_dls DESC", $db);
  33. if (!$result) {
  34. echo("<p>Error performing query: " . mysql_error() . "</p>");
  35. exit();
  36. }
  37. $files = mysql_num_rows($result);
  38.  
  39. //Style. Change accoridngly e.g Add html tags or css styles to match your site's design.
  40. echo "<body bgcolor='#E0E8EF' text='#000000' link='#2F486F' vlink='#2F486F' alink='#2F486F'>";
  41. echo "<style>
  42. body{
  43.  scrollbar-face-color: #DEE3E7;
  44.  scrollbar-highlight-color: #FFFFFF;
  45.  scrollbar-shadow-color: #DEE3E7;
  46.  scrollbar-3dlight-color: #D1D7DC;
  47.  scrollbar-arrow-color: #006699;
  48.  scrollbar-track-color: #A9BAC9;
  49.  scrollbar-darkshadow-color: #98AAB1;
  50. }
  51.  
  52. A.pFo:link  {color:#2F486F; text-decoration:overline;}
  53. A.pFo:visited {color:#2F486F; text-decoration:overline;}
  54. A.pFo:active  {color:#2F486F; text-decoration:overline;}
  55. A.pFo:hover {color:#8AA0B4; text-decoration:overline;}
  56.  
  57. </style>";
  58. echo "<center><u><b>Top 20 Downloads</b></u>:";
  59. echo "<br><center><font face='Arial, Helvetica, sans-serif' size='-1'>";
  60. $i=1;
  61. while (($myrow = mysql_fetch_row($result)) And ($i<=$topfilecount)){
  62. $i=$i + 1;
  63. echo "<a href='$url?action=file&file_id=$myrow[0]' target='_parent'>$myrow[1]</a><br>\n";}
  64.  
  65.  ///////////////////////////////////////////////////////////////////////////////
  66. /////Top Files in Main Page Addon for PafileDB (http://www.phparena.net)///////
  67.  //////////Written by Wh1t3w0lf (wh1t3w0lf@decayandcorrupt.com)/////////////////
  68. ///////////////////////////////////////////////////////////////////////////////
  69. ?>
Foxx
Je¿eli file_dls to liczba pobrañ, to musisz np. zamiast tego pobraæ dane z pola o dacie dodania. Np.
  1. <?php
  2.  
  3. @mysql_query("SELECT file_id, file_name, file_data_dodania FROM $table ORDER BY file_data
    _dodania DESC"
    , $db);
  4.  
  5. ?>
NuLL
Prosze mi na PW podeslac na jakim forum powinien sie znalesc temat.
Do tego czasu zamkniete.

EDIT: Otwieram
To jest wersja lo-fi g³ównej zawarto¶ci. Aby zobaczyæ pe³n± wersjê z wiêksz± zawarto¶ci±, obrazkami i formatowaniem proszê kliknij tutaj.
Invision Power Board © 2001-2024 Invision Power Services, Inc.