[PHP] Forum System menu

Shout-Out

User Tag List

Results 1 to 11 of 11
  1. #1
    SpellEffects's Avatar Sergeant
    Reputation
    64
    Join Date
    Apr 2011
    Posts
    69
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [PHP] Forum System

    Here's a forum system i wrote in PHP.

    I hope you enjoy it.

    And if you have any suggestions on how I could improve it then i would be happy to get some constructive suggestions.

    http://filebeam.com/efaf179ddb22c4a9e705e8256a9f8955

    This is what the frontpage looks like when you've finally made your first thread.


    Here are 3 different ranks that you can post as; Admin, Mod, Janitor.


    This is the Mod Panel, where you can delete post/threads and sticky threads.
    Last edited by SpellEffects; 04-25-2011 at 07:31 AM.
    uint32 = -1;
    I guess some people just find it hard to input their question into a field and press enter.

    Check out my blog here on the forums

    [PHP] Forum System
  2. #2
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Would have been a good idea to note the password is mmowned.

    I'm getting syntax errors, but then again that could be because I cba to install the DB: http://stoneharry.com/test/
    Last edited by stoneharry; 04-24-2011 at 04:21 PM.

  3. #3
    SpellEffects's Avatar Sergeant
    Reputation
    64
    Join Date
    Apr 2011
    Posts
    69
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by stoneharry View Post
    Would have been a good idea to note the password is mmowned.

    I'm getting syntax errors, but then again that could be because I cba to install the DB: http://stoneharry.com/test/
    Corrected error.

    Filebeam - Beam up that File Scottie!

    Since you figured out the password then I do not think I have to note it down in my thread.

    Imo if people can not figure it out then why are they even on the internet to begin with?
    uint32 = -1;
    I guess some people just find it hard to input their question into a field and press enter.

    Check out my blog here on the forums

  4. #4
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    title

    Seems to be riddled with errors, I executed the file and have it configured properly.

  5. #5
    SpellEffects's Avatar Sergeant
    Reputation
    64
    Join Date
    Apr 2011
    Posts
    69
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by stoneharry View Post
    title

    Seems to be riddled with errors, I executed the file and have it configured properly.
    I might have uploaded the wrong revision.

    Ill upload the correct one in a few.

    ---------- Post added at 02:33 PM ---------- Previous post was at 01:52 PM ----------

    Originally Posted by SpellEffects View Post
    I might have uploaded the wrong revision.

    Ill upload the correct one in a few.
    Made some minor changes to the forum, to fix bugs etc.

    Added screenshots aswell.

    You need to redownload the new version and clear your database and reimport the new db structure.
    uint32 = -1;
    I guess some people just find it hard to input their question into a field and press enter.

    Check out my blog here on the forums

  6. #6
    Sonic Waffle's Avatar Contributor
    Reputation
    170
    Join Date
    Dec 2007
    Posts
    990
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I like the way it's based off the Wakaba forum styles.


  7. #7
    SpellEffects's Avatar Sergeant
    Reputation
    64
    Join Date
    Apr 2011
    Posts
    69
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone used it yet?

    Im waiting for some constructive criticism on how to improve it.
    uint32 = -1;
    I guess some people just find it hard to input their question into a field and press enter.

    Check out my blog here on the forums

  8. #8
    GrooN's Avatar Banned
    Reputation
    7
    Join Date
    Sep 2006
    Posts
    68
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well it would be a fine start, but I wouldn't personally recommend it for any official use. There are lots of HTML mistakes, and no error handling at all, everything is sent directly to the user. There isn't any way to format your code either. So I would say, it is a fine start, but could still use a lot of work

    Good luck with your project !

  9. #9
    just1name's Avatar Private
    Reputation
    3
    Join Date
    May 2011
    Posts
    10
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thread.php

    Code:
    $publickey = "6Len4MISAAAAANPZKzVvKFhTgt5ZAz7NJ3y6O5uU";
    $privatekey = "6Len4MISAAAAAFkkAl5azpMB4szt734uDlCOQlWm";
    Wooppsss !

    threadview.php

    Code:
    $id = $_GET['id'];
    $sql = "SELECT * FROM $table WHERE id='$id'";
    $result = $mysqli->query($sql);
    SQL Injection .

    reply.php

    Code:
    $id = $_POST['id'];
    $sql = "SELECT * FROM $table WHERE id='$id'";
    $result = $mysqli->query($sql);
    SQL Injection .

    Code:
    <? echo $_GET['id']; ?>
    XSS .

    postview.php

    Code:
    $id = $_GET['id'];
    $sql = "SELECT * FROM $table2 WHERE id='$id'";
    $result = $mysqli->query($sql);
    mod.php

    Code:
    if (isset($_POST['delete'])) {
    	$delID = $_POST['id'];
    	if ($sql = $mysqli->prepare("DELETE FROM $table WHERE id=$delID")) {
    		$sql->execute();
    		$sql->close();
    		echo "Success!";
    	} else {
    		echo "Something Went Wrong!";
    	}
    }
    SQL injection + CSRF .

    and others ...
    Last edited by just1name; 05-23-2011 at 11:32 AM.

  10. #10
    merfed's Avatar キタ━━━(゜∀゜)━━━!!!!!


    Reputation
    452
    Join Date
    Jul 2006
    Posts
    1,537
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Here's some old code from my own framework, this is mostly a very stripped down version of handling database connections and functions.
    Code:
    class Database {
    	public $Hostname;
    	public $Username;
    	public $Password;
    	public $DbName;
    
    	public $AffectedRows = 0;
    
    	public function Connect($Database) {
    		$this->_database_connection = mysql_connect( $this->Hostname,
    													 $this->Username,
    													 $this->Password );
    													 
    		if (!$this->_database_connection) {
    			echo "Could not connect to server: <strong>$this->Hostname</strong>.";
    		}
    		
    		return $this->_database_connection;
    	}
    	
    	public function SelectDatabase() {
    		$this->_database_connection_select = mysql_select_db($this->DbName,
    															 $this->_database_connection);
    															 
    		if (!mysql_select_db($this->DbName)) {
    			echo "Could not open database: <strong>$this->DbName</strong>.";
    		}
    		return $this->_database_connection_select;
    	}
    	
    	public function ProcessConnection($Database) {
    		$Database->Connect($Database);
    		$Database->SelectDatabase($Database);
    	}
    	
    	public function MainConnection($Database) {
    		$Database->ProcessConnection($Database);
    	}
    	
    	public function ChangeDatabase($DbName) {
    		mysql_select_db($Database, $this->ConnectionID);
    		$this->DbName = $DbName;
    	}
    
    	/**
    	 * Executes a query on the database.
    	 * @param	string		The query to be executed.
    	 *
    	 * @example		$Database->Query($SQL);
    	 */
    	public function Query($SQL) {
    		$this->QueryID = mysql_query($SQL);
    		if (!$this->QueryID) {
    			echo "<strong>MySQL query failed:</strong> $SQL";
    			return 0;
    		}
    		
    		$this->AffectedRows = mysql_affected_rows($this->_database_connection);
    		
    		return $this->QueryID;
    	}
    
    	/**
    	 * Updates records in the database.
    	 * @param 	string		The table with wish to change
    	 * @param	array 		Array of changes: field => value
    	 * @param 	string		Changes the condition
    	 * @return 	bool
    	 *
    	 * @example		$Database->Update( 'testTable', array('name'=>'MichaelP' ), 'ID=2' );
    	 */
    	public function Update($Table, $Changes, $Condition) {
    		$Update = "UPDATE " . $Table . " SET ";
    		foreach($Changes as $Field => $Value) {
    			$Update .= "`" . $Field . "`='{$Value}',";
    		}
    		
    		$Update = substr($Update, 0, -1);
    		if ($Condition != '') {
    			$Update .= "WHERE " . $Condition;
    		}
    		
    		$this->Query($Update);
    		return true;
    	}
    	
    	/**
    	 * Deletes records from the database.
    	 * @param	string		The table to remove rows from
    	 * @param	string		The condition for which rows are to be removed
    	 * @param	int			The number of rows to be removed
    	 * @return	void
    	 *
    	 * @example		$Database->Delete( 'testTable', "name='MichaelP'", 5 );  
    	 */
    	public function Delete($Table, $Condition, $Limit) {
    		$Limit = ( $Limit == '' ) ? '' : ' LIMIT ' . $Limit;
    		$Delete = "DELETE FROM {$Table} WHERE {$Condition} {$LIMIT}";
    		$this->Query($Delete);
    	}
    	
    	/**
    	 * Inserts records into the database.
    	 * @param	string		The table you wish to insert records into
    	 * @param	array 		Array data to insert: field => value
    	 * @return	bool	 
    	 *
    	 * @example		$Database->Insert( 'testTable', array('name'=>'Michael' ) );
    	 */
    	
    	public function Insert($Table, $Data) {
    		$Fields = "";
    		$Values = "";
    		
    		foreach ($Data as $F => $V) {
    			$Fields .= "`$F`,";
    			$Values .= ( is_numeric( $V ) && ( intval( $V ) == $V ) ) ? $V."," : "'$V',";
    		}
    		
    		$Fields = substr($Fields, 0, -1);
    		$Values = substr($Values, 0, -1);
    		
    		$Insert = "INSERT INTO $Table ({$Fields}) VALUES({$Values})";
    		$This->Query($Insert);
    		
    		return true;
    	}
    	
    	public function Close() {
    		if (!mysql_close($this->_database_connection)) {
    			echo "Connection close failed.";
    		}
    	}
    
    }
    Which can be initialized as such:
    Code:
    session_start();
    $Database = new blm_Database();
    $Database->Hostname = $Hostname;
    $Database->Username = $Username;
    $Database->Password = $Password;
    $Database->DbName = $DbName;
    
    $Database->MainConnection($Database);
    Include a config file with those variables defined and your good to go. This was done a few years ago, and since then the framework's database class is a bit better, handling queries more safely and checking for almost every possible outcome. I'd share that if it wasn't tied into error handling and the core factory. It's all object oriented, so to apply it to your code wouldn't be too hard but your looking at a complete rewrite and it's way to undocumented for me to want to provide help. I put some documentation into the script above if your not familiar with objects and what not.

    Have fun. Keep up the work, maybe something will come of it.

  11. #11
    Kirth's Avatar Active Member
    Reputation
    58
    Join Date
    Nov 2007
    Posts
    274
    Thanks G/R
    2/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by merfed View Post
    Here's some old code from my own framework....
    What's wrong with using PDO and/or things such as Active Record?



Similar Threads

  1. Guide: Give rep in new forum system
    By Tryon in forum Community Chat
    Replies: 9
    Last Post: 07-20-2014, 11:31 PM
  2. [Release] ColorMe php forums
    By Nathan72389 in forum Community Chat
    Replies: 4
    Last Post: 06-27-2010, 10:18 AM
  3. php payment system?
    By -Ryuk- in forum Community Chat
    Replies: 1
    Last Post: 04-17-2010, 06:58 PM
  4. [request] PhP forum WoW Design
    By xaverz in forum Art & Graphic Design
    Replies: 0
    Last Post: 05-21-2008, 11:28 AM
  5. php forum
    By Le Froid in forum Community Chat
    Replies: 3
    Last Post: 12-19-2007, 03:56 PM
All times are GMT -5. The time now is 04:58 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search