Witam,
mam prośbę z panelem admina tzn z częścią odpowiedzialną za podstrony, mianowicie wyświetla tylko jedną podstronę ( w rzeczywistości w bazie znajduje się 5) Poza tym powinna być opcja do edycji lub kasowania lecz niestety nie wyświetla się, podejrzewam że to jest jakiś drobny błąd niestety nie jestem w stanie go dostrzec

  1.  
  2. <?
  3. /*
  4.   # UWAGA!!! Skrypt nie jest darmowy!
  5.   # autor skryptu: INTERVAL.pl - Usługi Informatyczne Kamil Kijko
  6.   # kopiowanie i dalsza odsprzedaż bez zgoty firmy INTERVAL.pl zabroniona!
  7.   # aktualny regulamin i warunki licencji znajdziesz pod adresem <a href="http://www.interval.pl/" target="_blank">http://www.interval.pl/</a>
  8.   # info@interval.pl
  9.   # <a href="http://www.interval.pl" target="_blank">http://www.interval.pl</a>
  10.   # Baza noclegowa v 2.0
  11. */
  12. $smarty -> assign('pag', '');
  13.  
  14. function parse ( $str )
  15. {
  16. if ( is_array( $str ) )
  17. {
  18. $str = htmlspecialchars( $str['str'] );
  19. }
  20. else
  21. {
  22. $str = htmlspecialchars( $str );
  23. }
  24. $str = strip_tags($str);
  25. $polish = 'ęóąśłżĽćńĘÓˇŚŁŻŹĆŃ';
  26. $nopolish = 'eoaslzzcnEOASLZZCN';
  27. $str = strtr($str, $polish, $nopolish);
  28. $str = str_replace("`", "", $str);
  29. //$str = str_replace("-", "", $str);
  30. $str = str_replace("=", "_", $str);
  31. $str = str_replace("+", "_", $str);
  32. $str = str_replace(")", "_", $str);
  33. $str = str_replace("(", "_", $str);
  34. $str = str_replace("*", "_", $str);
  35. $str = str_replace("&", "_", $str);
  36. $str = str_replace("^", "_", $str);
  37. $str = str_replace("%", "_", $str);
  38. $str = str_replace("$", "_", $str);
  39. $str = str_replace("#", "_", $str);
  40. $str = str_replace("@", "_", $str);
  41. $str = str_replace("!", "_", $str);
  42. $str = str_replace("~", "_", $str);
  43. $str = str_replace("|", "_", $str);
  44. $str = str_replace(",", "", $str);
  45. $str = str_replace(".", "", $str);
  46. $str = str_replace("/", "_", $str);
  47. $str = str_replace(";", "", $str);
  48. $str = str_replace("'", "_", $str);
  49. $str = str_replace("]", "_", $str);
  50. $str = str_replace("[", "_", $str);
  51. $str = str_replace("<", "_", $str);
  52. $str = str_replace(">", "_", $str);
  53. $str = str_replace("?", "_", $str);
  54. $str = str_replace(":", "", $str);
  55. $str = str_replace("|", "_|", $str);
  56. $str = str_replace("}", "_", $str);
  57. $str = str_replace("{", "_", $str);
  58. $str = str_replace("\\", "_", $str);
  59. $str = str_replace(" ", "_", $str);
  60. $str = str_replace(" ", "_", $str);
  61. $str = str_replace(" ", "_", $str);
  62.  
  63. return $str;
  64. }
  65.  
  66. $smarty -> register_function('nopl', 'parse');
  67.  
  68. if ( $_GET['act'] == 'edit' )
  69. {
  70. $smarty -> assign('edit', '');
  71. $id = $_GET['id'];
  72. $smarty -> assign('id', $id);
  73.  
  74. if ( isset( $_POST['pagesEd'] ) )
  75. {
  76. if ( !empty( $_POST['title'] ) && !empty( $_POST['txt'] ) )
  77. {
  78. $sql = "UPDATE `pages` SET `pagesTitle` = '".$_POST['title']."', `pagesTxt` = '".$_POST['txt']."' WHERE pagesId = '$id'";
  79. mysql_query( $sql );
  80. $smarty -> assign('success', 'Poprawnie zapisano zmiany!');
  81.  
  82. }
  83. else
  84. {
  85. $smarty -> assign('error', 'Wypełnij wszystkie pola!');
  86. }
  87. }
  88.  
  89. $sql = "SELECT * FROM pages WHERE pagesId = '$id'";
  90. $q = mysql_query( $sql );
  91. $ed = array();
  92.  
  93. while ( $db = mysql_fetch_array( $q ) )
  94. {
  95. $ed[] = $db;
  96. }
  97. $smarty -> assign('ed', $ed);
  98. }
  99.  
  100. if ( $_GET['act'] == 'delete' )
  101. {
  102. $id = $_GET['id'];
  103.  
  104. if ( $id == 1 || $id == 2 || $id == 3 )
  105. {
  106. $id = '';
  107. }
  108.  
  109. $sql = "DELETE FROM `pages` WHERE pagesId = '$id'";
  110. mysql_query( $sql );
  111. $smarty -> assign('success', 'Poprawnie usunięto podstronę!');
  112. }
  113.  
  114. if ( isset( $_POST['pagesAdd'] ) )
  115. {
  116. $smarty -> assign('title', $_POST['title']);
  117. $smarty -> assign('txt', $_POST['txt']);
  118.  
  119. if ( !empty( $_POST['title'] ) && !empty( $_POST['txt'] ) )
  120. {
  121. $sql = "INSERT INTO `pages` (`pagesTitle`, `pagesTxt`) VALUES ('".$_POST['title']."', '".$_POST['txt']."')";
  122. mysql_query( $sql );
  123. $smarty -> assign('success', 'Poprawnie dodano podstronę!');
  124.  
  125. $smarty -> assign('title', '');
  126. $smarty -> assign('txt', '');
  127. }
  128. else
  129. {
  130. $smarty -> assign('error', 'Wypełnij wszystkie pola!');
  131. }
  132. }
  133.  
  134. if ( isset( $_POST['pagesEdit'] ) )
  135. {
  136. $glowna = $_POST['powitanie'];
  137. $regulamin = $_POST['regulamin'];
  138. $onas = $_POST['onas'];
  139. $sql = "UPDATE `pages` SET `pagesTxt` = '$glowna' WHERE pagesId = '2'";
  140. mysql_query( $sql );
  141. $sql = "UPDATE `pages` SET `pagesTxt` = '$regulamin' WHERE pagesId = '1'";
  142. mysql_query( $sql );
  143. $sql = "UPDATE `pages` SET `pagesTxt` = '$onas' WHERE pagesId = '3'";
  144. mysql_query( $sql );
  145. $smarty -> assign('success', 'Poprawnie zapisano zmiany!');
  146. }
  147.  
  148. $sql = "SELECT * FROM pages WHERE pagesId BETWEEN 4 AND 1000";
  149. $q = mysql_query( $sql );
  150. $smarty -> assign('num', mysql_num_rows( $q ));
  151. $pages = array();
  152.  
  153. while ( $db = mysql_fetch_array( $q ))
  154. {
  155. $pages[] = $db;
  156. }
  157. $smarty -> assign('pages', $pages);
  158.  
  159. $sql = "SELECT cfgTxt FROM config WHERE cfgId = '1'";
  160. $q = mysql_query( $sql );
  161. $db = mysql_fetch_array ( $q );
  162. $smarty -> assign('adress', $db[0]);
  163.  
  164. $sql = "SELECT * FROM pages WHERE pagesId BETWEEN 1 AND 3";
  165. $q = mysql_query( $sql );
  166.  
  167. while ( $db = mysql_fetch_Array( $q ) )
  168. {
  169. $smarty -> assign($db['pagesTitle'], $db['pagesTxt']);
  170. }
  171. ?>
  172.  
  173.