fejl i min gæstebog HJÆLP

Tags:    php

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



7 svar postet i denne tråd vises herunder
0 indlæg har modtaget i alt 0 karma
Sorter efter stemmer Sorter efter dato
filen gaestebog.php
kaldes med - "index.php?side=gaestebog"
--------------------------------------------------------------------------------------
jeg ved godt at det ikke er at rette din fejl.. men for mig at se er der lgie lovlig meget rod i det..
eller goså er det mig der ikke gidder at sætte mig ind i det..

ps. Det kræver at du har mySQL for at bruge min skabelon
--------------------------------------------------------------------------------------

<script language="JavaScript">
function Check() {
if (document.post.nick.value == "") {
alert("Du skal skrive dit navn");
return false;
}
if (document.post.tag.value == "") {
alert("Du skal skrive en besked");
return false;
}
}
</script>

<h1>Tilføj indlæg</h1>
Her kan du så lægge en lille hilsen, det vil glæde mig!<br>
Udfyld felterne herunder for at skrive i gæstebogen.

<form action="index.php?side=gaestebog&tag=1" method="POST" onsubmit="return Check()">
<h1>Navn</h1>
<input type="text" name="nick" value="<? print $_SESSION['bruger'] ?>" class="formelementer">
<?
if (isset($_GET['tag']) && ($_POST['nick'] >= '2') && ($_POST['tag'] >= '5')) {
print "$_POST[nick], Thanks for sending! :)~";
}
?><br><br>
<h1>Indlæg</h1>
<textarea cols="65" rows="5" name="tag" class="formelementer"></textarea><br>
<input type="submit" value="Send" class="knap" onclick="javascript:validate();">
-> <a href="index.php?side=gaestebog">Opdater</a> <-
</form>


Indlæg (<a href="index.php?side=gaestebog&limit=alle">se dem alle?</a>;):<br>
<?
if (isset($_GET['tag']) && ($_POST['nick'] >= '2') && ($_POST['tag'] >= '5')) {
$time = date("d/m-y H:i");
$tag = strip_tags($_POST['tag'], '<a><b><i><u>');
$tag = str_replace("","<br>",nl2br($tag));
mysql_query("INSERT INTO tagwall (nick, tag, ip, time) VALUES ('".$_POST['nick']."', '".$tag."', '".$_SERVER['REMOTE_ADDR']."', '".$time."')") or die(mysql_error());
}
if (isset($_GET['limit'])) {
$result = mysql_query("SELECT * FROM tagwall ORDER BY id DESC") or die(mysql_error());
}
else {
$result = mysql_query("SELECT * FROM tagwall ORDER BY id DESC LIMIT 0,15") or die(mysql_error());
}
while($row = mysql_fetch_array($result)) {
if ($i%2==0) {
$color = "EEEEEE";
} else {
$color = "ffffff";
}

echo"<table width='100%' border='0' cellspacing='0' cellpadding='2'><tr bgcolor='$color'><td><h1><a href=\\"index.php?side=gaestebog&show=info&id=".$row['id']."\\">".$row['nick'].":</a></h1> ".$row['tag']."</td></tr></table>\\n";
$i = $i + 1;


if (isset($_GET['show']) && isset($_GET['id']) && ($_GET['id'] == $row['id'])){
print "    ip: <b>".$row['ip']."</b> klokken: <b>".$row['time']."</b><br>";
}
}

?>



Du er kommet til at skrive "exeplode" og ikke "explode" i functionen spilt_entires($file) som forresten også kaldes split_entires et andet sted i koden....[Redigeret d. 15/11-02 13:26:25 af Erik K. Aarslew-Jensen]



Du er kommet til at skrive "exeplode" og ikke "explode" i functionen spilt_entires($file) som forresten også kaldes split_entires et andet sted i koden....[Redigeret d. 15/11-02 13:26:25 af Erik K. Aarslew-Jensen]


hmm det virkede ikke



hvad er problemet mere nøjagtigt?



Sikker på du har kaldt alle filerne .php4 ?!

---------------
www.ralum.dk // ralum@ralum.dk



t