Ich habe ein onefile opensource Gästebuch für meine Zwecke umgeschrieben, allerdings fehlen mir da noch ein paar Funktionen.
Ich hätte gerne eine Blätterfunktion in diesem Gästebuch. So das automatisch nach 10 Einträgen eine neue Seite entsteht. und wie bekomme ich das hin, das man den Teil zum eintragen per klick einklappen kann???
Würde mich über Antworten freuen.
In Aktion:
http://nightmaresh.ni.funpic.de/test/guestbook.php
[code]
<?php$gbfile = „guestbook.txt“;
$thisfile = „guestbook.php“;
$dateshow = „d-m-Y - H:i:s“;
$username = „demo“;
$password = „demo“;
$wrongpass = „Not logged in!“;
$wrongname = „Not logged in!“;
$thankstxt = „
Thank you for writing in my guestbook!
You will be sent back in 3 seconds. If not click here
$errornoname = „
You have to enter a name!
You will be sent back in 3 seconds. If not click here
$errornomsg = „
You have to enter a message!
You will be sent back in 3 seconds. If not click here
$gbedited = „
Guestbook has been edited!
You will be sent back in 3 seconds. If not click here
$gbpage = „$_SERVER[PHP_SELF]“;
$date = date(„$dateshow“);
$name = htmlentities(strip_tags($_POST[‚name‘]));
$email = htmlentities(strip_tags($_POST[‚email‘]));
$homepage = htmlentities(strip_tags($_POST[‚homepage‘]));
$message = nl2br(htmlentities(strip_tags($_POST[‚message‘])));
$message = str_replace(array(„\r“, „\n“), ‚‘, $message);
$message = wordwrap($message, 75, „
“, true);
$printfull = „<table width="790" border="0" align="center" bordercolor="#CCCCCC"><font color="#000000">$name | <font size="-1">$date | <a href="mailto:$email"><img src="pics/mail.png" width="13" height="11" border="0" alt="$email"> | <a href="$homepage" target="_blank"><img src="pics/hp.gif" width="16" height="16" border="0" alt="$homepage"> |
$message
\n“;
$printnoemail = „<table width="790" border="0" align="center" bordercolor="#CCCCCC"><font color="#000000">$name | <font size="-1">$date | <a href="$homepage" target="_blank"><img src="pics/hp.gif" width="16" height="16" border="0" alt="$homepage"> |
$message
\n“;
$printnopage = „<table width="790" border="0" align="center" bordercolor="#CCCCCC"><font color="#000000">$name | <font size="-1">$date | <a href="mailto:$email"><img src="pics/mail.png" width="13" height="11" border="0" alt="$email"> |
$message
\n“;
$printnoemailpage = „<table width="790" border="0" align="center" bordercolor="#CCCCCC"><font color="#000000">$name | <font size="-1">$date |
$message
\n“;
switch($_GET[‚id‘])
{
default:
?>
Name: | |
Email: | |
Homepage: | |
Message: | |
<?php
$gb = file($gbfile);
$gb = array_reverse($gb);
foreach ($gb as $guestbook) { echo stripslashes($guestbook); }
break;
case 1:
if($name == „“)
{ echo $errornoname; }
elseif($message == „“)
{ echo $errornomsg; }
elseif($email == „“)
{
if($homepage == „“ || $homepage == „http://“)
{
$writeinfo = $printnoemailpage;
$printer = fopen($gbfile,„a“);
fwrite($printer,$writeinfo);
fclose($printer);
echo $thankstxt;
}
else
{
$writeinfo = $printnoemail;
$printer = fopen($gbfile, ‚a‘);
fwrite($printer,$writeinfo);
fclose($printer);
echo $thankstxt;
}
}
elseif($homepage == „“ || $homepage == „http://“)
{
$writeinfo = $printnopage;
$printer = fopen($gbfile, ‚a‘);
fwrite($printer,$writeinfo);
fclose($printer);
echo $thankstxt;
}
else
{
$writeinfo = $printfull;
$printer = fopen($gbfile, ‚a‘);
fwrite($printer,$writeinfo);
fclose($printer);
echo $thankstxt;
}
break;
case 2:
?>
Username: | |
Password: | |
<?php break; case 3: if($_POST["adminname"] == $username) { if($_POST["adminpass"] == $password) { ?>
<?php $gb = file("$gbfile"); $gb = array_values($gb); foreach ($gb as $guestbook) { echo stripslashes($guestbook); } ?> |
Enter admin password to edit entrys: |
<?php } else { echo "$wrongpass"; } } else { echo "$wrongname"; } break; case 4: if($_POST["psw"] == $password) { $writeinfo = $_POST['gbedit']; $writeinfo = stripslashes($writeinfo); $printer = fopen($gbfile, 'w'); fwrite($printer,$writeinfo); fclose($printer); echo $gbedited; } else { echo "$wrongpass"; } break; } ?> [/code]Ich arbeite an dem Style des scriptes noch, also wundert uch nicht, wenn es mit dem Link anders aussieht als im Quellcode