------------------>
[b]De tabel:[/b]
<------------------>
CREATE TABLE `gastenboek` (
`id` INT( 8 ) NOT NULL AUTO_INCREMENT ,
`van` VARCHAR( 255 ) NOT NULL ,
`datum` VARCHAR( 50 ) NOT NULL ,
`email` VARCHAR( 255 ) NOT NULL ,
`website` VARCHAR( 255 ) NOT NULL ,
`bericht` VARCHAR( 255 ) NOT NULL ,
`ip` VARCHAR( 15 ) NOT NULL ,
UNIQUE ( `id` )
) TYPE = MYISAM ;
<------------------>
[b]Index.php[/b]
<------------------>
include"config.php";
$haalaantal = mysql_num_rows(mysql_query("SELECT * FROM gastenboek"));
$ip = $_SERVER['REMOTE_ADDR'];
$error = "";
if(isset($_GET['post'])and($_GET['post']=="1")){
if(empty($_POST['naam'])){
$error .= "
Geen naam ingevuld ";}
if(empty($_POST['naam'])){
$error .= "Geen bericht ingevuld ";}
if(!empty($_POST['naam'])and(!empty($_POST['bericht']))){
$insert = "INSERT INTO gastenboek (van, datum, email, website, bericht, ip) VALUES ('".$_POST['naam']."', '".$_POST['datum']."', '".$_POST['email']."', '".$_POST['website']."', '".$_POST['bericht']."', '".$ip."')";
if(mysql_query($insert)){
$error = "Alles is correct ingevuld ";
}
}
}
?>
Gastenboek
Admin
<---------------------->
[b]Config.php[/b]
<---------------------->
<------------------->
[b]Style.css[/b]
<------------------->
/* CSS Document */
BODY
{
background-color:#0099FF;
}
TABLE
{
border-color:#FF9900;
border-style:double;
background-color:#EEEEFF;
}
.header
{
color:#FF9900;
font-size:18px;
font-weight:bold;
}
.nonheader
{
color:#000000;
font-size:18px;
}
A
{color:#FF9900;
text-decoration:none;
background-color:#EEEEFF;
font-weight:bold;
}
A:hover
{
text-decoration:underline;
}
INPUT
{
background-color:#FF9900;
border:1;
font-style:italic;
}
.submit
{
background-color:#FF9900;
border-width:medium;
border-color:#000000;
font-style:normal;
font-weight:bold;
}
.textarea
{
background-color:#FF9900;
text-align:left;
border:0;
elevation:below;
}
<--------------->
[b]Admin.php[/b]
<--------------->
Gastenboek Admin
exit();
}
else{
?>
exit();
}
}
// de admin controleren
if(isset($_GET['controleer'])and($_GET['controleer']=="ja")){
if((isset($_POST['adminnaam']))and(isset($_POST['password']))){
if(($_POST['adminnaam']!=$adminnaam)or($_POST['password']!=$adminwachtwoord)){
?>
exit();
}
if(($_POST['adminnaam']==$adminnaam)and($_POST['password']==$adminwachtwoord)){
setcookie("admingastenboek",$adminnaam,"0","/");
header("refresh:1");
}
}
if(isset($_COOKIE['admingastenboek'])){
$aantal = mysql_num_rows(mysql_query("SELECT * FROM gastenboek"));
if($aantal>0){
$select = mysql_query("SELECT id, van, datum, email, website, bericht, ip FROM gastenboek ORDER by id DESC");
?>
while($f=mysql_fetch_object($select)){?>
exit();
}
}
if(isset($_COOKIE['admingastenboek'])){
header("location:admin.php?controleer=ja");
}
?>