Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Problem z zaincludowaniemiem pliku
jasiek65
post
Post #1





Grupa: Zarejestrowani
Postów: 46
Pomógł: 0
Dołączył: 25.05.2010

Ostrzeżenie: (0%)
-----


Mam problem z zaincludowaniem pliku otóż mam taki kod w index.php

  1. <?php
  2. // zmienna potrzebna do prawidlowego wczytania includowanych plikow
  3. $add_site = true;
  4. ?>
  5. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  6. <html>
  7. <meta http-equiv="Content-type" content="text/html; charset=iso-8859-2" />
  8. <meta http-equiv="Reply-to" content="l" />
  9. <meta name="Author" content="" />
  10. <head>
  11. <title>moja stronka</title>
  12. <style type="text/css">
  13. <!--
  14.  
  15. body {
  16. font-family: Verdana, Arial;
  17. font-size: 12px;
  18. }
  19.  
  20. -->
  21. </style>
  22. </head>
  23. <body>
  24. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  25. <tr>
  26. <td width="100%" colspan="3"><?php include "include/naglowek.php"; ?></td>
  27. </tr>
  28. <tr>
  29.  
  30. <td width="70%" valign="top">
  31. <?php
  32. $go = $_GET['go'];
  33.  
  34. switch($go) {
  35.  
  36. case "1": include "page/1.php"; break;
  37. case "2": include "mojastronka/index.php"; break; // tą strone chcę zaincludować
  38. case "3": include "page/2.html"; break;
  39. case "4": include "page/4.html"; break;
  40. case "5": include "page/5.html"; break;
  41. }
  42.  
  43. ?>
  44.  
  45. </tr>
  46. <tr>
  47. <td width="100%" colspan="3"><?php include "include/stopka.php"; ?></td>
  48. </tr>
  49. </table>
  50. </body>
  51. </html>



