user_gb.php
<?php
# Copyright by: www.dastiac.de.gg
# Support: www.ilch.de
defined ('main') or die ( 'no direct access' );
$title = $allgAr['title'].' :: User Gästebuch';
$hmenu = 'User Gästebuch';
$design = new design ( $title , $hmenu );
$design->header();
$tpl = new tpl ( 'user/usergb' );
$uid = $menu->get(3);
$ar74 = array(
'UID' => $uid
);
$tpl->set_ar_out($ar74,0);
##VIEW
if($menu->get(2) == "view") {
$abf = "SELECT * FROM `prefix_usergb` WHERE uid = $uid ORDER BY id DESC";
$erg = db_query($abf);
while(@$row = db_fetch_assoc($erg))
{
if($row['page'] == "") {
$homepage = 'Keine Homepage';
} else {
$homepage = '<a href="'.$row['page'].'" target="_blank">Homepage</a>';
}
if($row['mail'] == "") {
$email = 'Keine Email';
} else {
$email = '<a href="mailto:'.$row['mail'].'">Email</a>';
}
if(is_admin() || $uid == $_SESSION['authid']) {
$del = '<a href="?user-usergb-del-'.$uid.'-'.$row['id'].'"><img src="include/images/icons/del.gif"></a>';
} else {
$del = '';
}
$ar2 = array(
'DATE' => $row['date'],
'NICKNAME' => $row['name'],
'TEXT' => $row['txt'],
'HOMEPAGE' => $homepage,
'EMAIL' => $email,
'UID' => $uid,
'DEL' => $del
);
$tpl->set_ar_out($ar2,1);
}
}
##ADD
if($menu->get(2) == "add") {
$class = ( $class == 'Cmite' ? 'Cnorm' : 'Cmite' );
$ar3 = array(
'CLASS' => $class,
'UID' => $uid
);
$tpl->set_ar_out($ar3,2);
}
## INSERT
if($menu->get(2) == "insert") {
$date = date("d.m.Y.", time());
$ip = $_SERVER['REMOTE_ADDR'];
# $txt = escape($_POST['txt'], 'textarea');
# $name = escape($_POST['name'], 'string');
# $mail = escape($_POST['mail'], 'string');
# $page = escape($_POST['page'], 'string');
$ins = db_query("INSERT INTO `prefix_usergb` (name, mail, page, uid, date, ip, txt) VALUES ('".$_POST['nick']."', '".$_POST['email']."', '".$_POST['homepage']."', '".$uid."', '".$date."', '".$ip."', '".$_POST['text']."')");
if($ins == true) {
echo 'Gespeichert! Zum Usergb -> <a href="?user-usergb-view-'.$uid.'">hier</a>';
} else {
echo mysql_error();
}
}
## DELETE
if($menu->get(2) == "del") {
$pid = $menu->get(4);
$delete = "DELETE FROM `prefix_usergb` WHERE id = ".$pid." LIMIT 1";
$erg = db_query($delete);
echo 'Eintrag mit der ID '.$pid.' wurde aus dem User Gästebuch von User mit der ID '.$uid.' gelöscht';
}
$design->footer();
?>
usergb.html
<div align="center"><a href="index.php?user-usergb-add-{UID}">Eintragen!</a></div><br>
{EXPLODE}
<table width="90%" cellpadding="2" cellspacing="2" border="0" class="border">
<tr>
<td width="50%" class="Cmite">{NICKNAME} {DEL}</td>
<td width="50%" class="Cmite">{DATE}</td>
</tr>
<tr class="Cnorm">
<td width="100%" colspan="2">{TEXT}</td>
</tr>
<tr>
<td width="50%" class="Cmite">{HOMEPAGE}</td>
<td width="50%" class="Cmite">{EMAIL}</td>
</tr>
</table>
<br>
{EXPLODE}
<form name="form1" method="post" action="index.php?user-usergb-insert-{UID}">
<table width="90%" cellpadding="2" cellspacing="2" border="0" class="border">
<tr class="Chead">
<td colspan="2">Gaestebuch</td>
</tr>
<tr class="{CLASS}">
<td width="30%">Nickname</td>
<td width="70%"><input type="text" name="nick"></td>
</tr>
<tr class="{CLASS}">
<td width="30%">Homepage</td>
<td width="70%"><input type="text" name="homepage"></td>
</tr>
<tr class="{CLASS}">
<td width="30%">Email</td>
<td width="70%"><input type="text" name="email"></td>
</tr>
<tr class="{CLASS}">
<td width="30%">Text</td>
<td width="70%"><textarea rows="20" cols="40" name="text"></textarea></td>
</tr>
<tr class="Chead">
<td colspan="2"><input type="Submit" value="Absenden"></td>
</tr>
</table>
</form>
<br>
Zuletzt modifiziert von Siggi am 25.12.2014 - 20:49:13



