dette er så mine filer
1 book.PHP
2 guestbook_inc.PHP
3 guestbook.PHP
4 guestbook.DAT
dette er mine filer her er kildekoderne
BOOK.PHP
<html>
<hrad>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#ffffff">
<?php
// this i book.php4 - it accepts form data and writes to a file
// guestbook class included
include("guestbook_inc.php4");
//spawn a guestbook
$mybook = new Guestbook();
// set an object property
// make sure you have permission to write this file
$mybook->usefile('guestbook.dat');
// use a method of the new object to write data
if($name && $email && $comments)
{
$mybook->add_entry($name,$email,$comments);
}
// object also include a method to display orevious entries
$mybook->display();
?>
</body>
</html>
-----------------------------------------------------------------------
guestbook_inc.PHP
<?php
class Guestbook{
// default settings
function Guestbook()
{
$this->title = "min gæstebog";
$this->fontface = "Verdana";
$this->fontsiZe = "2";
$this->fontcolor = "#FFoooo";
$this->filname = "default.txt";
}
// set the title
function set_title($title)
{
$this->title = $title;
}
// set the font properties
function set_fontsize($fontsize)
{
$this->fontsize = $fontsize;
}
function set_fontcolor($fontcolor)
{
$this->fontcolor = $fontcolor;
}
// set the name of the data file
function usefile($file)
{
$this->filemane = $file;
}
//function to actually write from data to file
// elemente of each entry are separated by a |
function add_entry($name,$email,$comments)
{
$entry = $name."|".$email."|".$comments."\\n";
$this->fpointer = fopen($this->filename,"a+");
fputs($this->fpointer,$entry);
fclose($this->fpointer);
}
//spilt entries against |
// and call display _entries() function
function spilt_entires($file)
{
$entries = file($file,"r");
for($counter = 0; $counter < sizeof($entries); $counter++)
{
$entry = exeplode ("|", $entries[$counter]);
$this->display_entries($entry);
}
}
// display an entry in the guestbook
function display_entries($entry)
{
for($counter = 0;$counter < sizeof($entry);$counter++)
{
print "<center><font face=\\"$this->fontface\\" size=$this->fontsize
color=$this->fontcolor->fontcolor>$entry[$counter]</font></center><br>";
}
print " <hr width=50%>";
}
// display the title
function display_title()
{
print "<center><font face=\\"$this->fontface\\" size=$this->fontsize
color=$this->fontcolor>$this->title</font></center><br><hr width=75%>";
}
// display_page
function display()
{
$this->display_title();
$this->split_entries($this->filename);
}
}
?>
----------------------------------------------------------------------
guestbook.PHP
<html>
<head>
<title>Skriv i min gæstebog</title>
</head>
<body bgcolor="#cacaff">
<form action="book.php4" method="post">
<center>
<table width="100%" cellpadding="10" cellspacing="5">
<tr align="center">
<td width="50%" align="right"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Navn</font></b></td>
<td align="left">
<input type="text" name="name" size="30" maxlength="50">
</td>
</tr>
<tr align="center">
<td width="50%" align="right"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Email Adresse</font></b></td>
<td align="left">
<input type="text" name="email" size="30" maxlength="50">
</td>
</tr>
<tr>
<td align="right" width="50%"><b><font face ="Verdana, Arial, Helvetica, sans-serif" size="2">kommentar</font></b></td>
<td align="left">
<textarea name="comments" cols="40" rows="5" warp="virtual"></textarea>
</td>
</tr>
<tr>
<td valign="middel" align="center">
<td cilspan="2" height="53">
<p>
<input type="submit" value="Skriv i bogen" name="submit">
</p>
</td>
<tr>
</table>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size"2"><a href="book.php4"><b>Vis gæstebog</b></a></font></p>
</center>
</form>
</body>
</html>
----------------------------------------------------------------
guestbook.DAT
TOM
som sagt jeg kan ikke finde fejlen