Re: [PHP]SimpleBB - The New Bulletin Board! (And the new poseidonBB :D)
Quote:
Originally Posted by
Monsta.
Thank you for your supportive comment.
I'll be sure to take a look at those styles.
Re: [PHP]SimpleBB - The New Bulletin Board! (And the new poseidonBB :D)
Quote:
Originally Posted by
lceCold
You do realize that I have access to his accounts, right?
I'm not even going to bother.
Re: [PHP]SimpleBB - The New Bulletin Board! (And the new poseidonBB :D)
If you want people to see your project host it on something reliable, or don't post it at all, as it defeats the purpose of having a thread in the first place.
Re: [PHP]SimpleBB - The New Bulletin Board! (And the new poseidonBB :D)
Just to tell you guys, I left this project. O_O
Wayne is in charge (and the only one left) now.
Re: [PHP]SimpleBB - The New Bulletin Board! (And the new poseidonBB :D)
Demo link updated; moved demo to the server.
Re: [PHP]SimpleBB - The New Bulletin Board! (And the new poseidonBB :D)
It still has an ugly style ( tutorial much ), divs aren't aligned.
Re: [PHP]SimpleBB - The New Bulletin Board! (And the new poseidonBB :D)
Wayne says that the style is good enough lol.
BUt I agree.
Try making it cooler, like SMF's. :D
Re: [PHP]SimpleBB - The New Bulletin Board! (And the new poseidonBB :D)
Can you please post the contents of your index file?
Re: [PHP]SimpleBB - The New Bulletin Board! (And the new poseidonBB :D)
PHP Code:
<?php
#####\\\\\\\Load all session data./////#######
session_start();
#######\\\\\Enable error reporting./////#######
error_reporting(E_ALL & ~E_NOTICE);
#######\\\\\Define the forum, as to prevent unwanted access to files./////#######
define("forum", "PRE-ALPHA TEST RELEASE PACKAGE");
######\\\\\Require the database information./////#######
require_once('data/config.php');
######\\\\\\\Require the settings and functions that will be needed./////#######
require_once('data/settings.php');
require_once('data/functions.php');
#####\\\\\\\Get the style./////#######
include('style/poseidonBB/index.php');
?>
There you go, happy?
I'm not posting any other files until it's ready.
Re: [PHP]SimpleBB - The New Bulletin Board! (And the new poseidonBB :D)
Ah, you coded this procedurally. This won't go far because of that.
Re: [PHP]SimpleBB - The New Bulletin Board! (And the new poseidonBB :D)
More files?
data/config.php
PHP Code:
<?php
#Configuration file#
#Rename this to config.php#
define('security', 'protection');
/*MySQL Configuration File*/
/*Database Username. Usually root*/
$dbuser = "***";
/*Database Password. Usually root or nothing.*/
$dbpass = "***";
/*Where is the database hosted?
*If you aren't sure, leave it as blank.*/
$dbhost = "localhost";
/*Database name
*Either change it or create a database*/
$dbname = "***";
/*OTHER*/
/*This is email is only used to send you error logs of your forum. To disable error emails, leave it blank.*/
$email = "";
/*Don't touch this.*/
$conn = @mysql_connect($dbhost,$dbuser,$dbpass) or die(include('fatal.php'));
$db = @mysql_select_db($dbname, $conn) or die(include('fatal.php'));
?>
data/settings.php
PHP Code:
<?php
if(!defined("forum"))
###Trying to reset your stats eh? Won't work.
die("Hacking attempt detected.");
$settings = mysql_query("SELECT * FROM boarddesc");
$data = mysql_fetch_array($settings);
#####\\\\\\\If they aren't logged in, they must be guests///////#####
if(!isset($_SESSION['uid']))
{
$_SESSION['groupid'] = 1;//1 is the Guest group, so don't change the table info manually!
}
#####\\\\\\\You should have a group id, so you must be a hacker!///////#####
if(!isset($_SESSION['uid']) && !isset($_SESSION['groupid']))
{
###Assign them the group id of 4. (Banned)###
echo "An error has occurred while logging in. Please re-login.";//Not tested, but I'm pretty sure it'll show. O_O
$_SESSION['groupid'] = 4;//That's what you get for tampering with the system. :O
}
if($_SESSION['groupid'])
{
$action = mysql_query("SELECT * FROM `member_groups` WHERE id='".$_SESSION['groupid']."'") or die(mysql_error());
$can = mysql_fetch_array($action);
}
#####\\\\\\\SimpleBB Version Number///////#####
$version = $data['version'];
#####\\\\\\\Site name///////#####
$sitename = $data['boardname'];
#####\\\\\\\Site Description///////#####
$sitedesc = $data['description'];
#####\\\\\\\Board email///////#####
$bemail = $data['boardemail'];
#####\\\\\\\Copyright///////#####
$copyright = $data['copyright'];
#####\\\\\\\Terms of Service///////#####
$tos = $data['tos'];
#####\\\\\\\Website root directory///////#####
$rootdir = $data['rootdir'];
#####\\\\\\\Define the membergroup attributes///////#####
if(isset($_SESSION['groupid']))
{
$GLOBALS['id'] = $can['id'];
$GLOBALS['name'] = $can['name'];
$GLOBALS['desc'] = $can['description'];
$GLOBALS['minposts'] = $can['min_posts'];
$GLOBALS['max_pms'] = $can['max_pms'];
$GLOBALS['stag'] = $can['start_tag'];
$GLOBALS['etag'] = $can['end_tag'];
$GLOBALS['utitle'] = $can['user_title'];
$GLOBALS['public'] = $can['public'];
$GLOBALS['isban'] = $can['is_banned'];
$GLOBALS['canavatar'] = $can['can_have_avatar'];
$GLOBALS['cansig'] = $can['can_have_sig'];
$GLOBALS['avatarw'] = $can['avatar_width'];
$GLOBALS['avatarh'] = $can['avatar_height'];
$GLOBALS['avatarsz'] = $can['avatar_size'];
$GLOBALS['sigmchars'] = $can['sig_max_chars'];
$GLOBALS['acp_access'] = $can['can_acp'];
$GLOBALS['mcp_access'] = $can['can_mcp'];
$GLOBALS['can_reply_locked'] = $can['can_reply_locked'];
$GLOBALS['view_maint'] = $can['can_view_maintenance'];
$GLOBALS['can_infract'] = $can['can_infract'];
}
?>
data/functions.php
PHP Code:
<?php
###Check for 'dead' sessions every ten minutes.###
$limit = strtotime('-10 minutes');//If your server experiences large amounts of visitors, make the limite longer.
###Set sessions that have not been active for more than ten meinutes to be inactive.###
mysql_query("UPDATE `users` SET `active` ='0' WHERE `last_action` <= '".$limit."'") or die(mysql_error());
###If the current user is browsing, reset their last action to the current time.###
###Now, check for guest sessions that are no longer active.###
$glimit = strtotime('-5 minutes');//If your server experiences large amounts of visitors, make the limit longer.
###Do the same thing.###
mysql_query("DELETE FROM `guest` WHERE time <= '".$glimit."'") or die(mysql_error());
###IP Log the user; include the part of the site s/he's using. Any file that includes functions.php (Every file should) will use this.###
mysql_query("INSERT INTO `logs_ip` (`ip`, `site`, `date`) VALUES ('".$_SERVER['REMOTE_ADDR']."', '".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']."', '".date("F d, Y")."')");
if(isset($_SESSION['uid']))
{
mysql_query("UPDATE `users` SET `active` = '1', `last_action` = '".time()."' WHERE `id` = '".$_SESSION['uid']."'") or die(mysql_error());
}
if(isset($_SESSION['groupid']))
{
if($_SESSION['groupid'] == 1)
{
$query = mysql_query("SELECT * FROM `guest` WHERE ip='".$_SERVER['REMOTE_ADDR']."'") or die(mysql_error());
if(mysql_num_rows($query) == 0)
{
mysql_query("INSERT INTO `guest` (`ip`, `time`) VALUES ('".$_SERVER['REMOTE_ADDR']."', '".time()."')") or die(mysql_error());
}
else
{
mysql_query("UPDATE `guest` SET time='".time()."' WHERE ip='".$_SERVER['REMOTE_ADDR']."'") or die(mysql_error());
}
}
}
###Get the number of rows there are in the guest table.###
function getOnlineGuests()
{
$query = mysql_query("SELECT * FROM `guest`") or die(mysql_error());
return mysql_num_rows($query);
}
###Fetch the number of people who are active.###
function getOnline()
{
$a = mysql_query("SELECT * FROM `users` WHERE `active`=1 ORDER BY username ASC") or die(mysql_error());
$b = mysql_num_rows($a);
return $b;
}
###Fetch an array of the users who are online.###
function getOnlineArray()
{
$script = mysql_query("SELECT * FROM `users` WHERE `active`=0 ORDER BY username ASC") or die(mysql_error());
$execute = mysql_fetch_array($script);
return $execute;
}
###Get a user with the id of $uid's custom text.###
function getCustomText($uid)
{
$sql = "SELECT * FROM `users` WHERE `id`='".$uid."'";
$execute = mysql_query($sql) or die (mysql_error());
$fetch = mysql_fetch_array($execute);
return $fetch['customtext'];
}
###Fetch the post count.###
function getPostcount($uid)
{
$sql = "SELECT * FROM `posts` WHERE `posterid`='".$uid."'";
$query = mysql_query($sql) or die (mysql_error());
return mysql_num_rows($query);
}
###Fetch the location.###
function getLocation($uid)
{
$sql = "SELECT * FROM `users` WHERE `id`='".$uid."'";
$execute = mysql_query($sql) or die (mysql_error());
$fetch = mysql_fetch_array($execute);
$location = ($fetch['location'] == "") ? "" : $fetch['location'];
return $location;
}
###Fetch the dat of registration.###
function getRegDate($uid)
{
$sql = "SELECT * FROM `users` WHERE `id`='".$uid."'";
$execute = mysql_query($sql) or die (mysql_error());
$fetch = mysql_fetch_array($execute);
return $fetch['regdate'];
}
###Fetch the signature.###
function getSignature($uid)
{
$sql = "SELECT * FROM `users` WHERE `id`='".$uid."'";
$execute = mysql_query($sql) or die (mysql_error());
$fetch = mysql_fetch_array($execute);
return $fetch['signature'];
}
###Parse any BBCode in $message.###
function parseBBCode($message)
{
$getcustom = "SELECT * FROM `custom_bbcode`";
$getquery = mysql_query($getcustom) or die(mysql_error());
$message = wordwrap($message, 160, "<br />", true);
#####Let's use Perl instead of str_replace. Using str_replace will cause errors. However, feel free to switch to str_replace.#####
$message = preg_replace('|\[b\](.+?)\[\/b\]|i', '<b>$1</b>', $message);
$message = preg_replace('|\[i\](.+?)\[\/i\]|i', '<i>$1</i>', $message);
$message = preg_replace('|\[u\](.+?)\[\/u\]|i', '<u>$1</u>', $message);
$message = preg_replace('|\[img\](.+?)\[\/img\]|i', '<img src="$1" border="0" alt="">', $message);
$message = preg_replace('|\[url="(.+?)"\](.+?)\[\/url\]|i', '<a href="$1" target="_blank">$2</a>', $message);
$message = preg_replace('|\[color=(.+?[^;])\](.+?)\[\/color\]|i', '<font color="$1">$2</font>', $message);
$message = preg_replace('|\[size=(.+?[^;])\](.+?)\[\/size\]|i', '<font size="$1">$2</font>', $message);
$message = preg_replace('|\[center\](.+?)\[\/center\]|i', '<center>$1</center>', $message);
$message = preg_replace('|\<<<@!1!@>>>"), array("<div style=\"border:1px solid #FFF; overflow:auto; width:500px; font-style:italic;\"><font size=\"5\" color=\"#FFF\" style=\"border-bottom:1px solid #FFF; font-style:normal;\">Quote: ", "</font>", "</div>"), $message);
$message = str_ireplace(array("[code]", "[/code]"), array("<div style=\"border:1px solid #FFF; overflow:auto; width:500px; color:green;\"><font size=\"5\" color=\"#FFF\" style=\"border-bottom:1px solid #FFF;\">Code:</font>", "</div>"), $message);
$message = str_ireplace(array("<<<@!2!@>>>"), array("<div style=\"border:1px solid #FFF; overflow:auto; width:500px; font-style:italic;\"><font size=\"5\" color=\"#FFF\" style=\"border-bottom:1px solid #FFF; font-style:normal;\">Quote:</font>", "</div>"), $message);
*/
while($custom = mysql_fetch_array($getquery))
{
$message = preg_replace('|\['.$custom['tag'].'\](.+?)\[\/'.$custom['tag'].'\]|i', $custom['replacement'], $message);
}
return $message;
}
###Parse a message; break lines, strip tags, etc.###
function parseMessage($message)
{
return parseBBCode(nl2br(strip_tags(stripslashes($message))));
}
###Check if the user is online.###
function isOnline($uid)
{
$a = mysql_query("SELECT * FROM `users` WHERE `id`='".$uid."'") or die(mysql_error());
$b = mysql_fetch_array($a);
if($b['active'] == '1'){
$check = "<font color=\"green\">Online</font>";
}else{
$check = "<font color=\"red\">Offline</font>";
}
return $check;
}
###Get the MemberGroup of the user.###
function getMemGroup($uid)
{
$sql = "SELECT * FROM `users` WHERE id='".$uid."'";
$query = mysql_query($sql) or die("Could not retrieve the member group.");
$fetch = mysql_fetch_array($query);
$fetchscript = "SELECT * FROM `member_groups` WHERE id='".$fetch['memgroupid']."'";
$fetchquery = mysql_query($fetchscript) or die(mysql_error());
$fetchgroup = mysql_fetch_array($fetchquery);
$starttag = $fetchgroup['start_tag'];
$endtag = $fetchgroup['end_tag'];
return "".$starttag."".$fetchgroup['name']."".$endtag."";
}
###Get the MemberGroup of the user, but don't add the HTML tags. We could have merged this function, but we were too lazy. :P###
function getMemGroupNoC($uid)
{
$sql = "SELECT * FROM `users` WHERE id='".$uid."'";
$query = mysql_query($sql) or die("Could not retrieve the member group.");
$fetch = mysql_fetch_array($query);
$fetchscript = "SELECT * FROM `member_groups` WHERE id='".$fetch['memgroupid']."'";
$fetchquery = mysql_query($fetchscript) or die(mysql_error());
$fetchgroup = mysql_fetch_array($fetchquery);
$starttag = $fetchgroup['start_tag'];
$endtag = $fetchgroup['end_tag'];
return $fetchgroup['name'];
}
###Get the membergroup id of the user.###
function getMemGroupId($uid)
{
$sql = "SELECT * FROM `users` WHERE id='".$uid."'";
$query = mysql_query($sql) or die("Could not retrieve the member group.");
$fetch = mysql_fetch_array($query);
return $fetch['memgroupid'];
}
###Get the HTML start tag(s) of the user.###
function getMemGroupStartTag($uid)
{
$sql = "SELECT * FROM `users` WHERE id='".$uid."'";
$query = mysql_query($sql) or die("Could not retrieve the member group.");
$fetch = mysql_fetch_array($query);
$fetchscript = "SELECT * FROM `member_groups` WHERE id='".$fetch['memgroupid']."'";
$fetchquery = mysql_query($fetchscript) or die(mysql_error());
$fetchgroup = mysql_fetch_array($fetchquery);
$starttag = $fetchgroup['start_tag'];
return $starttag;
}
###Same, but we get the HTML end tags.###
function getMemGroupEndTag($uid)
{
$sql = "SELECT * FROM `users` WHERE id='".$uid."'";
$query = mysql_query($sql) or die("Could not retrieve the member group.");
$fetch = mysql_fetch_array($query);
$fetchscript = "SELECT * FROM `member_groups` WHERE id='".$fetch['memgroupid']."'";
$fetchquery = mysql_query($fetchscript) or die(mysql_error());
$fetchgroup = mysql_fetch_array($fetchquery);
$endtag = $fetchgroup['end_tag'];
return $endtag;
}
###Here, we fetch the color, not to be confused with the HTML tags.###
function getMemGroupColor($mid)
{
$sql = "SELECT * FROM `member_groups` WHERE id='".$mid."'";
$query = mysql_query($sql) or die(mysql_error());
$fetch = mysql_fetch_array($query);
$color = $fetch['color'];
return $color;
}
###Get the username with $uid; are we linking the name to the profile?###
function getName($uid, $linked = FALSE)
{
$sql = "SELECT username from `users` WHERE `id`='".$uid."'";
$query = mysql_query($sql) or die (mysql_error());
if(mysql_num_rows($query) == 0)
{
return "Invalid User";
}
else
{
$get = mysql_fetch_array($query);
if(!$linked)
{
return $get['username'];
}
else
{
return "<a href=\"profile.php?id=".$uid."\" style=\"color: ".getMemGroupColor(getMemGroupId($uid)).";\">" . $get['username'] . "</a>";
}
}
}
###Same as above, but we dont add the color of the membergroup to the link.###
function getLinkNameNoCol($uid, $col="black")
{
$sql = "SELECT username from `users` WHERE `id`='".$uid."'";
$query = mysql_query($sql) or die (mysql_error());
if(mysql_num_rows($query) == 0)
{
return "Invalid User";
}
else
{
$get = mysql_fetch_array($query);
return "<a href=\"profile.php?id=".$uid."\" style=\"color:".$col.";\">" . $get['username'] . "</a>";
}
}
###Is the thread with an ID of $thread read?###
function isReadThread($thread)
{
#Get Thread Info.#
$query = mysql_query("SELECT * FROM `threads` WHERE id='".$thread."'") or die(mysql_error());
$info = mysql_fetch_array($query);
$time = $info['exacttime'];
if(!isset($_SESSION['topic'.$thread]))
{
$read = false;
}
else
{
if($_SESSION['topic'.$thread] < $time)
{
$read = false;
}
else
{
$read = true;
}
}
return $read;
}
?>
data/mysqlfunc.php
PHP Code:
<?php
/**
* MySQL Functions
*/
#These functions are not implemented yet, they are here just because I want something to do. :P#
class MySQLFunc
{
public function protect($var, $stripslashes=true)
{
if($stripslashes == true)
return mysql_real_escape_string(stripslashes($var));
else
return mysql_real_escape_string($var);
}
public function testConnection($conn)
{
if(!$conn)
return false;
else
return true;
}
public function fetchRows($tablename, $args="")
{
if($args != "")
$script = "SELECT * FROM `".$tablename."` ".$args."";
else
$script = "SELECT * FROM `".$tablename."`";
$query = @mysql_query($script);
if(!$query)
return "Error fetching table rows";
else
{
$array = mysql_fetch_array($query);
return $array;
}
}
}
?>
data/fatal.php
PHP Code:
<?php
if(isset($email))
{
if($email != "")
mail($email, "A Database Error Has Occurred!", "Hello!<br />Today, your forum has experienced database errors. This may be caused by an incorrectly installed modification, or a change to you MySQL settings. Please check to make sure that all files are working properly, and that your database does not have missing or corrupt tables.");
}
else
{
die("Hacking attempt has been detected!");
}?>
<title>Database Error</title>
<!--Database Error Script-->
<style type="text/css">
body {
background:#FFF;
font-size:8pt;
font-family:Tahoma;
}
</style>
A database error has occured, and the staff of this forum have been notified.<br />
This error may be temporary! Refresh the page, and see if the page loads.<br />
If not, try going to the homepage of the forum.<br />
If the page still does not load, your requested forum may be offline, or may be experiencing database troubles!<br />
Check back later!
Re: [PHP]SimpleBB - The New Bulletin Board! (And the new poseidonBB :D)
Not good. I had a feeling you coded it this way.
Re: [PHP]SimpleBB - The New Bulletin Board! (And the new poseidonBB :D)
Re: [PHP]SimpleBB - The New Bulletin Board! (And the new poseidonBB :D)
Well, for one, you used way too many queries. The structure makes no sense, and there isn't much room for additions.
Re: [PHP]SimpleBB - The New Bulletin Board! (And the new poseidonBB :D)
Wayne...you messed it up.