PreviewFeatures:
[/li][li] Pagination
[/li][li] Easily Customizable Design
[/li][li] Easily Customizable Error Messages
[/li][li] Preview Comment
[/li][li] UBBC code
[/li][li] Flat File
[/li][li] Oldest to Newest Organization
Open Source, Free to be used anywhere
Suggestions or comments?
<?php
// Abyss Comment System by CDDude229
// This code may not be redistributed without permission.
// This code is open source.
// Design variables
$bordercolor = "#000000"; // Border color.
$window1 = "#FFFFFF"; // Username and links cell background color
$window2 = "#EEEEEE"; // Comment cell background color
$window3 = "#DDDDDD"; // Copyright cell background color
$background = "#BBBBBB"; // Page Background Color
// Edit these variables to what you want errors to say
$namecheck = "Please supply a name."; // What it will say if you didn't supply a name.
$commentscheck = "You did not leave a comment."; // What it will say if no comment is left.
$formagain = "Please fill out the form and try again."; // What it will say if the form was not completely fileld out.
// These are file names that you can edit.
$commentsfile = "comments2.php"; // This is the name of the file where this will be used.
$commentsstorefile = "comments2.txt"; // This is the name of the file where comments will be stored.
// No need to edit below here.
// register_global fail safe
$name = $_POST['name'];
$website = $_POST['website'];
$email = $_POST['email'];
$website1 = $_POST['website'];
$email1 = $_POST['email'];
$comments = $_POST['comments'];
$comments1 = $_POST['comments'];
$submit = $_POST['submit'];
$preview = $_POST['preview'];
// Trim white space, remove HTML tags, and remove unintended "slashes"
if( !empty($name) && !empty($comments)){
$name = stripslashes ($name);
$name = str_replace("<","<",$name);
$name = str_replace(">",">",$name);
$name = trim ($name);
$comments = stripslashes ($comments);
$comments = str_replace("<","<",$comments);
$comments = str_replace(">",">",$comments);
$email = stripslashes ($email);
$email = str_replace("<","<",$email);
$email = str_replace(">",">",$email);
$email = trim ($email);
$website = stripslashes ($website);
$website = str_replace("<","<",$website);
$website = str_replace(">",">",$website);
$website = trim ($website);
}
// Censoring
$comments = str_replace ('asshole', 'a**h*l*', $comments);
$comments = str_replace ('bitch', 'b*tch', $comments);
$comments = str_replace ('fuck', 'f*ck', $comments);
$comments = str_replace ('shit', 'sh*t', $comments);
$comments = str_replace ('bastard', 'b*st*rd', $comments);
// UBBC
$comments = str_replace ('
', '<b
r>', $comments);
$comments = str_replace ('[
b]', '<b>', $comments);
$comments = str_replace ('[/
b]', '</b>', $comments);
$comments = str_replace ('[i
]', '<i>', $comments);
$comments = str_replace ('[/
i]', '</i>', $comments);
$comments = str_replace ('[u
]', '<u>', $comments);
$comments = str_replace ('[/u
]', '</u>', $comments);
$comments = str_replace ('[
s]', '<s>', $comments);
$comments = str_replace ('[/
s]', '</s>', $comments);
$comments = str_replace ('[em
ail]', '<a href="mailto:', $comments);
$comments = str_replace ('[/e
mail]', '">e-mail</a>', $comments);
$comments = str_replace ('[u
rl]', '<a href="', $comments);
$comments = str_replace ('[/u
rl]', '" target="_top">link</a>', $comments);
$comments = str_replace ('[ce
nter]', '<center>', $comments);
$comments = str_replace ('[/ce
nter]', '</center>', $comments);
$comments = str_replace ('[m
]', '<marquee>', $comments);
$comments = str_replace ('[/
m]', '</marquee>', $comments);
$comments = str_replace ('[righ
t]', '<p align=right>', $comments);
$comments = str_replace ('[/ri
ght]', '</p>', $comments);
$comments = trim ($comments);
// Submit form check
if(isset($submit)){
// Define time
$time = date("l dS of F h:i:s A T");
// Website if empty
if( empty($website)){
$website = "";
} else {
$website = "| <a href='$website' target='_top'>Website</a>";
}
// Email if empty
if(!empty($email)){
$email = "| <a href='mailto:$email'>E-mail</a>";
} else {
$email = "";
}
// Data for table
$data = "<tr><td class='window1' width='50%'>$name $website $email</td><td align='right' class='window1' width='50%'>$time</td></tr><tr><td class='window2' colspan='2'>$comments<b
r><b
r></td></tr>";
$data = trim ($data);
// Name check
if(!$name){
print "<p>$namecheck</p>";
}
// Comment Check
if(!$comments){
print "<p>$commentscheck</p>";
}
// Send Information
if(!empty ($comments) && !empty ($name)){
$fp = fopen ($commentsstorefile, 'a+');
fwrite ($fp, "$data\r\n");
fclose ($fp);
} else {
print "<p>$formagain</p>";
}
}
?>
<?
if( isset($preview)){
print "<table width='600' cellpadding='2' cellspacing='1' class='border'><tr><td class='window1' align='center'>Preview</td></tr><tr><td class='window2'>$comments</td></tr></table><b
r>";
}
?>
<!-- CSS -->
<style>
body { background-color: <? print "$background"; ?>; }
.border { background-color: <? print "$bordercolor"; ?>; }
.window1 { background-color: <? print "$window1"; ?>; }
.window2 { background-color: <? print "$window2"; ?>; }
.window3 { background-color: <? print "$window3"; ?>; }
</style>
<!-- PHP Form -->
<?php
print "<form action=\"$commentsfile\" method=\"post\">";
?>
<table border="0" width="600" cellpadding="2" cellspacing="1" class="border"><tr><td class="window1">
Name: <b
r>
Website: <b
r>
E-mail:
</td><td class="window1">
<input type="text" name="name" size="20" maxlength="15" value="<? print "$name";?>"><b
r>
<input type="text" name="website" size="20" maxlength="30" value="<? print "$website1"; ?>"><b
r>
<input type="text" name="email" size="20" maxlength="30" value="<? print "$email1"; ?>">
</td></tr><tr><td valign="top" class="window2">
Comments:
</td><td class="window2">
<textarea name="comments" rows="10" cols="30"><? print "$comments1"; ?></textarea>
</td></tr><tr><td colspan="2" align="center" class="window3">
<input type="submit" name="submit" value="Submit Comment" accesskey="s"> <input type="submit" name="preview" value="Preview Comment" accesskey="p"><b
r>
<a href="javascript:void(0);" onclick="window.open('help.php', 'popupWin', 'toolbar=0, location=0, status=0, menubar=0, scrollbars=0, resizable=0, width=500, height=500, left=20, top=2-')">Help</a>
</td></tr></table><b
r><b
r><b
r><b
r>
</form>
<table cellpadding="2" cellspacing="1" class="border" width="600" border="0">
<?php
// Pagination
$data = file ($commentsstorefile);
$n = count ($data);
$lp = $n/15;
if($lp<=1){
} else{
print "<tr><td class='window2' colspan='2'>Pages: ";
for($d=0;$d<=$lp;$d++){
$y=$d*15;
print " <a href='?start=$y'>$d</a>";
}
print "</td></tr>";}
// Load previous comments
$ty = $_GET['start'];
for($x = 0;$x<15;$x++){
$dat = $ty+$x;
print $data[$dat];
}
?>
</table><b
r>
<table cellpadding="2" cellspacing="1" class="border" width="600" border="0"><tr><td class="window3" align="center">
<b>Abyss Comment System v1.0.0 copyright CDDude229 2005-2006.</b>
</td></tr></table>
This is help.php
<html>
<body>
<table border="1" cellpadding="2" cellspacing="0"><tr><td align="center">
<b><u>Supported UBBC</u></b>
</td></tr><tr><td valign="top">
[b
]text[/
b] - <b>Bold</b><b
r>
[
u]text[/
u] - <u>Underline</u><b
r>
[
i]text[/
i] - <i>Italics</i><b
r>
[
s]text[/
s] - <s>Strikethrough</s><b
r>
[
m]text[/
m] - Moving Text<b
r>
[c
enter]text[/ce
nter] - Centered Text<b
r>
[rig
ht]text[/ri
ght] - Right Aligned Text<b
r>
[
url]link[/
url] - Link<b
r>
[e
mail]email[/e
mail] - E-mail
</td></tr></table><b
r><b
r>
<b>Q</b>: Why doesn't HTML or JavaScript work?<b
r>
<b>A</b>: It is disabled so that users can not post harmful HMTL and JavaScript codes. You can use the safe UBBC alternate coding.<b
r><b
r>
<b>Q</b>: I want to indent a line. How would I do this?<b
r>
<b>A</b>: Use "&nb<b></b>sp;" four times. That is the equal to a "tab" indent.
</body>
</html>
Last Edit: May 5, 2005 19:35:48 GMT -8 by CD