Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php]Raz tak raz nie.
Goric
post
Post #1





Grupa: Zarejestrowani
Postów: 14
Pomógł: 0
Dołączył: 4.03.2007

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


Mam wyjątkowo dziwny problem. Na moim komputerze (notebook FJ AMILO) mam zainstalowanego XAMPP'a (najnowsza wersja, system operacyjny Windows). Napisałem skrypt, po czym zaraz go uruchomiłem. Okazało się, że skrypt wykonuje jedne polecenia, innych nie, albo np. definiuję stałą REF, dołączam plik, w którym jest instrukacja if sprwadzająca czy została zdefiniowana stała REV. Jeśli takowa nie została zainicjowana, to powinien się wyświetlić odpowiedni komunikat. Jednakże nic takiego się nie pokazuje. Jestem sfrustrowanay, błagam na kolanach o pomoc.

PS. A jeszcze dziwniejsze jest to, że jak uruchamiam np. forum phpBB3, to wszystko działa poprawnie. (IMG:http://forum.php.pl/style_emoticons/default/sciana.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Goric
post
Post #2





Grupa: Zarejestrowani
Postów: 14
Pomógł: 0
Dołączył: 4.03.2007

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


Chodzi mi o to, żeskrypt jest DOBRZE napisany. Ale skoro tak, to szukajcie błędów:

Plik index.php
  1. <?php
  2. define("REF", 1);
  3.  
  4. require_once "geoip.php";
  5. require_once "core.php";
  6. ?>
  7. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  8. <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="pl-pl" xml:lang="pl-pl">
  9. <head>
  10.  
  11. <meta http-equiv="content-type" content="text/html; charset=iso-8859-2" />
  12. <meta http-equiv="content-language" content="pl-pl" />
  13. <meta http-equiv="content-style-type" content="text/css" />
  14. <meta http-equiv="imagetoolbar" content="no" />
  15. <meta name="resource-type" content="document" />
  16. <meta name="distribution" content="global" />
  17. <meta name="copyright" content="" />
  18. <meta name="keywords" content="" />
  19. <meta name="description" content="" />
  20. <title>Revolution Game Studios &bull; Strona główna</title>
  21.  
  22. <link rel="stylesheet" href="forum/styles/codeblack/theme/stylesheet.css" type="text/css" />
  23.  
  24. <script type="text/javascript">
  25. // <![CDATA[
  26.  
  27. function popup(url, width, height, name)
  28. {
  29. if (!name)
  30. {
  31. name = '_popup';
  32. }
  33.  
  34. window.open(url.replace(/&amp;/g, '&'), name, 'height=' + height + ',resizable=yes,scrollbars=yes,width=' + width);
  35. return false;
  36. }
  37.  
  38. function jumpto()
  39. {
  40. var page = prompt('Wprowadź numer strony, do której chcesz przejść.:', '');
  41. var perpage = '';
  42. var base_url = '';
  43.  
  44. if (page !== null && !isNaN(page) && page > 0)
  45. {
  46. document.location.href = base_url.replace(/&amp;/g, '&') + '&start=' + ((page - 1) * perpage);
  47. }
  48. }
  49.  
  50. /**
  51. * Find a member
  52. */
  53. function find_username(url)
  54. {
  55. popup(url, 760, 570, '_usersearch');
  56. return false;
  57. }
  58.  
  59. /**
  60. * Mark/unmark checklist
  61. * id = ID of parent container, name = name prefix, state = state [true/false]
  62. */
  63. function marklist(id, name, state)
  64. {
  65. var parent = document.getElementById(id);
  66. if (!parent)
  67. {
  68. eval('parent = document.' + id);
  69. }
  70.  
  71. if (!parent)
  72. {
  73. return;
  74. }
  75.  
  76. var rb = parent.getElementsByTagName('input');
  77.  
  78. for (var r = 0; r < rb.length; r++)
  79. {
  80. if (rb[r].name.substr(0, name.length) == name)
  81. {
  82. rb[r].checked = state;
  83. }
  84. }
  85. }
  86.  
  87.  
  88. // ]]>
  89. </script>
  90. </head>
  91. <body class="ltr">
  92.  
  93. <a name="top"></a>
  94.  
  95. <div id="wrapheader">
  96.  
  97. <div id="logodesc">
  98. <table width="100%" cellspacing="0">
  99. <tr>
  100. <td><a href="./index.php"><img src="forum/styles/codeblack/imageset/logo.jpg" width="800" height="120" alt="" title="" /></a></td>
  101. </tr>
  102. </table>
  103. </div>
  104.  
  105. <div id="menubar">
  106. <table class="tablebg" width="100%" cellspacing="1">
  107. <tr>
  108. <td align="center" valign="middle" class="cat">
  109. <a href="#"><img src="img/pl.png" /></a>&nbsp;&nbsp;<a href="#"><img src="img/en.png" /></a>
  110. </td>
  111. </tr>
  112. </table>
  113. </div>
  114.  
  115. </div>
  116.  
  117. <div id="wrapcentre" align="center">
  118. <br />
  119. <!-- Games Section -->
  120. <img src="<?php echo header_img("g"); ?>" />
  121. <br />
  122. <!-- Forums Section -->
  123. <br />
  124. <img src="<?php echo header_img("f"); ?>" />
  125. <br />
  126. <!-- Contact Section -->
  127. <br />
  128. <img src="<?php echo header_img("c"); ?>" />
  129. <br />
  130. </div>
  131.  
  132. <br />
  133.  
  134. <div id="menubar">
  135. <table class="tablebg" width="100%" cellspacing="1">
  136. <tr>
  137. <td align="center" valign="middle" class="cat">
  138. &copy; 2008 Revolution Game Studios
  139. </td>
  140. </tr>
  141. </table>
  142. </div>
  143.  
  144. <div id="wrapfooter">
  145. <span class="gensmall"></span><br /><span class="copyright">
  146. Design &copy; 2008 <a href="http://www.phpbbstylists.com" target="_blank">phpbbstylists.com</a>
  147. </span>
  148. </div>
  149.  
  150. </body>
  151. </html>


Pliku geoip.php nie zamieszczam bo za długi post by był, ale jest ze strony www.maxmind.com.

Plik core.php
  1. <?php
  2.  
  3. if (!defined(REV)) { die("Fucking Killfile."); }
  4.  
  5.  
  6. if (isset($_COOKIE['revgs_country'])) {
  7. $lang == $_COOKIE['revgs_country'];
  8. } else {
  9. $gi = geoip_open($_SERVER["DOCUMENT_ROOT"]."/rev_gs/GeoIP.dat", GEOIP_STANDARD);
  10. $vis_lang = geoip_country_code_by_addr($gi, $_SERVER["REMOTE_ADDR"]);
  11. echo $vis_lang;
  12.  
  13. if ($vis_lang == "PL") {
  14. setcookie("revgs_country", "pl", 120 * 24 * 60 * 60);
  15. $lang = "pl";
  16. } else {
  17. setcookie("revgs_country", "en", 120 * 24 * 60 * 60);
  18. $lang = "en";
  19. }
  20. }
  21. echo $lang;
  22.  
  23.  
  24. if (isset($_GET['i'])) {
  25. $bg = imagecreatefrompng("img/btn_bg.png");
  26. $image = imagecreatefrompng("img/btns/".$_GET['i']);
  27. $text = DBArray("SELECT name FROM ".$dbprefix."options WHERE id=1");
  28. imagecopy($bg, $image, 380, 125, 0, 0, 380, 125);
  29. header("Content-type: image/png");
  30. imagepng($image);
  31. die();
  32. }
  33.  
  34. function header_img($img) {
  35. return "img/".$lang."/".$img.".png";
  36. }
  37. ?>


To wszystko, mówiłem że wszystko okej, ale skoro tak... Proszę, nie wyżywajcie się na mnie, miałem zły dzień. Bardzo zły dzień...
Go to the top of the page
+Quote Post
mike
post
Post #3





Grupa: Przyjaciele php.pl
Postów: 7 494
Pomógł: 302
Dołączył: 31.03.2004

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


Cytat(Goric @ 18.04.2008, 20:25:32 ) *
Chodzi mi o to, żeskrypt jest DOBRZE napisany.
Powiem Ci coś co może Cię zaskoczyć. Dobrze napisane skrypty działają zawsze tak samo. Mało tego one działają.
  1. <?php
  2.  
  3. // ...
  4. define("REF", 1);
  5.  
  6. // ...
  7.  
  8. if (!defined(REV)) // ...
  9.  
  10. ?>
Widzisz to co ja widzę? (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg)
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: 6.10.2025 - 23:55