a zawartość pliku mojastronka/index.php

  1.  
  2.  
  3.  
  4.  
  5. <?php
  6.  
  7. // Help prevent register_globals injection
  8. define('ATSPHP', 1);
  9. $CONF = array();
  10. $FORM = array();
  11. $TMPL = array();
  12.  
  13. // Change the path to your full path if necessary
  14. $CONF['path'] = '.';
  15. $TMPL['version'] = '';
  16. // Set to 1 to display SQL queries and GET/POST/COOKIE data
  17. $CONF['debug'] = 0;
  18.  
  19. // Require some classes and start the timer
  20. require_once("{$CONF['path']}/sources/misc/classes.php");
  21. $TIMER = new timer;
  22.  
  23. // Connect to the database
  24. // Set the last argument of $DB->connect to 1 to enable debug mode
  25. require_once("{$CONF['path']}/settings_sql.php");
  26. require_once("{$CONF['path']}/sources/sql/{$CONF['sql']}.php");
  27. $DB = "sql_{$CONF['sql']}";
  28. $DB = new $DB;
  29. $DB->connect($CONF['sql_host'], $CONF['sql_username'], $CONF['sql_password'], $CONF['sql_database'], $CONF['debug']);
  30.  
  31. // Settings
  32. $settings = $DB->fetch("SELECT * FROM {$CONF['sql_prefix']}_settings", __FILE__, __LINE__);
  33. $CONF = array_merge($CONF, $settings);
  34.  
  35. $ad_breaks = explode(',', $CONF['ad_breaks']);
  36. $CONF['ad_breaks'] = array();
  37. foreach ($ad_breaks as $key => $value) {
  38. $CONF['ad_breaks'][$value] = $value;
  39. }
  40.  
  41. $result = $DB->query("SELECT category, skin FROM {$CONF['sql_prefix']}_categories ORDER BY category", __FILE__, __LINE__);
  42. while (list($category, $skin) = $DB->fetch_array($result)) {
  43. $CONF['categories'][$category] = $skin;
  44. }
  45.  
  46. $CONF['skins_path'] = "{$CONF['path']}/skins";
  47. $CONF['skins_url'] = "{$CONF['list_url']}/skins";
  48. $TMPL['skins_url'] = $CONF['skins_url'];
  49. $TMPL['list_name'] = $CONF['list_name'];
  50. $TMPL['list_url'] = $CONF['list_url'];
  51.  
  52. // Combine the GET and POST input
  53. $FORM = array_merge($_GET, $_POST);
  54.  
  55. // The language file
  56. require_once("{$CONF['path']}/languages/{$CONF['default_language']}.php");
  57.  
  58. // Determine the category and skin
  59. if (isset($FORM['cat']) && isset($CONF['categories'][$FORM['cat']])) {
  60. $TMPL['skin_name'] = $CONF['categories'][$FORM['cat']];
  61. }
  62. else {
  63. $TMPL['skin_name'] = $CONF['default_skin'];
  64. }
  65. if (!is_dir("{$CONF['path']}/skins/{$TMPL['skin_name']}/") || !$TMPL['skin_name']) {
  66. $TMPL['skin_name'] = $CONF['default_skin'];
  67. }
  68. if (!is_dir("{$CONF['path']}/skins/{$CONF['default_skin']}/")) {
  69. $TMPL['skin_name'] = 'fusion';
  70. }
  71. require_once("{$CONF['path']}/sources/misc/skin.php");
  72.  
  73. // Is it a new day/week/month?
  74. list($last_new_day, $last_new_week, $last_new_month, $TMPL['original_version']) = $DB->fetch("SELECT last_new_day, last_new_week, last_new_month, original_version FROM {$CONF['sql_prefix']}_etc", __FILE__, __LINE__);
  75. $time = time() + (3600*$CONF['time_offset']);
  76. $current_day = date('d', $time);
  77. $current_week = date('W', $time);
  78. $current_month = date('m', $time);
  79. if ($last_new_day != $current_day) {
  80. require_once("{$CONF['path']}/sources/misc/new_day.php");
  81. new_day($current_day);
  82. }
  83. if ($last_new_week != $current_week) {
  84. require_once("{$CONF['path']}/sources/misc/new_day.php");
  85. new_week($current_week);
  86. }
  87. if ($last_new_month != $current_month) {
  88. require_once("{$CONF['path']}/sources/misc/new_day.php");
  89. new_month($current_month);
  90. }
  91.  
  92. // Adjust the output text based on days, weeks, or months
  93. if ($CONF['ranking_period'] == 'weekly') {
  94. $LNG['g_this_period'] = $LNG['g_this_week'];
  95. $LNG['g_last_period'] = $LNG['g_last_week'];
  96. }
  97. elseif ($CONF['ranking_period'] == 'monthly') {
  98. $LNG['g_this_period'] = $LNG['g_this_month'];
  99. $LNG['g_last_period'] = $LNG['g_last_month'];
  100. }
  101. else {
  102. $LNG['g_this_period'] = $LNG['g_today'];
  103. $LNG['g_last_period'] = $LNG['g_yesterday'];
  104. }
  105.  
  106. // Check if installer is there
  107. if (file_exists("{$CONF['path']}/install/")) {
  108. $TMPL['header'] = $LNG['g_error'];
  109. $base = new base;
  110. $base->error($LNG['g_delete_install']);
  111. }
  112.  
  113. // Check for hits in
  114. require_once("{$CONF['path']}/sources/in.php");
  115. $in = new in;
  116.  
  117. // Array containing the valid .php files from the sources directory
  118. $action = array(
  119. 'admin' => 1,
  120. 'in' => 1,
  121. 'join' => 1,
  122. 'lost_pw' => 1,
  123. 'out' => 1,
  124. 'page' => 1,
  125. 'rankings' => 1,
  126. 'rate' => 1,
  127. 'search' => 1,
  128. 'stats' => 1,
  129. 'user_cpl' => 1
  130. );
  131.  
  132. // Require the appripriate file
  133. if (isset($FORM['a']) && isset($action[$FORM['a']])) {
  134. $page_name = $FORM['a'];
  135. }
  136. else {
  137. $page_name = 'rankings';
  138. }
  139.  
  140. require_once("{$CONF['path']}/sources/{$page_name}.php");
  141. $page = new $page_name;
  142.  
  143. // Display the page
  144. $skin = new main_skin('wrapper');
  145. echo $skin->make();
  146.  
  147. $DB->close();
  148.  
  149. // Print out debugging info, if necessary
  150. if ($CONF['debug']) {
  151. echo '<div style="clear: both;">';
  152. foreach ($DB->queries as $value) {
  153. echo "<hr /><pre>{$value}</pre>";
  154. }
  155. echo '<hr /><pre>';
  156. print_r($_REQUEST);
  157. echo '</pre>';
  158. echo '</div>';
  159. }
  160. ?>
  161.  
  162.  
  163.  



korzystam w tej stronie z systemu toplistowego jak zapewne widać.


Czy może ten skrypt blokować include ?

Prosze o pomoc i z góry dziękuję (IMG:style_emoticons/default/rolleyes.gif)
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 22:29