Gästebuch für 4.4
Verfasst: Sa 1. Nov 2003, 06:28
Hallo, kann mir jemand sagen, wo ich ein Gästebuchmodul für 4.4 finden kann?
Danke schon mal im Vorraus!!!!!
Halma
Danke schon mal im Vorraus!!!!!
Halma
Das Diskussionsforum zum Open Source Content Management System
https://forum.contenido.org/
Code: Alles auswählen
CREATE TABLE `con_guestbook` (
`id` int(8) NOT NULL auto_increment,
`name` varchar(40) NOT NULL default '',
`email` varchar(40) NOT NULL default '',
`location` varchar(40) NOT NULL default '',
`comments` text NOT NULL,
`url` varchar(50) NOT NULL default '',
`active` int(1) NOT NULL default '0',
`CLIENT` int(1) NOT NULL default '1',
`date` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) TYPE=MyISAM;
Input GB_Ausgabe:
echo "<input type=\"hidden\" name=\"CMS_VAR[0]\" value=\"".$value."\">";
echo "<table align=\"left\" cellpadding=\"0\" cellspacing=\"0\">";
echo "<tr valign=\"top\"><td width=\"202\">Name:</td>";
echo "<td><select name=\"CMS_VAR[1]\" size=\"1\">";
if ("CMS_VALUE[1]" != 0) {
echo "<option value=\"0\">".$lngForm["nothing"]."</option>";
} else {
echo "<option value=\"0\" selected>".$lngForm["nothing"]."</option>";
}
for ($i=1; $i<=50; $i++) {
if ($i != "CMS_VALUE[1]") {
echo "<option value=\"$i\">Font $i</option>";
} else {
echo "<option value=\"$i\" selected>Font $i</option>";
}
}
echo "</SELECT></td></tr>";
echo "<tr valign=\"top\"><td width=\"202\">Datum/Uhrzeit:</td>";
echo "<td><select name=\"CMS_VAR[2]\" size=\"1\">";
if ("CMS_VALUE[2]" != 0) {
echo "<option value=\"0\">".$lngForm["nothing"]."</option>";
} else {
echo "<option value=\"0\" selected>".$lngForm["nothing"]."</option>";
}
for ($i=1; $i<=50; $i++) {
if ($i != "CMS_VALUE[2]") {
echo "<option value=\"$i\">Font $i</option>";
} else {
echo "<option value=\"$i\" selected>Font $i</option>";
}
}
echo "</SELECT></td></tr>";
echo "<tr valign=\"top\"><td width=\"202\">Text:</td>";
echo "<td><select name=\"CMS_VAR[3]\" size=\"1\">";
if ("CMS_VALUE[2]" != 0) {
echo "<option value=\"0\">".$lngForm["nothing"]."</option>";
} else {
echo "<option value=\"0\" selected>".$lngForm["nothing"]."</option>";
}
for ($i=1; $i<=50; $i++) {
if ($i != "CMS_VALUE[3]") {
echo "<option value=\"$i\">Font $i</option>";
} else {
echo "<option value=\"$i\" selected>Font $i</option>";
}
}
echo "</SELECT></td></tr>";
echo "
<tr>
<td>Anzahl Einträge/Seite</td>
<td><input type=\"text\" name=\"CMS_VAR[4]\" value=\"CMS_VALUE[4]\"></td>
</tr>
";
$query = "SELECT * FROM $cfgTab_upl WHERE idclient=$client AND filetype='img'";
$db->query($query);
while ($db->next_record()) {
$filename[$db->f("idupl")] = $db->f("filename");
} // end while
echo "<tr>\n";
echo "<td>Mail-Image</td>\n";
echo "<td><select name=\"CMS_VAR[5]\">\n";
if (is_array($filename)) {
foreach ($filename as $key => $value) {
if ("CMS_VALUE[5]" == $value) {
echo "<option selected=\"selected\" value=\"". $value ."\">". $value ."</option>";
} else {
echo "<option value=\"". $value ."\">". $value ."</option>";
} // end if
} // end foreach
} // end if
echo "</select></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>WWW-Image</td>\n";
echo "<td><select name=\"CMS_VAR[6]\">\n";
if (is_array($filename)) {
foreach ($filename as $key => $value) {
if ("CMS_VALUE[6]" == $value) {
echo "<option selected=\"selected\" value=\"". $cfgClient[1]["frontendpath"]["img"].$value ."\">". $value ."</option>";
} else {
echo "<option value=\"". $value ."\">". $value ."</option>";
} // end if
} // end foreach
} // end if
echo "</select></td>\n";
echo "</tr>\n";
echo "</table>";
Output GB_Ausgabe:
<?php
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
$meineseite=$auth->url();
if (!$perm->have_perm("admin")) { $where = " WHERE active=1 AND client=$client"; }
else { $where = " WHERE client=$client"; }
//wenn "active" als aktion übergeben wird und wir noch im edit-modus sind
if ($gbid && $active > -1 && $perm->have_perm("admin")) {
$sql = "UPDATE con_guestbook SET active=".$active." WHERE id='".$gbid."' LIMIT 1";
$db->query($sql);
}
$a = "view";
// wenn view als aktion übergeben wird bzw. beim erstmaligen Seitenaufruf
if($a == "view")
{
//Zählen der Datensätze
$sql = "SELECT count(*) AS total FROM con_guestbook ".$where."";
$db->query($sql);
$db->next_record();
$eintraege = $db->f("total");
//Unternavigation zusammenbauen
$gbnav = "";
$gbnav .= "<table width=100% cellspacing=0 cellpadding=0><tr>";
$gbnav .= "<td><p>Einträge: ".($eintrag+1)."-".($eintrag+$db->f("total"))." von ".$eintraege."</p></td>";
$gbnav .= "<td align=right><p>";
$pages = $eintraege / $zps;
if ($pages > 1) {
$gbnav .= "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 con_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=100% border=0 cellpadding=0 cellspacing=0>";
echo "<tr>";
echo "<td><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 ($db->f("email") != "") { echo "<a href=\"mailto:".$db->f("email")."\"><img src=\"images/email.gif\" border=0 hspace=5></a>"; }
if ($db->f("url") != "") { echo "<a href=\"http://".$db->f("url")."\" target=_blank><img src=\"images/home.gif\" border=0></a></td>"; }
echo "</tr>";
echo "<tr><td ID=fontCMS_VALUE[3] colspan=3 valign=top><p>".stripslashes($db->f("comments"))."</p></td></tr>";
//Eintrag aktivieren/deaktivieren
if($perm->have_perm("admin")) {
if ($db->f("active") == 0) { $imgsrc = $cfgPathContenido.$cfgPathImg."but_online_no.gif"; }
if ($db->f("active") == 1) { $imgsrc = $cfgPathContenido.$cfgPathImg."but_online.gif"; }
echo "<tr><td colspan=2><a href=$meineseite&active=".(($db->f("active")*-1)+1)."&gbid=".$db->f("id")."&eintrag=".$eintrag."><img src=$imgsrc border=0></a></td></tr>";
}
echo "</table></p><hr>";
}
//Ausgabe Navigation
echo $gbnav;
echo "</td></tr></table>";
}
?>
Input GB_Insert:
echo "<input type=\"hidden\" name=\"CMS_VAR[0]\" value=\"".$value."\">";
echo "<table align=\"left\" cellpadding=\"0\" cellspacing=\"0\">";
echo "<tr valign=\"top\"><td width=\"202\">Überschrift:</td>";
echo "<td><select name=\"CMS_VAR[1]\" size=\"1\">";
if ("CMS_VALUE[1]" != 0) {
echo "<option value=\"0\">".$lngForm["nothing"]."</option>";
} else {
echo "<option value=\"0\" selected>".$lngForm["nothing"]."</option>";
}
for ($i=1; $i<=50; $i++) {
if ($i != "CMS_VALUE[1]") {
echo "<option value=\"$i\">Font $i</option>";
} else {
echo "<option value=\"$i\" selected>Font $i</option>";
}
}
echo "</SELECT></td></tr>";
echo "<tr valign=\"top\"><td width=\"202\">Text:</td>";
echo "<td><select name=\"CMS_VAR[2]\" size=\"1\">";
if ("CMS_VALUE[2]" != 0) {
echo "<option value=\"0\">".$lngForm["nothing"]."</option>";
} else {
echo "<option value=\"0\" selected>".$lngForm["nothing"]."</option>";
}
for ($i=1; $i<=50; $i++) {
if ($i != "CMS_VALUE[2]") {
echo "<option value=\"$i\">Font $i</option>";
} else {
echo "<option value=\"$i\" selected>Font $i</option>";
}
}
echo "</SELECT></td></tr>";
echo "<tr valign=\"top\"><td width=\"202\">Emailbenachrichtigung: ";
echo "Ja <INPUT TYPE=\"checkbox\" NAME=\"CMS_VAR[3]\" VALUE=\"1\" ";
if("CMS_VALUE[3]" == 1){echo "checked=checked"; };
echo "> An:</td><td>";
echo "<INPUT TYPE=\"text\" NAME=\"CMS_VAR[4]\" VALUE=\"";
if("CMS_VALUE[4]"){ echo "CMS_VALUE[4]"; } else { echo $cfgNewsletter["from"]; };
echo "\"></td></tr>";
if("CMS_VALUE[5]" == 1) { $checked = "checked=checked"; }
else { $checked = "0"; }
echo "<tr>
<td>Sofort anzeigen:</td>
<td><input type=\"checkbox\" name=\"CMS_VAR[5]\" value=\"1\" ".$checked."></td>
</tr>
";
echo "</table>";
Output GB_Insert:
<?php
$meineseite=$auth->url();
include($cfg['path']['contenido']."includes/cfg_language_de.inc.php");
if ($a == "") { $a = "add"; }
if ($a == "add") {
echo "<p><font face=\"arial, verdana, helvetica\" size=\"1\">Bitte füllen Sie mind. die mit * bezeichneten Felder aus.</font></p>";
echo "<FORM name='gb' id='gb' action=".$auth->url()." method='post' enctype='application/x-www-form-urlencoded'>";
echo "<INPUT TYPE=hidden NAME=a VALUE=send>";
echo "<input type=hidden name=required value=name,comments,email>";
echo "<table border=0 cellpadding=0 cellspacing=5 width=100% >
<tr><td ID=fontCMS_VALUE[1] width=10%><B>Name*:</b></td><td><INPUT ID=inputfeldguestbook TYPE=text NAME=name></td></tr>
<tr><td ID=fontCMS_VALUE[1] width=10%>E-Mail*:</td><td><INPUT ID=inputfeldguestbook TYPE=text NAME=email></td></tr>
<tr><td ID=fontCMS_VALUE[1] width=10%>Homepage:</td><td><INPUT ID=inputfeldguestbook TYPE=text NAME=url></td></tr>
<tr valign=top><td ID=fontCMS_VALUE[1] width=10%><b>Kommentar*:</b></td><td colspan='2'><TEXT"."AREA ID=textfeldguestbook NAME=comments ROWS=6></TEXT"."AREA></td></tr>
<tr><td ID=fontCMS_VALUE[1] width=10%><br><a href=# onClick=gb.submit();>Eintragen</a></td></tr>
</table>";
}
// wenn ein eintrag geschrieben werden soll
if($a == "send") {
include($cfg['path']['contenido']."includes/cfg_language_de.inc.php");
// Formatierung des Textes aus dem Kommentarfeld
if($name!=""&&$comments!="") {//Abfangen der "leeren" Einträge
if (!eregi( "^" ."[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@" . "([a-z0-9]+([\.-][a-z0-9]+)*)+" . "\\.[a-z]{2,}" ."$", $email)) {
$modnews_errormsg = "1002"; echo "<b>".$lngErr[$modnews_errormsg]."</b><br><br><a href=\"javascript:history.back()\">zurück</a>"; } else {
$mailkomm = stripslashes($comments);
$comments = nl2br("$comments");
$comments = addslashes("$comments");
$url = Str_replace("http://","",$url);
$sql = "INSERT into con_guestbook (name, email, url, date, comments, active, client) VALUES ('$name', '$email', '$url', NOW(), '$comments', CMS_VALUE[5], $client)";
$db->query($sql);
if("CMS_VALUE[3]" == 1 && "CMS_VALUE[4]" != "") {
$mailbody = "Von: $name ( $email )\nHomepage: $url\n\nKommentar:\n$mailkomm\n\n http://".getenv("HTTP_HOST")."$meineseite";
mail("CMS_VALUE[4]", "neuer Gaestebuch-Eintrag", $mailbody, "From: Gaestebuch<CMS_VALUE[4]>\nX-Mailer: PHP/" . phpversion(). "\n");
};
echo "<p class=$ClassIDHead>Danke! Ihr Beitrag wurde eingetragen</p>";
}}
else
{
echo "<p><b>Bitte füllen Sie die mit * gekennzeichneten Felder aus!</b><br><a href=\"javascript:history.back()\">zurück</a></p>";
}
}
?>
Dann betanke mal dain Gästebuch mit so ca. 20 Testeinträgen, gib eine beliebige Anzahl für die Ausgabe pro Seite an und dann schau dir mal an was bei den Einträgen pro Seite rauskommt. so ein paar Änderungen in den SQL Statements bewirken manchmal Wunderttb hat geschrieben:ähm, der qt ist derselbe, bis auf kleine veränderungen in den sql-statements und die css-anweisungen bei den formularfeldern...
Code: Alles auswählen
$sql = "UPDATE con_guestbook SET active=".$active." WHERE id='".$gbid."' LIMIT 1";