Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP][HTML][CSS]niedziałający include
Forum PHP.pl > Forum > Przedszkole
Ziom73
Mam pliki:

minichat.php
  1. <?php
  2. $token = md5(uniqid(rand(), true));
  3. $_SESSION['token'] = $token;
  4. ?>
  5. <!-- 1. Important: the PHP code above must appear at the top of any page which includes the shoutbox (before any HTML is started). -->
  6. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  7. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  8. <head>
  9.  
  10. <title>wTag test page.</title>
  11.  
  12. <!-- Copy the code between "Start Meta and links" and "End Meta and links",
  13. paste it before the </head> closing tag on every page which includes the shoutbox
  14. -->
  15.  
  16. <!-- 2. Start Meta and links -->
  17. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  18. <style type="text/css">
  19. /* for Mozilla only: create rounded corners */
  20. #box {
  21. -moz-border-radius: 10px 10px 10px 10px;
  22. }
  23. </style>
  24. <link rel="stylesheet" type="text/css" href="wtag/css/main.css" />
  25. <link rel="stylesheet" type="text/css" href="wtag/css/main-style.css" />
  26. <!--[if IE]>
  27. <link rel="stylesheet" type="text/css" href="wtag/css/ie-style.css" />
  28. <![endif]-->
  29. <script type="text/javascript" src="wtag/js/dom-drag.js"></script>
  30. <script type="text/javascript" src="wtag/js/scroll.js"></script>
  31. <script type="text/javascript" src="wtag/js/conf.js"></script>
  32. <script type="text/javascript" src="wtag/js/ajax.js"></script>
  33. <script type="text/javascript" src="wtag/js/drop_down.js"></script>
  34. <!-- 2. End Meta and links -->
  35.  
  36. </head>
  37.  
  38. <body>
  39. <!--
  40. Copyright &copy; 2008 Pippa <a href=\"http://www.spacegirlpippa.co.uk\" target=\"_blank\">http://www.spacegirlpippa.co.uk</a>
  41. Contact: sthlm.pippa@gmail.com
  42. Released: 30.05.2008 Stockholm, Sweden
  43.  
  44. This file is part of wTag mini chat - shoutbox.
  45.  
  46. wTag is free software: you can redistribute it and/or modify
  47. it under the terms of the GNU General Public License as published by
  48. the Free Software Foundation, either version 3 of the License, or
  49. (at your option) any later version.
  50.  
  51. wTag is distributed in the hope that it will be useful,
  52. but WITHOUT ANY WARRANTY; without even the implied warranty of
  53. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  54. GNU General Public License for more details.
  55.  
  56. You should have received a copy of the GNU General Public License
  57. along with wTag.  If not, see <http://www.gnu.org/licenses/>.
  58. -->
  59.  
  60. <div id="main">
  61.  
  62. <div id="corner_tl">
  63. </div>
  64. <div id="corner_tr">
  65. </div>
  66. <div id="corner_bl">
  67. </div>
  68. <div id="corner_br">
  69. </div>
  70.  
  71. <!-- 3. Shoutbox code start -->
  72. <div id="box">
  73.  
  74. <div id="chat">
  75.  
  76. <div id="scrollArea">
  77. <div id="scroller">
  78. </div>
  79. </div>
  80.  
  81. <div id="container">
  82. <div id='content'>
  83. </div>
  84. </div>
  85.  
  86. <div id='form'>
  87. <form id='cform' name='chatform' action="#" >
  88. <div id='field_set'>
  89. <input type='hidden' id='token' name='token' value='<?php echo $token; ?>' />
  90. <input type='text' id='name' name='name' value='name' />
  91. <input type='text' id='url' name='url' value='http://' />
  92. <textarea rows='4' cols='10' id='message'  name='message' >message</textarea>
  93. </div>
  94. </form>
  95. </div>
  96.  
  97. <div id="chat_menu">
  98.  
  99. <div id ="wtag">
  100. <p>
  101. <!-- You may not remove the copyright link, but you may edit its look and location on your web page -->
  102. <a href="http://spacegirlpippa.co.uk" title="A free mini chat (shoutbox) script">
  103. wTag
  104. </a>
  105. </p>
  106. </div>
  107.  
  108. <div id='refresh'>
  109. <p>refresh</p>
  110. </div>
  111.  
  112. <div id='emo'>
  113. <ul id="show_sm">
  114. <li>
  115. smileys
  116. <ul id="smiley_box">
  117. <li>
  118. <img class='smileys' src='wtag/smileys/smile.gif' width='15' height='15' alt=':)' title=':)' onclick = "tagSmiley(':)');" />
  119. </li>
  120. <li>
  121. <img class='smileys' src='wtag/smileys/sad.gif' width='15' height='15' alt=':(' title=':(' onclick = "tagSmiley(':(');" />
  122. </li>
  123. <li>
  124. <img class='smileys' src='wtag/smileys/wink.gif' width='15' height='15' alt=';)' title=';)' onclick = "tagSmiley(';)');" />
  125. </li>
  126. <li>
  127. <img class='smileys' src='wtag/smileys/tongue.gif' width='15' height='15' alt=':-P' title=':-P' onclick = "tagSmiley(':-P');"/>
  128. </li>
  129. <li>
  130. <img class='smileys' src='wtag/smileys/rolleyes.gif' width='15' height='15' alt='S-)' title='S-)' onclick = "tagSmiley('S-)');"/>
  131. </li>
  132. <li>
  133. <img class='smileys' src='wtag/smileys/angry.gif' width='15' height='15' alt='>(' title='>(' onclick = "tagSmiley('>(');" />
  134. </li>
  135. <li>
  136. <img class='smileys' src='wtag/smileys/embarassed.gif' width='15' height='15' alt=':*)' title=':*)' onclick = "tagSmiley(':*)');" />
  137. </li>
  138. <li>
  139. <img class='smileys' src='wtag/smileys/grin.gif' width='15' height='15' alt=':-D' title=':-D' onclick = "tagSmiley(':-D');" />
  140. </li>
  141. <li>
  142. <img class='smileys' src='wtag/smileys/cry.gif' width='15' height='15' alt='QQ' title='QQ' onclick = "tagSmiley('QQ');" />
  143. </li>
  144. <li>
  145. <img class='smileys' src='wtag/smileys/shocked.gif' width='15' height='15' alt='=O' title='=O' onclick = "tagSmiley('=O');" />
  146. </li>
  147. <li>
  148. <img class='smileys' src='wtag/smileys/undecided.gif' width='15' height='15' alt='=/' title='=/' onclick = "tagSmiley('=/');" />
  149. </li>
  150. <li>
  151. <img class='smileys' src='wtag/smileys/cool.gif' width='15' height='15' alt='8-)' title='8-)' onclick = "tagSmiley('8-)');" />
  152. </li>
  153. <li>
  154. <img class='smileys' src='wtag/smileys/sealedlips.gif' width='15' height='15' alt=':-X' title=':-X' onclick = "tagSmiley(':-X');" />
  155. </li>
  156. <li>
  157. <img class='smileys' src='wtag/smileys/angel.gif' width='15' height='15' alt='O:]' title='O:]' onclick = "tagSmiley('O:]');" />
  158. </li>
  159. </ul>
  160. </li>
  161.  
  162. </ul>
  163. </div>
  164.  
  165. <div id='submit'>
  166. <p>submit</p>
  167. </div>
  168.  
  169. </div>
  170.  
  171. </div>
  172. </div>
  173. <!-- 3. Shoutbox code end -->
  174.  
  175. <div id ="links">
  176. <a href="http://spacegirlpippa.co.uk/minichat/shoutbox-installation.php"><span class="accent">wTag installation guide.</span></a>
  177. </div>
  178.  
  179. </div>
  180.  
  181.  
  182. </body>
  183. </html>


