// ######################################################################
// # JGB (Justice Guestbook) - Guestbook Page #
// # -------------------------------------------------------------------#
// # Leave this header in every file !!! #
// # -------------------------------------------------------------------#
// # Copyright © 2001, 2002 by Justice Media #
// # Contact: kontakt@justice-media.de #
// # Homepage: http://www.justice-media.de #
// ######################################################################
// # Justice Media offers no warranties on this script. #
// # The owner/licensee of the script is solely responsible for any #
// # problems caused by installation of the script or use of the #
// # script, including messages that may be posted on the JGB. #
// # #
// # All copyright notices regarding the Justice Guestbook must #
// # remain intact on the scripts and in the Code for the scripts. #
// # For further information read the licence.txt. #
// # #
// # For more info on the Justice Guestbook, #
// # see http://www.justice-media.de #
// ######################################################################
if (file_exists("install.php3")!=0 OR file_exists("update.php3")!=0) {
echo "
Bevor du das Justice Guestbook nutzen kannst, mußt die die install.php3 und die update.php3 löschen ";
echo "ACHTUNG, die Dateien erst löschen, wenn Sie ausgeführt wurden!!!!
";
die;
}
require("globalfuncs.php3");
if(!isset($action)) {
include("htmlheader.php3");
$getents = getentries();
$allentries = $db_sets->num_rows($getents);
$welcometext = getsets("welcome_text");
//Seitennavigation
$limit = getsets("postsperpage");
$next = ($page-1) * $limit;
//show pages of jgb
$allpages = ceil(($allentries/$limit));
$maxpages = getsets("maxpages");
if($page == "" || $page > $allpages || $page==0) {
$page = 1;
}
if($page > 1) {
$prepage = $page - 1;
$showlastpage = "" . getsets("lastpage_text") . " ";
}
if($page < $allpages) {
$nextpage = $page + 1;
$shownextpage = "" . getsets("nextpage_text") . " ";
}
if($allpages > 1) {
$pagenav = make_pagenav($page, $maxpages, $allpages);
$next = ($page-1) * $limit;
}
$getents = getlimitentries($next,$limit);
echo "". nl2br($welcometext) ." ";
echo "
\n";
echo "";
echo "" . getsets("addentrylink_text") . " \n";
echo "\n";
echo "" . getsets("totalentries_text") . " $allentries ". getsets("pages_text") ." $page/$allpages: ";
echo $pagenav;
echo " \n \n";
echo "\n";
echo "" . getsets("name_text") . " \n";
echo "" . getsets("entry_text") . " \n \n";
while($entries = $db_sets->fetch_array($getents)) {
$id = $entries[id];
$name = $entries[name];
$email = $entries[email];
$homepage = $entries[homepage];
$icq = $entries[icq];
$aim = $entries[aim];
$yim = $entries[yim];
$age = $entries[age];
$location = $entries[location];
$text = nl2br($entries[entry]);
$date = $entries[12];
$leerzeichen = " ";
$text = stripslashes($text);
$text = nolongwords($text);
if(getsets("censor") == "1")
$text = censortext($text);
if(getsets("smilies") == "1")
$text = smiletext($text);
echo "\n";
echo "$name \n";
echo "";
echo "" . getsets("location_text") . " $location";
if($age != 0) {
echo "" . getsets("age_text") . " $age";
}
echo "" . getsets("postdate_text") . " $date \n";
echo "\n";
echo "$text ";
echo "\n";
echo "\n";
echo "\n";
if($email != "")
echo " $leerzeichen";
if($homepage != "") {
$homepage = checkurl($homepage);
echo " $leerzeichen";
}
if($icq != "") {
echo "";
if(getsets("icq_graphic") != "") {
echo " ";
} else {
echo " ";
}
echo " $leerzeichen";
}
if($aim != "") {
echo " $leerzeichen";
}
if($yim != "") {
echo " $leerzeichen";
}
echo " ";
echo " \n";
echo " \n";
echo " \n";
echo "
";
echo " \n \n";
}
echo "$showlastpage $shownextpage ";
echo " ";
echo "\n";
echo " \n";
echo " \n";
echo "";
include("cfooter.php3"); //you are not allowed to delete this include
echo " ";
echo "
\n";
include("htmlfooter.php3");
}
//show addentry
if($action == "addentry") {
if($check == "true") {
if($name == "") {
$signcolor["name"] = "";
}
if($text == "") {
$signcolor["text"] = "";
}
if(getsets("allowemail") && getsets("requireemail") && !is_email($email)) {
$signcolor["email"] = "";
}
if(getsets("allowhomepage") && getsets("requirehomepage") && $homepage == "") {
$signcolor["homepage"] = "";
}
if(getsets("allowicq") && getsets("requireicq") && $icq == "") {
$signcolor["icq"] = "";
} else if (getsets("allowicq") && $icq && !is_numeric($icq) ) {
$signcolor["icq"] = "";
}
if(getsets("allowaim") && getsets("requireaim") && $aim == "") {
$signcolor["aim"] = "";
}
if(getsets("allowyim") && getsets("requireyim") && $yim == "") {
$signcolor["yim"] = "";
}
if(getsets("allowage") && getsets("requireage") && $age == "") {
$signcolor["age"] = "";
} else if (getsets("allowage") && $age && (!is_numeric($age) || strlen($age) > 2) ) {
$signcolor["age"] = "";
}
if(getsets("allowlocation") && getsets("requirelocation") && $location == "") {
$signcolor["location"] = "";
}
if(count($signcolor) == 0) {
$ip = $REMOTE_ADDR;
$host = $REMOTE_HOST;
$date = date("y-m-d H:i:s");
$checkspam = checkspam($spamid);
if(getsets("moderate") == 1) {
$activekey = 1;
} else {
$activekey = 0;
}
if($checkspam == "no") {
$entryinsert_rs = $db_sets->query("INSERT INTO $table_entries (name,email,homepage,icq,aim,yim,age,location,entry,ipaddress,hostname,entrydate,active,spamid) VALUES ('$name','$email','$homepage','$icq','$aim','$yim','$age','$location','$text','$ip','$hostname','$date','$activekey','$spamid')");
if(getsets("emailtomaster") == 1) {
emailtomaster($name,$email,$homepage,$location,$text,$ip,$hostname,$date);
}
if(getsets("emailtouser") == 1) {
emailtouser($name,$email,$homepage,$location,$text,$ip,$hostname,$date);
}
}
header ("location: jgb.php3?action=thankyou");
} else {
$message = " " . getsets("notfilled_text") . "
";
}
} //end check
include("htmlheader.php3");
?>
$spamid = md5(uniqid(rand()));
$welcometext = getsets("entrytop_text");
$smilecode = showsmilies();
echo "". nl2br($welcometext) ." ";
echo $message;
echo "
";
include("cfooter.php3"); //you are not allowed to delete this include
include("htmlfooter.php3");
}
//edit or delete entry from guestbook
if($action == "edit") {
include("htmlheader.php3");
$getentry_rs = getoneentry($id);
$getentry = $db_sets->fetch_array($getentry_rs);
$text = $getentry[entry];
echo "
";
echo " ";
echo " ";
echo "\n";
include("htmlfooter.php3");
}
if($action == "showip") {
include("htmlheader.php3");
echo " ";
echo " ";
echo " ";
echo "\n";
include("htmlfooter.php3");
}
if($action == "editentry") {
if($username == $adminusername && $password == $adminuserpass) {
if(isset($delete))
$entryedit_rs = $db_sets->query("DELETE FROM $table_entries WHERE id='$id'");
else
$entryedit_rs = $db_sets->query("UPDATE $table_entries SET entry = '$text' WHERE id = '$id'");
}
header("location: jgb.php3");
}
?>