Mam skrypt księgi gości. Główny plik wygląda tak:
<?php
function ShowEntries($page) {
include("output.php");
$output = new COutput($page);
$output->Output_All();
$action = "show";
}
function NewEntry($newname, $newmail, $newurl, $newicq, $newaim, $newtext) {
include("input.php");
$input = new CInput();
$input->Formular_Show(0, $newname, $newmail, $newurl, $newicq, $newaim, $newtext);
}
function WriteEntry($newname, $newmail, $newicq, $newaim, $newurl, $newtext, $emotion = "no", $preview = 0, $write = 0, $random = -1) {
include("input.php");
$input = new CInput($emotion);
if ($preview != 0 && $write != 0) {
$input->Write_Data($newname, $newmail, $newicq, $newaim, $newurl, $newtext, $random);
header ("Location: guestbook.php?act=show"); }
elseif ($preview != 0) {
include("preview.php");
$preview = new CPreview($emotion);
$preview->Show_Preview($newname, $newmail, $newicq, $newaim, $newurl, $newtext);
}
else {
$input->Write_Data($newname, $newmail, $newicq, $newaim, $newurl, $newtext, $random);
}
}
#administration in progress?
$i++;
if ($i > 9) {
echo "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">"; echo "<HTML><HEAD><TITLE>Guestbook</TITLE><LINK HREF="guestbook
.css
" REL="stylesheet
" TYPE="text
/css
"></HEAD>"; echo "<TABLE BORDER="0" VALIGN="middle
" WIDTH="100%" HEIGHT="100%">"; echo "<TR><TD ALIGN="center
">"; echo "<FONT SIZE="5" COLOR="E01010
">Administration activities in progress.<BR>Please try it later again!</FONT>"; echo "</TD></TR></TABLE></BODY></HTML>"; }
}
if (($act == "") || ($act == "show")) {
#show guestbook
if (!isset($page)) $page = 1; call_user_func("ShowEntries", $page);
}
elseif ($act == "new") {
#new guestbook entry
if (!isset($newname)) $newname = ""; if (!isset($newmail)) $newmail = ""; if (!isset($newurl) || $newurl == "") $newurl = "http://"; if (!isset($newicq)) $newnicq = ""; if (!isset($newaim)) $newnaim = ""; if (!isset($newtext)) $newtext = ""; call_user_func("NewEntry", $newname, $newmail, $newurl, $newicq, $newaim, $newtext);
}
elseif ($act == "write") {
if ($pre == "yes" && $presave == "yes") {
#save the preview data
call_user_func("WriteEntry", $newname, $newmail, $newicq, $newaim, $newurl, $newtext, $emotion, 1, 1, $random);
}
elseif ($pre == "yes") {
#save data with preview
call_user_func("WriteEntry", $newname, $newmail, $newicq, $newaim, $newurl, $newtext, $emotion, 1);
} else {
#save data without preview
call_user_func("WriteEntry", $newname, $newmail, $newicq, $newaim, $newurl, $newtext, $emotion);
header ("Location: guestbook.php?act=show"); }
}
?>
Wszystko działa poprawnie, ale gdy zrobie tak:
php:
<html><HEAD><meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
<meta http-equiv="Content-Language" content="pl"><TITLE>KzP</TITLE><link rel=stylesheet type=text/css href=style.css></HEAD>
<body background=obrazy/bg2.jpg>
<center>
<table width="900" height="0">
<tr>
<td width="900" height="0" colspan="5"><center><?php include ("menu1.php"); ?></center></td>
</tr>
<tr>
<td width="150" height="0" valign="top"><?php include ("menu3.php") ?></td>
<td width="750" height="0" valign="top" align="center"><?php
function ShowEntries($page) {
include("output.php");
$output = new COutput($page);
$output->Output_All();
$action = "show";
}
function NewEntry($newname, $newmail, $newurl, $newicq, $newaim, $newtext) {
include("input.php");
$input = new CInput();
$input->Formular_Show(0, $newname, $newmail, $newurl, $newicq, $newaim, $newtext);
}
function WriteEntry($newname, $newmail, $newicq, $newaim, $newurl, $newtext, $emotion = "no", $preview = 0, $write = 0, $random = -1) {
include("input.php");
$input = new CInput($emotion);
if ($preview != 0 && $write != 0) {
$input->Write_Data($newname, $newmail, $newicq, $newaim, $newurl, $newtext, $random);
header ("Location: guestbook.php?act=show"); }
elseif ($preview != 0) {
include("preview.php");
$preview = new CPreview($emotion);
$preview->Show_Preview($newname, $newmail, $newicq, $newaim, $newurl, $newtext);
}
else {
$input->Write_Data($newname, $newmail, $newicq, $newaim, $newurl, $newtext, $random);
}
}
#administration in progress?
$i++;
if ($i > 9) {
echo "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">"; echo "<HTML><HEAD><TITLE>Guestbook</TITLE><LINK HREF="guestbook
.css
" REL="stylesheet
" TYPE="text
/css
"></HEAD>"; echo "<TABLE BORDER="0" VALIGN="middle
" WIDTH="100%" HEIGHT="100%">"; echo "<TR><TD ALIGN="center
">"; echo "<FONT SIZE="5" COLOR="E01010
">Administration activities in progress.<BR>Please try it later again!</FONT>"; echo "</TD></TR></TABLE></BODY></HTML>"; }
}
if (($act == "") || ($act == "show")) {
#show guestbook
if (!isset($page)) $page = 1; call_user_func("ShowEntries", $page);
}
elseif ($act == "new") {
#new guestbook entry
if (!isset($newname)) $newname = ""; if (!isset($newmail)) $newmail = ""; if (!isset($newurl) || $newurl == "") $newurl = "http://"; if (!isset($newicq)) $newnicq = ""; if (!isset($newaim)) $newnaim = ""; if (!isset($newtext)) $newtext = ""; call_user_func("NewEntry", $newname, $newmail, $newurl, $newicq, $newaim, $newtext);
}
elseif ($act == "write") {
if ($pre == "yes" && $presave == "yes") {
#save the preview data
call_user_func("WriteEntry", $newname, $newmail, $newicq, $newaim, $newurl, $newtext, $emotion, 1, 1, $random);
}
elseif ($pre == "yes") {
#save data with preview
call_user_func("WriteEntry", $newname, $newmail, $newicq, $newaim, $newurl, $newtext, $emotion, 1);
} else {
#save data without preview
call_user_func("WriteEntry", $newname, $newmail, $newicq, $newaim, $newurl, $newtext, $emotion);
header ("Location: guestbook.php?act=show"); }
}
?></td>
</tr>
<tr>
<td width="0" height="0"></td>
<td width="900" height="0"><center><?php include ("menu2.php") ?></center></td>
<td width="0" height="0"></td>
</tr>
</table>
</center>
</body>
</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?