Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: $end - problem
Forum PHP.pl > Forum > PHP
Mody23
Witam!

Co w tym kodzie jest nie tak? Nie potrafię zlokalizować błędu, klamry itd. wszystko jest ok :/

  1. <?php
  2.  
  3. define('IN_PHPBB', true);
  4. define('ATTACH', true);
  5. include($phpbb_root_path . 'extension.inc');
  6. include($phpbb_root_path . 'common.'.$phpEx);
  7.  
  8. //
  9. // Start session management
  10. //
  11. $userdata = session_pagestart($user_ip, PAGE_INDEX);
  12. init_userprefs($userdata);
  13. //
  14. // End session management
  15. //
  16.  
  17. $idbota = 6;
  18. $urll = $board_config['server_name'];
  19. $pathh = $board_config['script_path'];
  20. $raportuj_ikona = '<img src="http://' . $urll . '' . $pathh . 'templates/images/icon_report.gif" alt="" /> ';
  21.  
  22. if ( isset($_POST['dalej']) )
  23. {
  24. $sql = "SELECT topic_id, topic_reason, forum_id, topic_action_date
  25. FROM " . TOPICS_TABLE . "
  26. WHERE topic_reason == 1
  27. group by topic_id";
  28. $result = $db->sql_query($sql);
  29. while( $row = $db->sql_fetchrow($result) )
  30. {
  31. $topic_id = $row['topic_id'];
  32. $reason = $row['reason'];
  33. $forum_id = $row['forum_id'];
  34. $topic_action_date = $row['topic_action_date'];
  35. }
  36. while ($row = mysql_fetch_assoc($result))
  37. {
  38.  
  39. $sql = "SELECT post_id, post_parent, post_order
  40. FROM " . POSTS_TABLE . "
  41. WHERE topic_id = $topic_id
  42. ORDER BY post_order";
  43. if ( !($result = $db->sql_query($sql)) )
  44. {
  45. message_die(GENERAL_MESSAGE, $lang['No_such_post']);
  46. }
  47. while ( $row = $db->sql_fetchrow($result) )
  48. {
  49. if ( $row['post_id'] == $post_data['post_parent'] )
  50. {
  51. $post_parent_order = $row['post_order'];
  52. $begin_new_parents = 1;
  53. }
  54.  
  55. if ( !$row['post_parent'] && !$post_parent_order )
  56. {
  57. $begin_new_parents = $order_last_parents = 0;
  58. $this_tree_parents = array();
  59. }
  60.  
  61. if ( $begin_new_parents )
  62. {
  63. if ( $row['post_parent'] )
  64. {
  65. $this_tree_parents[] = $row['post_parent'];
  66. }
  67. if ( $row['post_id'] == $post_data['post_parent'] || ($row['post_parent'] >= $post_data['post_parent'] && in_array($post_data['post_parent'], $this_tree_parents) ) )
  68. {
  69. $order_last_parents = $row['post_order'];
  70. }
  71. else
  72. {
  73. $max_order = ($order_last_parents) ? $order_last_parents : $row['post_order'];
  74. }
  75. }
  76. $max_order_all = $row['post_order'];
  77. }
  78. $max_order = $max_order_all;
  79. $post_order = $max_order + 1;
  80.  
  81. $sql = "INSERT INTO ".POSTS_TABLE." (`post_id`, `topic_id`, `forum_id`, `poster_id`, `post_time`, `poster_ip`, `post_username`, `enable_bbcode`, `enable_html`, `enable_smilies`, `enable_sig`, `post_edit_time`, `post_edit_count`, `post_attachment`, `user_agent`, `post_icon`, `post_expire`, `reporter_id`, `post_marked`, `post_approve`, `poster_delete`, `post_edit_by`, `post_parent`, `post_order`) VALUES (".$db->sql_nextid().", '".$topic_id."', '".$forum_id."', '".$idbota."', '".$topic_action_date."', '0', '', '1', '0', '1', '1', '0', '0', '0', '', '0', '0', '0', '', '1', '0', '0', '0', '0')";
  82. {
  83. message_die(CRITICAL_ERROR, 'Error1');
  84.  
  85. }
  86.  
  87. $sql = "INSERT INTO ".POSTS_TEXT_TABLE." (`post_id`, `bbcode_uid`, `post_subject`, `post_text`) VALUES (".$db->sql_nextid().", '0', '', '".str_replace("\'", "''", sprintf($lang['bot_message'], $reason, $raportuj_ikona))."')";
  88. {
  89. message_die(CRITICAL_ERROR, 'Error2');
  90.  
  91. }
  92. $sql = "SELECT post_id
  93. FROM " . POSTS_TABLE . "
  94. WHERE forum_id = $forum_id
  95. AND topic_id = $topic_id
  96. AND poster_id = $idbota";
  97. if ( !($result = $db->sql_query($sql)) )
  98. {
  99. message_die(GENERAL_ERROR, 'Could not update topics table', '', __LINE__, __FILE__, $sql);
  100. }
  101. $result = $db->sql_query($sql);
  102. while( $row = $db->sql_fetchrow($result) )
  103. {
  104. $post_id = $row['post_id'];
  105. }
  106. $sql = "UPDATE " . FORUMS_TABLE . "
  107. SET forum_last_post_id = $post_id
  108. WHERE forum_id = $forum_id";
  109.  
  110. if ( !($result = $db->sql_query($sql)) )
  111. {
  112. message_die(GENERAL_ERROR, 'jakis errorek', '', __LINE__, __FILE__, $sql);
  113. }
  114.  
  115. $sql = "UPDATE " . TOPICS_TABLE . "
  116. SET topic_last_post_id = $post_id
  117. WHERE topic_id = $topic_id";
  118.  
  119. if ( !($result = $db->sql_query($sql)) )
  120. {
  121. message_die(GENERAL_ERROR, 'jakis errorek', '', __LINE__, __FILE__, $sql);
  122. }
  123.  
  124. $sql = "SELECT user_posts
  125. FROM " . USERS_TABLE . "
  126. WHERE user_id = $idbota";
  127. $result = $db->sql_query($sql);
  128. while( $row = $db->sql_fetchrow($result) )
  129. {
  130. $posts_bot = $row['user_posts'];
  131. }
  132.  
  133. $postss_bot = $posts_bot + 1;
  134.  
  135.  
  136. $sql = "UPDATE " . USERS_TABLE . "
  137. SET user_posts = $postss_bot
  138. WHERE user_id = $idbota";
  139.  
  140. if ( !($result = $db->sql_query($sql)) )
  141. {
  142. message_die(GENERAL_ERROR, 'jakis errorek', '', __LINE__, __FILE__, $sql);
  143. }
  144. $sql = "TRUNCATE " . READ_HISTORY_TABLE . ";
  145.  
  146. }
  147. }
  148. ?>
croc
Linia 144, masz niedomknięty cudzysłów.
ShadowD
Pomyśl o czymś co koloruje składnie, dokładnie to widać całość jest na niebiesko w tym przypadku - bez takich narzędzi jest ciężko walczyć z kodem. :-)
by_ikar
Cytat(ShadowD @ 29.10.2011, 15:28:52 ) *
Pomyśl o czymś co koloruje składnie, dokładnie to widać całość jest na niebiesko w tym przypadku - bez takich narzędzi jest ciężko walczyć z kodem. :-)


Masochizmem jest nie używanie takich narzędzi które ci podkreślają błędną składnie na bieżąco wink.gif
croc
Ja uprawiam taki masochizm i żyję smile.gif
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.