shout.php:
  1. <?php
  2. $token = md5(uniqid(rand(), true));
  3. $_SESSION['token'] = $token;
  4. ?>
  5. <!-- 1. Important: the PHP code above must appear at the top of any page which includes the shoutbox (before any HTML is started). -->
  6. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  7. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  8. <head>
  9.  
  10. <title>SB</title>
  11.  
  12. <!-- Copy the code between "Start Meta and links" and "End Meta and links",
  13. paste it before the </head> closing tag on every page which includes the shoutbox
  14. -->
  15.  
  16. <!-- 2. Start Meta and links -->
  17. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  18. <style type="text/css">
  19. /* for Mozilla only: create rounded corners */
  20. #box {
  21. -moz-border-radius: 10px 10px 10px 10px;
  22. }
  23. </style>
  24. <link rel="stylesheet" type="text/css" href="/includes/shoutbox/wtag/css/main-style.css" />
  25. <script type="text/javascript" src="/includes/shoutbox/wtag/js/dom-drag.js"></script>
  26. <script type="text/javascript" src="/includes/shoutbox/wtag/js/scroll.js"></script>
  27. <script type="text/javascript" src="/includes/shoutbox/wtag/js/conf.js"></script>
  28. <script type="text/javascript" src="/includes/shoutbox/wtag/js/ajax.js"></script>
  29. <script type="text/javascript" src="/includes/shoutbox/wtag/js/drop_down.js"></script>
  30. </head>
  31.  
  32. <body>
  33. <?PHP
  34. include('/includes/shoutbox/minichat.php');
  35. ?>
  36. </body>
  37. </html>


Niestety, nie działa, gdyż je pusta strona z include;/
Co zrobić aby zadziałało?
Wszystkie pliki można pobrać na: http://spacegirlpippa.co.uk/
erix
A nie masz błędów w składni...? dry.gif
Ziom73
Cytat
Warning: include(/includes/shoutbox/minichat.php) [function.include]: failed to open stream: No such file or directory in /var/www/virtual/thawsite.cba.pl/site.thawsite.cba.pl/includes/news_bg/shout.php on line 39

