Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Wyświetla mi wsyzstkie funkcje zamiast jednej
Forum PHP.pl > Forum > PHP
MOniToR
  1. <?php
  2. function show_comments($id) {
  3. $type_id='3';
  4. include(&#092;"show_coment.php\"); 
  5.  }
  6. function add_comment($id)
  7. {
  8. $type_id='3';
  9. $strona_powrotna = &#092;"download.php?cmt=$id\";
  10. include(&#092;"coments.php\");
  11.  
  12.  }
  13. function lista_kategorii($cat_list) {
  14.  
  15.  
  16. $sql = &#092;"select * from download_category\";
  17. $result = mysql_query($sql);
  18. print(&#092;"<table align=\"center\" width=\"500\">\");
  19. print(&#092;"<tr><td>Category name</td><td>Last uptade</td><td>Files</td></tr>\");
  20. while($row = mysql_fetch_array($result)){
  21. $ctgr = $row[&#092;"cat_id\"];
  22.  
  23. $sqlcat = &#092;"select * from download_files where cat_id = '$ctgr' ORDER BY file_id DESC\";
  24. $resultcat = mysql_query($sqlcat);
  25. $cnt_files = mysql_num_rows($resultcat);
  26. $rowe = mysql_fetch_array($resultcat);
  27. print(&#092;"<tr><td>\");
  28.  
  29. if($HTTP_SESSION_VARS['status']<5) {
  30. print(&#092;" <a href=\"download_admin.php?delcat=\".$row[\"cat_id\"].\"\" > delete </a>\");
  31. }
  32.  
  33. print(&#092;"<a href=\"download.php?cat=\".$row[\"cat_id\"].\"\">\".$row[\"category\"].\"</a></td><td>\".$rowe[\"date\"].\"</td><td>$cnt_files</td></tr>\");
  34. }
  35. print(&#092;"</table>\");
  36. }
  37. function pokaz_kategorie($cat) {
  38.  
  39. $sql33 = &#092;"select * from download_files where cat_id = '$cat' ORDER BY file_id DESC\";
  40. $result33 = mysql_query($sql33);
  41. print(&#092;"<table align=\"center\" width=\"500\">\");
  42. print(&#092;"<tr><td>id</td><td>File name</td><td>Size</td><td>Date</td><td>Downloads</td><td>Comments</td></tr>\");
  43. while($row = mysql_fetch_array($result33)){
  44. $id = $row[&#092;"file_id\"];
  45. $type_id = 3;
  46. $sqlcmt = &#092;"select * from comments where art_id='$id' AND type_id='$type_id' ORDER BY comment_id\";
  47. $resultcmt = mysql_query($sqlcmt);
  48. $cnt = mysql_num_rows($resultcmt); 
  49. print(&#092;"<tr><td width=\"40\">\".$row[\"file_id\"].\"</td><td><a href=\"download.php?dl=\".$row[\"file_id\"].\"\">\".$row[\"name\"].\"</a></td><td>\".$row[\"size\"].\" MB</td><td>\".$row[\"date\"].\"</td><td>\".$row[\"dls\"].\"</td><td><a href=\"download.php?cmt=$id\">( $cnt )</a></td></tr>\");
  50. print(&#092;"<tr><td colspan=\"6\" style=\"padding:5px\"><a href=\"wyslane/img_pliki/\".$row[\"img\"].\"\"><img src=\"wyslane/img_pliki/\".$row[\"img\"].\"\" width=\"80\" height=\"80\"></a>\".$row[\"info\"].\"</td></tr>\");
  51. print(&#092;"<tr><td colspan=\"6\"> [ <a href=\"download.php?dl=\".$row[\"file_id\"].\"\"> DOWNLOAD </a> ]\");
  52. if($HTTP_SESSION_VARS['status']<5) {
  53. print(&#092;"<a href=\"download_admin.php?ed=\".$row[\"file_id\"].\"\"> edit </a> <a href=\"download_admin.php?del=\".$row[\"file_id\"].\"\" > delete </a>\");
  54. }
  55.  print(&#092;"</td></tr>\");
  56. }
  57. print(&#092;"</table>\");
  58. }
  59. if(isset($dl)) {
  60. $sql=&#092;"UPDATE download_files SET dls = dls + 1 WHERE file_id = '$dl'\";
  61. $result =mysql_query($sql);
  62. $sql2 = &#092;"select * from download_files where file_id = '$dl'\";
  63. $result2 = mysql_query($sql2);
  64. $row = mysql_fetch_array($result2);
  65. $url = $row[&#092;"url\"];
  66.  
  67. print(&#092;"<script>window.location=\"$url\"</script>\");
  68. }
  69. function pokaz_plik($cmt)
  70. {
  71.  
  72. $sql = &#092;"select * from download_files where file_id = '$cmt'\";
  73. $result = mysql_query($sql);
  74. print(&#092;"<table align=\"center\" width=\"500\">\");
  75. print(&#092;"<tr><td>id</td><td>File name</td><td>Size</td><td>Date</td><td>Downloads</td></tr>\");
  76. $row = mysql_fetch_array($result);
  77. $id = $row[&#092;"file_id\"];
  78. $type_id = 3;
  79. $sqlcmt = &#092;"select * from comments where art_id='$id' AND type_id='$type_id' ORDER BY comment_id\";
  80. $resultcmt = mysql_query($sqlcmt);
  81. $cnt = mysql_num_rows($resultcmt); 
  82. print(&#092;"<tr><td width=\"40\">\".$row[\"file_id\"].\"</td><td><a href=\"download.php?dl=\".$row[\"file_id\"].\"\">\".$row[\"name\"].\"</a></td><td>\".$row[\"size\"].\" MB</td><td>\".$row[\"date\"].\"</td><td>\".$row[\"dls\"].\"</td></tr>\");
  83. print(&#092;"<tr><td colspan=\"6\" style=\"padding:5px\">\".$row[\"info\"].\"</td></tr>\");
  84. print(&#092;"<tr><td colspan=\"6\"> [ <a href=\"download.php?dl=\".$row[\"file_id\"].\"\"> DOWNLOAD </a> ] \");
  85. if($HTTP_SESSION_VARS['status']<5) {
  86. print(&#092;" <a href=\"download_admin.php?ed=\".$row[\"file_id\"].\"\">edit </a> <a href=\"download_admin.php?del=\".$row[\"file_id\"].\"\" >delete </a>\");
  87. }
  88.  print(&#092;"</td></tr>\");
  89. print(&#092;"</table>\");
  90.  
  91. show_comments($id);
  92. add_comment($id);
  93. }
  94. if(isset($cmt)) {
  95. pokaz_plik($cmt);
  96. }
  97. if(isset($cat)) {
  98.  pokaz_kategorie($cat);
  99. }
  100. if(isset($cat_list)) {
  101. lista_kategorii($cat_list);
  102. }
  103. ?>

Oto mój skrypt downloadu. Problem polega na tym, że zamiast wyśeitlać mi wybraną funkcję(np. jak chcem zobaczyć informacje o danych pliku) wyśietla mi wszystkie funkcje tak jakby nie istaniało if(isset()). Proszę o pomoc.
sf
Przecież tam nie masz if else, więc jeżeli wszystkie te zmienne istnieją to się wszystkie funkcje wyświetlą. Na głębszą analizę kodu nie ma szans bo jest jeden wielki bałagan. Takie pisanie skryptów utrudnia poszukiwanie błędów.
mdco
sf ma racje. Burdel nieprzeciętny winksmiley.jpg. Naucz sie pisać skrypty. Bo sie pogubisz kiedyś winksmiley.jpg
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-2025 Invision Power Services, Inc.