Mam skrypt ksiêgi go¶ci. G³ówny plik wygl±da tak:
  1. <?php
  2.  
  3. function ShowEntries($page) {
  4. if (!file_exists("output.php")) die ("Can't open output.php!");
  5. include("output.php");
  6. $output = new COutput($page);
  7. $output->Output_All();
  8. unset($output);
  9. $action = "show";
  10. }
  11.  
  12.  
  13. function NewEntry($newname, $newmail, $newurl, $newicq, $newaim, $newtext) {
  14. if (!file_exists("input.php")) die ("Can't open input.php!");
  15. include("input.php");
  16. $input = new CInput();
  17. $input->Formular_Show(0, $newname, $newmail, $newurl, $newicq, $newaim, $newtext);
  18. unset($input);
  19. }
  20.  
  21.  
  22. function WriteEntry($newname, $newmail, $newicq, $newaim, $newurl, $newtext, $emotion = "no", $preview = 0, $write = 0, $random = -1) {
  23. if (!file_exists("input.php")) die ("Can't open input.php!");
  24. include("input.php");
  25. $input = new CInput($emotion);
  26. if ($preview != 0 && $write != 0) {
  27. $input->Write_Data($newname, $newmail, $newicq, $newaim, $newurl, $newtext, $random);
  28. header ("Location: guestbook.php?act=show");
  29. }
  30. elseif ($preview != 0) {
  31. if (!file_exists("preview.php")) die ("Can't open preview.php!");
  32. include("preview.php");
  33.  
  34. $preview = new CPreview($emotion);
  35.  
  36. $preview->Show_Preview($newname, $newmail, $newicq, $newaim, $newurl, $newtext);
  37. }
  38. else {
  39. $input->Write_Data($newname, $newmail, $newicq, $newaim, $newurl, $newtext, $random);
  40. }
  41. unset($input);
  42. }
  43.  
  44.  
  45.  
  46.  
  47. #administration in progress?
  48. while (file_exists("data/lock.lck")) {
  49. usleep(500000);
  50. $i++;
  51. if ($i > 9) {
  52. echo "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">";
  53. echo "<HTML><HEAD><TITLE>Guestbook</TITLE><LINK HREF="guestbook.css" REL="stylesheet" TYPE="text/css"></HEAD>";
  54. echo "<BODY>";
  55. echo "<TABLE BORDER="0" VALIGN="middle" WIDTH="100%" HEIGHT="100%">";
  56. echo "<TR><TD ALIGN="center">";
  57. echo "<FONT SIZE="5" COLOR="E01010">Administration activities in progress.<BR>Please try it later again!</FONT>";
  58. echo "</TD></TR></TABLE></BODY></HTML>";
  59. }
  60. }
  61.  
  62.  
  63. if (($act == "") || ($act == "show")) {
  64. #show guestbook
  65. if (!isset($page)) $page = 1;
  66. call_user_func("ShowEntries", $page);
  67. }
  68. elseif ($act == "new") {
  69. #new guestbook entry
  70. if (!isset($newname)) $newname = "";
  71. if (!isset($newmail)) $newmail = "";
  72. if (!isset($newurl) || $newurl == "") $newurl = "http://";
  73. if (!isset($newicq)) $newnicq = "";
  74. if (!isset($newaim)) $newnaim = "";
  75. if (!isset($newtext)) $newtext = "";
  76. call_user_func("NewEntry", $newname, $newmail, $newurl, $newicq, $newaim, $newtext);
  77. }
  78. elseif ($act == "write") {
  79. if ($pre == "yes" && $presave == "yes") {
  80. #save the preview data
  81. call_user_func("WriteEntry", $newname, $newmail, $newicq, $newaim, $newurl, $newtext, $emotion, 1, 1, $random);
  82. }
  83. elseif ($pre == "yes") {
  84. #save data with preview
  85. call_user_func("WriteEntry", $newname, $newmail, $newicq, $newaim, $newurl, $newtext, $emotion, 1);
  86. } else {
  87. #save data without preview
  88. call_user_func("WriteEntry", $newname, $newmail, $newicq, $newaim, $newurl, $newtext, $emotion);
  89. header ("Location: guestbook.php?act=show");
  90. }
  91. }
  92.  
  93.  
  94. ?>