Warning: include() [function.include]: Failed opening '/includes/shoutbox/minichat.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/virtual/thawsite.cba.pl/site.thawsite.cba.pl/includes/news_bg/shout.php on line 39
erix
No to znaczy, że plików nie ma, które dołączasz... dry.gif

Poza tym, ścieżki zaczynające się od / są uniksowe, dla głównego katalogu, a nie Twojego konta. tongue.gif
Ziom73
Oto linki do plików:
http://site.thawsite.cba.pl/includes/news_bg/shout.php
http://site.thawsite.cba.pl/includes/shoutbox/minichat.php

A więc rozumiem, że mam usunąć "/" na początku:
  1. <?php
  2. error_reporting(E_ALL); // poziom raportowania, <a href=\"http://pl.php.net/manual/pl/function.error-reporting.php\" target=\"_blank\">http://pl.php.net/manual/pl/function.error-reporting.php</a>
  3. ini_set('display_errors', 1);
  4. ?>
  5. <?php
  6. $token = md5(uniqid(rand(), true));
  7. $_SESSION['token'] = $token;
  8. ?>
  9. <!-- 1. Important: the PHP code above must appear at the top of any page which includes the shoutbox (before any HTML is started). -->
  10. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  11. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  12. <head>
  13.  
  14. <title>SB</title>
  15.  
  16. <!-- Copy the code between "Start Meta and links" and "End Meta and links",
  17. paste it before the </head> closing tag on every page which includes the shoutbox
  18. -->
  19.  
  20. <!-- 2. Start Meta and links -->
  21. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  22. <style type="text/css">
  23. /* for Mozilla only: create rounded corners */
  24. #box {
  25. -moz-border-radius: 10px 10px 10px 10px;
  26. }
  27. </style>
  28. <link rel="stylesheet" type="text/css" href="includes/shoutbox/wtag/css/main-style.css" />
  29. <script type="text/javascript" src="includes/shoutbox/wtag/js/dom-drag.js"></script>
  30. <script type="text/javascript" src="includes/shoutbox/wtag/js/scroll.js"></script>
  31. <script type="text/javascript" src="includes/shoutbox/wtag/js/conf.js"></script>
  32. <script type="text/javascript" src="includes/shoutbox/wtag/js/ajax.js"></script>
  33. <script type="text/javascript" src="includes/shoutbox/wtag/js/drop_down.js"></script>
  34. </head>
  35.  
  36. <body>
  37. <?PHP
  38. include('includes/shoutbox/minichat.php');
  39. ?>
  40. </body>
  41. </html>


Jednak nadal występuję błąd:
Cytat
Warning: include(includes/shoutbox/minichat.php) [function.include]: failed to open stream: No such file or directory in /var/www/virtual/thawsite.cba.pl/site.thawsite.cba.pl/includes/news_bg/shout.php on line 39

Warning: include() [function.include]: Failed opening 'includes/shoutbox/minichat.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/virtual/thawsite.cba.pl/site.thawsite.cba.pl/includes/news_bg/shout.php on line 39
erix
Człowieku, dostosuj sobie ścieżki po prostu, bo w tym tkwi problem...

Sprawdź, gdzie jesteś w drzewie katalogowym względem skryptu i wykorzystaj tę wiedzę. Napiszę wywal shoutbox, to też do zrobisz bezmyślnie? Więcej samodzielności, pokombinuj trochę sam, to naprawdę nietrudne, a więcej zapamiętasz.
Ziom73
w dzewie katalogowym mam:
Cytat
0:/site.thawsite.cba.pl/includes/shoutbox/

Ale przecież tak mam ;/ i nie działa ;p
  1. <?php
  2. /includes/shoutbox/minichat.php
  3. ?>
erix
W FTP tak, ale:
  • katalog chroot w FTP nie jest tym samym, co na dysku. Można zamknąć ścieżkę na FTP w jednym katalogu, a rzeczywista ścieżka będzie składała się z dziesiątek podkatalogów. Nie wierzysz? dirname" title="Zobacz w manualu PHP" target="_manual(__FILE__) i sam się przekonaj.
  • slash na początku nakazuje szukanie od głównego katalogu, ale DYSKU, a nie Twojego konta
Ziom73
  1. <?php require_once( str_replace('//','/',dirname(__FILE__).'/') .'includes/shoutbox/minichat.php'); ?>

i
  1. <?php require_once( str_replace('//','/',dirname(__FILE__).'/') .'/includes/shoutbox/minichat.php'); ?>


Nie działa ;/, polega chyba to na tym, że odczytuję: http://site.thawsite.cba.pl/includes/news_...ox/minichat.php
zamiast http://site.thawsite.cba.pl/includes/news_bg/shout.php

Pewnie coś robię nie tak jak zawsze ;p, ale już skończyły mi się pomysły ;/
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.