PHP Classes

guestbook with moderation

Recommend this page to a friend!

      Top level forums  >  PHP Specialists  >  General  >  guestbook with moderation  
Subject:guestbook with moderation
Summary:Adding moderation to guestbook. Admin accepts or deletes posts
Messages:3
Author:Andrzej Wodnicki
Date:2009-08-05 11:06:16
Update:2009-08-07 18:29:32
 

  1. guestbook with moderation   Reply   Report abuse  
Picture of Andrzej Wodnicki Andrzej Wodnicki - 2009-08-06 07:04:28
Hello, I have guestbook code (database connected) and I need to add simple moderation panel, where admin could accept/delete posts. Thanks for any ideas. Code below, same names are in polish lang (imie=name, wpis=post, haslo=password):
There are 2 php files and html form, which I not attach:
insert.php:
<?
$baza='nazwa';
$login='login';
$haslo='xxx';
$host='host';

$imie=addslashes(htmlspecialchars($_POST['imie']));
$wpis=addslashes(htmlspecialchars($_POST['wpis']));

$wpis=strip_tags($wpis);
$imie=strip_tags($imie);

@ $bd = mysql_pconnect($host, $login, $haslo);
if (!$bd)
{
echo 'Po&#322;&#261;czenie z baz&#261; danych nie jest teraz mo&#380;liwe.';
exit;
}
mysql_select_db($baza);

$zapytanie = "insert into `wpisy` values ('".$imie."', '".$wpis."')";
$dd = mysql_query($zapytanie);
if($dd)
{
echo 'Wpis zosta&#322; dodany pomy&#347;lnie';
}
else
{
echo 'Niestety dodanie wpisu nie jest teraz mo&#380;liwe, prosze spróbowa&#263; pó&#378;niej.';
}
/*
echo '<script>';
echo 'var strona="display";';
echo 'self.location.href=strona+".php";';
echo '</script>';
*/
?>
display.php:
<?

$baza='nazwa';
$login='login';
$haslo='xxx';
$host='host';

@ $bd = mysql_pconnect($host, $login, $haslo);
if (!$bd)
{
echo 'Po&#322;&#261;czenie z baz&#261; danych nie jest teraz mo&#380;liwe.';
exit;
}
mysql_select_db($baza);

$zapytanie = 'SELECT * FROM `wpisy` WHERE 1 LIMIT 0, 30';
$dd = mysql_query($zapytanie);
$bb = mysql_fetch_array($dd);
while($bb)
{
$wpis=stripslashes($bb['wpis']);
$imie=stripslashes($bb['imie']);

echo '<br><br>'.$imie.'<br>mówi:<br>'.$wpis;
$bb = mysql_fetch_array($dd);
}
?>

There are 2 replies in this thread, which are not being displayed.
Browsing this forum thread replies is available only to premium subscribers.


Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.