Wszystko dzia³a poprawnie, ale gdy zrobie tak:
php:
  1. <html><HEAD><meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
  2. <meta http-equiv="Content-Language" content="pl"><TITLE>KzP</TITLE><link rel=stylesheet type=text/css href=style.css></HEAD>
  3.  
  4. <body background=obrazy/bg2.jpg>
  5.  <center>
  6. <table width="900" height="0">
  7. <tr>
  8. <td width="900" height="0" colspan="5"><center><?php include ("menu1.php"); ?></center></td>
  9. </tr>
  10.  
  11. <tr>
  12. <td width="150" height="0" valign="top"><?php include ("menu3.php") ?></td>
  13. <td width="750" height="0" valign="top" align="center"><?php
  14.  
  15. function ShowEntries($page) {
  16. if (!file_exists("output.php")) die ("Can't open output.php!");
  17. include("output.php");
  18. $output = new COutput($page);
  19. $output->Output_All();
  20. unset($output);
  21. $action = "show";
  22. }
  23.  
  24.  
  25. function NewEntry($newname, $newmail, $newurl, $newicq, $newaim, $newtext) {
  26. if (!file_exists("input.php")) die ("Can't open input.php!");
  27. include("input.php");
  28. $input = new CInput();
  29. $input->Formular_Show(0, $newname, $newmail, $newurl, $newicq, $newaim, $newtext);
  30. unset($input);
  31. }
  32.  
  33.  
  34. function WriteEntry($newname, $newmail, $newicq, $newaim, $newurl, $newtext, $emotion = "no", $preview = 0, $write = 0, $random = -1) {
  35. if (!file_exists("input.php")) die ("Can't open input.php!");
  36. include("input.php");
  37. $input = new CInput($emotion);
  38. if ($preview != 0 && $write != 0) {
  39. $input->Write_Data($newname, $newmail, $newicq, $newaim, $newurl, $newtext, $random);
  40. header ("Location: guestbook.php?act=show");
  41. }
  42. elseif ($preview != 0) {
  43. if (!file_exists("preview.php")) die ("Can't open preview.php!");
  44. include("preview.php");
  45.  
  46. $preview = new CPreview($emotion);
  47.  
  48. $preview->Show_Preview($newname, $newmail, $newicq, $newaim, $newurl, $newtext);
  49. }
  50. else {
  51. $input->Write_Data($newname, $newmail, $newicq, $newaim, $newurl, $newtext, $random);
  52. }
  53. unset($input);
  54. }
  55.  
  56.  
  57.  
  58.  
  59. #administration in progress?
  60. while (file_exists("data/lock.lck")) {
  61. usleep(500000);
  62. $i++;
  63. if ($i > 9) {
  64. echo "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">";
  65. echo "<HTML><HEAD><TITLE>Guestbook</TITLE><LINK HREF="guestbook.css" REL="stylesheet" TYPE="text/css"></HEAD>";
  66. echo "<BODY>";
  67. echo "<TABLE BORDER="0" VALIGN="middle" WIDTH="100%" HEIGHT="100%">";
  68. echo "<TR><TD ALIGN="center">";
  69. echo "<FONT SIZE="5" COLOR="E01010">Administration activities in progress.<BR>Please try it later again!</FONT>";
  70. echo "</TD></TR></TABLE></BODY></HTML>";
  71. }
  72. }
  73.  
  74.  
  75. if (($act == "") || ($act == "show")) {
  76. #show guestbook
  77. if (!isset($page)) $page = 1;
  78. call_user_func("ShowEntries", $page);
  79. }
  80. elseif ($act == "new") {
  81. #new guestbook entry
  82. if (!isset($newname)) $newname = "";
  83. if (!isset($newmail)) $newmail = "";
  84. if (!isset($newurl) || $newurl == "") $newurl = "http://";
  85. if (!isset($newicq)) $newnicq = "";
  86. if (!isset($newaim)) $newnaim = "";
  87. if (!isset($newtext)) $newtext = "";
  88. call_user_func("NewEntry", $newname, $newmail, $newurl, $newicq, $newaim, $newtext);
  89. }
  90. elseif ($act == "write") {
  91. if ($pre == "yes" && $presave == "yes") {
  92. #save the preview data
  93. call_user_func("WriteEntry", $newname, $newmail, $newicq, $newaim, $newurl, $newtext, $emotion, 1, 1, $random);
  94. }
  95. elseif ($pre == "yes") {
  96. #save data with preview
  97. call_user_func("WriteEntry", $newname, $newmail, $newicq, $newaim, $newurl, $newtext, $emotion, 1);
  98. } else {
  99. #save data without preview
  100. call_user_func("WriteEntry", $newname, $newmail, $newicq, $newaim, $newurl, $newtext, $emotion);
  101. header ("Location: guestbook.php?act=show");
  102. }
  103. }
  104.  
  105.  
  106. ?></td>
  107.  </tr>
  108. <tr>
  109. <td width="0" height="0"></td>
  110. <td width="900" height="0"><center><?php include ("menu2.php") ?></center></td>
  111. <td width="0" height="0"></td>
  112. </tr>
  113. </table>
  114. </center>
  115. </body>
  116. </html>



... gdy zapisze wpis to wy¶wietla sam± strone tak jakby nie by³o skryptu. Co zrobiæ, ¿eby skrypt dzia³a³ tak jak bez strony?