Verfasst: Mi 7. Jul 2004, 07:06
Edit: im richtigen Threat gepostet
Das Diskussionsforum zum Open Source Content Management System
https://forum.contenido.org/
Code: Alles auswählen
<?php
include('../contenido/includes/config.php');
include($cfg['path']['includes'].'cfg_sql.inc.php');
$db = new DB_Contenido;
//Gucken, ob Session activ ist, also User authentifiziert
$sql = "SELECT * FROM con_phplib_active_sessions WHERE sid='".$sess."'";
$db->query($sql);
echo "<html><head><title>Eintrag gelöscht</title><link rel=\"stylesheet\" type=\"text/css\" href=\"css/format.css\"></head>\n";
echo "<body onLoad=\"javascript:setTimeout('window.close()', 1500);\" onUnload=\"javascript:window.opener.location.reload(true);\">";
echo "<table width=\"100%\" height=\"100%\"><tr><td valign=\"middle\" class=\"subheadline\">";
$gb_table = $cfg['tab']['guestbook'];
if ($db->next_record() <> "" )
{
$delete_sql = "DELETE FROM `".$gb_table."` WHERE `id`='".$id."';";
if($db->query($delete_sql))
echo "Eintrag Nummer ".$id." wurde erfolgreich gelöscht";
else
echo $delete_sql;
}
echo "</td></tr></table></body></html>";
?>
Code: Alles auswählen
<br><p><B>Einträge mit ICONS haben Links auf E-Mail und URL</B></p>
<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname : Guestbook Ausgabe v1.1
* Copyright : P.beauvain
* Created : 14-02-2004
* Modified : Mar. 1st 2004 by Lars D. Forseth <lars@forseth.de>
************************************************/
$accessGranted = false;
$permissions = $auth->auth["perm"];
$permissions = explode(',', $permissions);
foreach ($permissions as $perm)
if ($perm == "sysadmin" || $perm == "admin[".$client."]")
$accessGranted = true;
switch ($eintrag) { // das erste mal beim aufruf ist $eintrag undefiniert
case "";
$eintrag = "0"; // deswegen wertzuweisung 0
}
$zps = "CMS_VALUE[4]"; // anzeige der einträge pro Seite
$max = ($eintrag + $zps);
$meineseite=$auth->url();
if (!$accessGranted) { $where = " WHERE active=1 AND client=$client"; }
else { $where = " WHERE client=$client"; }
if($accessGranted) {
$sql = "UPDATE ".$cfgTab_guestbook." SET active=".$active." WHERE id='".$gbid."' LIMIT 1";
$db->query($sql);
}
$abba = "view";
// wenn view als aktion übergeben wird bzw. beim erstmaligen Seitenaufruf
if($abba == "view")
{
//Zählen der Datensätze
$sql = "SELECT count(*) AS total FROM ".$cfgTab_guestbook.$where;
$db->query($sql);
$db->next_record();
$eintraege = $db->f("total");
echo "<br>";
echo "<table>";
//Unternavigation zusammenbauen
$gbnav = "";
$gbnav .= "<table width=520px cellspacing=0 cellpadding=0><tr>";
if ($max >= $eintraege)
$gbnav .= "<td class=textbold><p> Einträge: ".($eintrag+1)."-".($eintraege)." von ".$eintraege."</p></td>";
else
$gbnav .= "<td class=textbold><p> Einträge: ".($eintrag+1)."-".($max)." von ".$eintraege."</p></td>";
$gbnav .= "<td class=textbold align=right><p>";
$pages = $eintraege / $zps;
if ($pages > 1) {
$gbnav .= "gehe zu Seite ";
for ($ii = 0; $ii < $pages; $ii++) {
if ($ii != ($eintrag / $zps)) {
$gbnav .= "<a href=\"$meineseite&a=view&eintrag=";
$gbnav .= ($ii * $zps);
$gbnav .= "\">[".($ii+1)."]</a> ";
}
}
}
$gbnav .= "</p></td>";
//Ausgabe Navigation
// echo $gbnav;
// Daten aus der Datenbank abfragen mit der Einschränkung $eintrag (d.h. welche ausgegeben werden sollen) und $zps (anzahl der anzuzeigenden elemente)
$sql = "SELECT name, email, url, date, location, comments, id, active FROM $cfgTab_guestbook $where order by date desc LIMIT $eintrag,$zps";
$db->query($sql);
// Auslesen des Ergebnisse pro Reihe und Generierung der Seite
while ($db->next_record()) {
echo "<p><table width=80% border=0 cellpadding=0 cellspacing=0>";
echo "<tr><td colspan=2><hr style=\"height: 1px; color: #000000\"/></td></tr>";
echo "<td class=gb_eintrag><span ID=fontCMS_VALUE[1]>".$db->f("name")."</span><br><span ID=fontCMS_VALUE[2]>".$db->f("date")."</span></td>";
echo "<td align=right valign=top>";
if($accessGranted) {
if ($db->f("active") == 0)
{
$imgsrc = $cfgPathContenido.$cfgPathImg."deactivate.gif";
echo "<a href=$meineseite&active=".(($db->f("active")*-1)+1)."&gbid=".$db->f("id")."&eintrag=".$eintrag."><img src=".$cfgPathContenido.$cfgPathImg."activ.gif border=0 alt=\"Eintrag ist deaktiviert, klicken um Eintrag freizugeben\"></a> ";
echo "<a href=\"#\" onClick=\"window.open('".$cfgClient['path']['frontendpath']."gb_delete_inactive.php?sess=".$sess->id."&id=".$db->f("id")."', 'NewWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=n0,width=150,height=150')\"><img src=$imgsrc border=0 alt=\"Eintrag löschen\"></a>";
}
if ($db->f("active") == 1)
{
$imgsrc = $cfgPathContenido.$cfgPathImg."activ.gif";
echo "<a href=$meineseite&active=".(($db->f("active")*-1)+1)."&gbid=".$db->f("id")."&eintrag=".$eintrag."><img src=$imgsrc border=0 alt=\"Eintrag ist freigegeben, klicken zum deaktivieren\"></a>";
}
}
if ($db->f("url") != "") { echo "<a href=\"http://".$db->f("url")."\" target=_blank><img src=".$cfgClient[1]["frontendpath"]["img"]."CMS_VALUE[5] border=0 hspace=5></a>"; }
if ($db->f("email") != "") { echo "<a href=\"mailto:".$db->f("email")."\"><img src=".$cfgClient[1]["frontendpath"]["img"]."CMS_VALUE[6] border=0></a></td>"; }
echo "</tr>";
echo "<tr><td class=text ID=fontCMS_VALUE[3] colspan=3 valign=top><p>".$db->f("comments")."</p></td></tr>";
//Eintrag aktivieren/deaktivieren
{
if ($abba == "view") //{ $imgsrc = $cfgPathContenido.$cfgPathImg."line_top.gif"; }
# echo "<tr><td colspan=2><a href=\"#top\"><img src=$imgsrc border=0></a></td></tr>";
echo "<tr><td colspan=2><hr style=\"height: 1px; color: #000000\"/></td></tr>";
}
echo "</table></p><br>";
}
//Ausgabe Navigation
echo $gbnav;
}
?>