-
[Development] Modern Board - [PHP, OSS]
{logo}
Modern Board is a forum software made completely from scratch. It is made up of many languages and is object oriented. It is very lightweight as of now. It will include all of the things normal boards have, minus the plugin system, which could change at a later date. I am a huge beginner with PHP so bear with me if I do something that can be done in a better manner.
{reserved text}
Foreground Features
- Users can register.
- Users can log in.
- Users can log out.
- Users can change password.
- Users can post on each others walls.
- Users can shout on the shoutbox.
- System now shows Online Users(needs a major re code)
- Users are unable to spam walls anymore.
- Users are unable to spam the shoutbox anymore.
- Users can use commands in the shoutbox.
Background Features
- Core class with proper OOP.
- Proper error display.
- Easy-To-Edit configuration file.
- Clean template system & source code.
- User Caching System
Languages
- PHP
- AJAX
- HTML
- CSS
- jQuery
- Javascript
- SQL
If the language is green it has already been implemented if red, it is planned.
Live Demo:
mB - Powered by mBoard
Once again, I'm a beginner so if you would give me some tips and feedback that would be great. Also I know the style sucks, it's just a placeholder for when I can get better CSS files(not very good at designing myself).
-
Re: [Development] Modern Board - [PHP, OSS]
quite good, maybe i could design a layout for you?
-
Re: [Development] Modern Board - [PHP, OSS]
Quote:
Originally Posted by
Kimthaonly
quite good, maybe i could design a layout for you?
That would be great, I believe I have you on MSN? if not
me@hubbainn.co.cc
-
Re: [Development] Modern Board - [PHP, OSS]
Why do I see account settings, and logout? I haven't registered, nor have I logged in.
Also, where is the board? all I see is a shout box.
:blink:
-
Re: [Development] Modern Board - [PHP, OSS]
Quote:
Originally Posted by
RastaLulz
Why do I see account settings, and logout? I haven't registered, nor have I logged in.
Also, where is the board? all I see is a shout box.
:blink:
Brackets were out of order.
For some reason I tackled the shoutbox first.
I'm going to start the actual forum(posting, replying etc) within a few hours.
-
Re: [Development] Modern Board - [PHP, OSS]
HTML Tips:
Use less line breaks and more divs.
For the top right navigation, use a list, not just plain links.
PHP Tips:
One problem I see here is that when you, for example, post a shoutbox message, and then try to refresh the page, it tries to resubmit the data. This is a common problem when coding with forms. It can be solved using the Post/Redirect/Get design pattern. Look more in to it through google, and wikipedia - Post/Redirect/Get - Wikipedia, the free encyclopedia
Javascript tips:
It doesn't look you have much - if any - javascript on the site right now. When you do implement javascript, make sure you keep it all in external files (unless it's in the onClick property of an element or something..), and keep the javascript file calls at the bottom of the site whenever possible.
When javascript is at the top of the site, the site has to wait for all the javascript to download and load before it fully loads the page. This is obviously bad. Putting as much javascript as possible at the bottom of the page helps a lot with page load time. Some javascript needs to be called before certain elements, and that is okay if it is the only option. But things like jquery can be called from the bottom of the page just fine, and it makes the page load time a lot faster.
jQuery tips:
Not much to say here, except that jQuery is a library on top of Javascript - it is not its own language.
Bug?:
The page seems to reload every 5-10 seconds for seemingly no reason.
Other than all that - good job so far, and good luck on the journey ahead of you ;).
-
Re: [Development] Modern Board - [PHP, OSS]
Quote:
Originally Posted by
timebomb
HTML Tips:
Use less line breaks and more divs.
For the top right navigation, use a list, not just plain links.
PHP Tips:
One problem I see here is that when you, for example, post a shoutbox message, and then try to refresh the page, it tries to resubmit the data. This is a common problem when coding with forms. It can be solved using the Post/Redirect/Get design pattern. Look more in to it through google, and wikipedia -
Post/Redirect/Get - Wikipedia, the free encyclopedia
Javascript tips:
It doesn't look you have much - if any - javascript on the site right now. When you do implement javascript, make sure you keep it all in external files (unless it's in the onClick property of an element or something..), and
keep the javascript file calls at the bottom of the site whenever possible.
When javascript is at the top of the site, the site has to wait for all the javascript to download and load before it fully loads the page. This is obviously bad. Putting as much javascript as possible at the bottom of the page helps
a lot with page load time. Some javascript needs to be called before certain elements, and that is okay if it is the only option. But things like jquery can be called from the bottom of the page just fine, and it makes the page load time a lot faster.
jQuery tips:
Not much to say here, except that jQuery is a library on top of Javascript - it is not its own language.
Bug?:
The page seems to reload every 5-10 seconds for seemingly no reason.
Other than all that - good job so far, and good luck on the journey ahead of you ;).
The page refreshes to get all the new shouts(it's 9 seconds) other then that, thank you. It doesn't try to resubmit data as well, because I have a check that stops it.
-
Re: [Development] Modern Board - [PHP, OSS]
Quote:
Originally Posted by
Tr0ll.™
The page refreshes to get all the new shouts(it's 9 seconds) other then that, thank you. It doesn't try to resubmit data as well, because I have a check that stops it.
Ajax will allow you to do a refresh on the shoutbox without refreshing the page.
The browser does try to resubmit the data. You can, and should stop that, using the PRG design pattern. Good luck.
Oh, and the PRG design pattern essentially works like this:
1. Submit the form to the current page. If the form is on index.php, have the form submit to index.php.
2. Validate the data on index.php. Make sure it is all okay.
3. If the data is validated successfully, redirect it to another page that handles the data, i.e. putting it in the database or what-not.
4. Redirect from the handling page back to index.php using
Code:
header("Location: index.php");
If the data is invalid, then they will still be able to resubmit it. But it doesn't matter, because it still won't get validated, and thus it won't be put in to the database.
If the data is indeed valid, then they will be put back at the original page, and if they attempt to go back/forward/refresh, it will work normally. They won't be able to get to the handling page, and there refresh won't ask them if they want to resubmit the data.
-
Re: [Development] Modern Board - [PHP, OSS]
Quote:
Originally Posted by
timebomb
Ajax will allow you to do a refresh on the shoutbox without refreshing the page.
The
browser does try to resubmit the data. You can, and should stop that, using the PRG design pattern. Good luck.
Oh, and the PRG design pattern essentially works like this:
1. Submit the form to the current page. If the form is on index.php, have the form submit to index.php.
2. Validate the data on index.php. Make sure it is all okay.
3. If the data is validated successfully, redirect it to another page that handles the data, i.e. putting it in the database or what-not.
4. Redirect from the handling page back to index.php using
Code:
header("Location: index.php");
If the data is invalid, then they will still be able to resubmit it. But it doesn't matter, because it still won't get validated, and thus it won't be put in to the database.
If the data is indeed valid, then they will be put back at the original page, and if they attempt to go back/forward/refresh, it will work normally. They won't be able to get to the handling page, and there refresh won't ask them if they want to resubmit the data.
Thank you for the insight. I've been looking at AJAX, it looks pretty confusing to me but after a few trial and error sessions, I'm sure I can get it to work.
Also, Smiles are now done. Once I upload the new version to the test site you all can see it.
-
Re: [Development] Modern Board - [PHP, OSS]
Quote:
Originally Posted by
Tr0ll.™
Thank you for the insight. I've been looking at AJAX, it looks pretty confusing to me but after a few trial and error sessions, I'm sure I can get it to work.
Also, Smiles are now done. Once I upload the new version to the test site you all can see it.
I just recently started using AJAX myself for a project of mine. It was a bit confusing, especially considering how many different ways to implement it there are. Here is the basic function I am using to apply ajax.
Code:
function handle_stuff(m_varA, m_varB) {
$.post("handle_stuff.php", {
varA: m_varA,
varB: m_varB
}, function (data) {
if (data.length > 0) {
$(".div_class").html(data)
}
})
}
Here's essentially what this does...
First, the javascript function handle_stuff needs to be called. I do this through an onClick with a link, but you can also do it in many other situations.
The javascript function is called with two parameters. varA and varB.
Next, varA and varB are sent to handle_stuff.php as post variables. Thus, I can access them through handle_stuff.php with $_POST['varA'] or $_POST['varB'].
Then, the div with the class div_class is modified to display the data variable, which should be a string.
The data variable is filled with whatever is echo'd out by handle_stuff.php.
So, if I put at the end of handle_stuff.php:
then the data variable in the handle_stuff javascript function will be RaGEZONE.
For me, I use a function very similar to this, so that when a user hits a plus or minus button, then a score is automatically updated and displayed on the same page - all without having to refresh the full page.
I hope this helped a bit. Once again, best of luck.
P.S. I am pretty sure the function I gave you requires jQuery.
-
Re: [Development] Modern Board - [PHP, OSS]
-
Re: [Development] Modern Board - [PHP, OSS]
Quote:
Originally Posted by
timebomb
I just recently started using AJAX myself for a project of mine. It was a bit confusing, especially considering how many different ways to implement it there are. Here is the basic function I am using to apply ajax.
Code:
function handle_stuff(m_varA, m_varB) {
$.post("handle_stuff.php", {
varA: m_varA,
varB: m_varB
}, function (data) {
if (data.length > 0) {
$(".div_class").html(data)
}
})
}
Here's essentially what this does...
First, the javascript function handle_stuff needs to be called. I do this through an onClick with a link, but you can also do it in many other situations.
The javascript function is called with two parameters. varA and varB.
Next, varA and varB are sent to handle_stuff.php as post variables. Thus, I can access them through handle_stuff.php with
$_POST['varA'] or
$_POST['varB'].
Then, the div with the class
div_class is modified to display the
data variable, which should be a string.
The
data variable is filled with whatever is echo'd out by handle_stuff.php.
So, if I put at the end of handle_stuff.php:
then the data variable in the handle_stuff javascript function will be
RaGEZONE.
For me, I use a function very similar to this, so that when a user hits a plus or minus button, then a score is automatically updated and displayed on the same page - all without having to refresh the full page.
I hope this helped a bit. Once again, best of luck.
P.S. I am pretty sure the function I gave you requires jQuery.
I found a better method.
PHP Code:
var refresh = setInterval(
function()
{
$('#ReloadThis').load('<?php echo Path.'/shoutbox.php'; ?>');
}, 3000);
---------- Post added at 03:48 AM ---------- Previous post was at 03:47 AM ----------
Quote:
Originally Posted by
foxx
use framework
Is that the name.. or are you telling me to just use a framework?
-
Re: [Development] Modern Board - [PHP, OSS]
jQuery and AJAX are not languages.
foxx is telling you to use a framework.
some good ones with large support are ZEND, CakePHP and (my personal favourite) CodeIgniter.
-
Re: [Development] Modern Board - [PHP, OSS]
A framework is a good idea if you have time and are not a wildly experienced programmer.
Zen:
AJAX represents a group of tools, functions, and languages. Technically, you are correct, as it is not a specific language all on its own.
Quote:
Like DHTML and LAMP, Ajax is not one technology, but a group of technologies. Ajax uses a combination of HTML and CSS to mark up and style information. The DOM is accessed with JavaScript to dynamically display, and to allow the user to interact with the information presented. JavaScript and the XMLHttpRequest object provide a method for exchanging data asynchronously between browser and server to avoid full page reloads
-
Re: [Development] Modern Board - [PHP, OSS]
a framework is a good idea even if you are the best fokken programmer
-
Re: [Development] Modern Board - [PHP, OSS]
Quote:
Originally Posted by
foxx
a framework is a good idea even if you are the best fokken programmer
If you can code a system around your website project that will keep your website secure and efficient, a framework would, more times than not, either slow you or/and your site down.
I, personally, find it much easier to program a product that is 100% originally my code, than a program that is either not my code or built on top of a framework.
Nonetheless, using a framework is very rarely, if ever, a 'bad' idea (depending on the quality of the framework though, of course). If you know what you are doing, it boils down to what you need for your application, and your personal preference.
-
Re: [Development] Modern Board - [PHP, OSS]
you won't ever build MVC or database adapter that's more flexible and extensible than the one built by team of people that made php themself
and MVC is the future of web
---------- Post added at 11:06 AM ---------- Previous post was at 10:59 AM ----------
besides building a forum is just the kind of project that's perfect for use of a framework, you might use some OOP here and there, but in the end without a framework it's still gonna me messy procedural php
-
Re: [Development] Modern Board - [PHP, OSS]
Quote:
Originally Posted by
foxx
you won't ever build MVC or database adapter that's more flexible and extensible than the one built by team of people that made php themself
and MVC is the future of web
---------- Post added at 11:06 AM ---------- Previous post was at 10:59 AM ----------
besides building a forum is just the kind of project that's perfect for use of a framework, you might use some OOP here and there, but in the end without a framework it's still gonna me messy procedural php
After a bit of research, I assume you mean the Zend engine and framework?
Apparently a couple of developer's took the original PHP developer's work and updated it and whatnot and released PHP 3. Then they completely rewrote the parser and called it the Zend Engine, which has been the core of PHP ever since PHP 4.
Kind of confusing...
The framework was founded, and assumingly the original/base built, by their company - Zend Technologies.
The fact that Zend technology are only listed as the founders and corporate sponsors of the framework makes me believe that, by now, the Zend Framework is more community-built than anything else.
In terms of using a framework to create a message board:
Yes, yes, and yes. A message board would indeed be an 'ideal project' to be created using a PHP framework.
-
Re: [Development] Modern Board - [PHP, OSS]
yes I mean zend framework which is made by people who made zend engine which is the engine behind php itself, up from version 3, that is
and no, zend framework is not exactly community build, it's similar to how mozilla's firefox work, and you can't really say firefox is community-build, can you..
-
Re: [Development] Modern Board - [PHP, OSS]
I would like to point out, I'm doing this for experience along with learning. I would rather work off of it from scratch. Thank you for the tips.
-
Re: [Development] Modern Board - [PHP, OSS]
Why using vBulletin favicon?
-
Re: [Development] Modern Board - [PHP, OSS]
Quote:
Originally Posted by
Dzoki
Why using vBulletin favicon?
I'm not, I haven't set a favicon so apache decided to use the roots favicon :P
---------- Post added at 07:58 PM ---------- Previous post was at 07:32 PM ----------
I've made a github for the project.
https://github.com/Makarovich/Modern-Board The source at the moment is dirty.
Please give me positive comment instead of negative ones.
Thank You.
-
Re: [Development] Modern Board - [PHP, OSS]
Quote:
Originally Posted by
Tr0ll.™
Alright, let's begin.
- Instead of essentially creating a whole new page for functions like registering, why not just use GET and then just include the register.php when it is called through GET?
In other words, instead of http://localhost/forum/register.php, use http://localhost/forum/index.php?action=register
I also suggest doing this for anything else you can, i.e. login, logout, profile, etc etc.
- Now, includes/core.php:
Code:
$value = mysql_query("SELECT * FROM users WHERE id = '".$id."'");
No. No. No. No.
I don't care what other kind of protection you have. I don't care how well you try to stop user's from inputting 'bad' characters in to text boxes and such.
'".$id."'" is a huge no-no.
Here, read up on MySQLi:
PHP: Mysqli - Manual
Specifically the bind_param function.
- smiles/ - This folder is misspelled, hehe. Although, forum smilies is often misspelled.
- A simple PHP tip:
Code:
if (mysql_num_rows($result) == 0){
return true;
}
can be written like
Code:
if (mysql_num_rows($result) == 0)
return true;
and it will still work just the same. It's definitely a personal choice, but it makes the code a tad cleaner in some people's eyes, and also gets rid of one unnecessary line :P.
- Now.. just a small HTML tip - putting something like this:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
right above the <html> tag in the header will, among other things, make Internet Explorer a lot more willing to display more parts of your site, especially if they currently use even remotely-non-basic CSS.
- Oh, and...
Code:
<head>
<title><?php echo $config['title']; ?> - Powered by mBoard</title>
</head>
Add <html> above the head tag ;).
- Finally.. Bulletin is spelled bulletin, not Bulliten ;).
I hope this helped. Once again, good luck.
-
Re: [Development] Modern Board - [PHP, OSS]
@Above. Couldn't have said it better my self.
There's also a quicker way to put:
PHP Code:
<?php echo $blabla; ?>
Which is:
Good luck with it though. When are you doing a logo? xD
-
Re: [Development] Modern Board - [PHP, OSS]
Quote:
Originally Posted by
FreedomSaint
There's also a quicker way to put:
PHP Code:
<?php echo $blabla; ?>
Which is:
The problem with that is that many web servers don't recognize as <? being the start of a PHP code block, and thus it doesn't work. That's why I always use <?php.
-
Re: [Development] Modern Board - [PHP, OSS]
Quote:
Originally Posted by
FreedomSaint
@Above. Couldn't have said it better my self.
There's also a quicker way to put:
PHP Code:
<?php echo $blabla; ?>
Which is:
Good luck with it though. When are you doing a logo? xD
A logo is probably one of the easiest and last things I'm doing.
---------- Post added at 01:12 PM ---------- Previous post was at 01:11 PM ----------
I'm going to stop the development for maybe a few days. School is starting tomorrow and I need to focus on that.
-
Re: [Development] Modern Board - [PHP, OSS]
Quote:
Originally Posted by
FreedomSaint
@Above. Couldn't have said it better my self.
There's also a quicker way to put:
PHP Code:
<?php echo $blabla; ?>
Which is:
Good luck with it though. When are you doing a logo? xD
php shorthand is a bad practice and should be avoided for as stated before most apache servers dont recognize shorthand.
school is starting for me too and ill be doing CCNA through Cisco. WEEEEEEEEE
-
Re: [Development] Modern Board - [PHP, OSS]
Link doesn't even work? Is there a new demo link?
-
Re: [Development] Modern Board - [PHP, OSS]
Quote:
Originally Posted by
holthelper
php shorthand is a bad practice and should be avoided for as stated before most apache servers dont recognize shorthand.
school is starting for me too and ill be doing CCNA through Cisco. WEEEEEEEEE
It's not that apache servers don't "recognize" it, it's just disabled by default- and for good reason.
If you have PHP short-tags enabled, you can't use an <?xml ?> leading tag on xHTML 1.1 documents.
Example of an XHTML 1.1 document
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html version="-//W3C//DTD XHTML 1.1//EN"
xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/1999/xhtml
http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd"
>
<head>
<title>Virtual Library</title>
</head>
<body>
<p>Hello, World!</p>
</body>
</html>
The above example leads to a PHP parse error with short-tags enabled.
You can also have ASP tags enabled, but it's disabled by default.
ASP tags will not conflict with XML. You shouldn't be coding in ASP anyway, so there's no reason not to unless.. well I state below why asp & short tags can be bad..
PHP Code:
<?php
ini_set('display_errors', 1);
ini_set('error_reporting', -1);
$str = "This is a string in PHP";
?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html version="-//W3C//DTD XHTML 1.1//EN"
xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/1999/xhtml
http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd"
>
<head>
<title>Virtual Library</title>
</head>
<body>
<% for($i=0;$i<10;$i++):%>
<p><%=$str%></p>
<% endfor%>
</body>
</html>
The problem with asp_tags and short_tags, is that you have to enable them in the php.ini file (ex: /etc/php5/apche2/php.ini). That also requires you to restart apache after making appropriate changes to that file (find "asp_tags" or "short_tags", change value to 'On' or 'Off').
If you're coding an application to be used on more than one server, this could be a problem, as not all host providers let you edit this file for your account. Example, when a host decides to stupidly share this file across users.. which is a security risk and there's better ways of doing this, but not everyone thinks ahead, so there are hosts out there (like free hosts) that are retarded and don't care about their client's security or features.
If your application is supposed to be compatible for use by one of their clients, of if you're one of their clients, you cannot use use asp_tags or short_tags.
If it's a private project, go for it.. It's kind of like using PHP as a templating language.
...
Quote:
Originally Posted by
foxx
but in the end without a framework it's still gonna me messy procedural php
That's an opinion with a lack of experience, but many people actually know how to code *clean* without a framework. Even procedural code can be clean, it's just harder to do.
If you code it in OOP, and it becomes a procedural mess, you're not coding OOP correctly. You don't need a framework to code neatly.. Especially if u jump to a framework from a clutter life-style, it'll still be a cluttered mess.
Also, MVC is a design pattern. It's not patented by ZEND. Model View Controller is a good design pattern, but it doesn't require a framework or style of programming, though it does work good coded in OOP.