I have taken up a project of creating my own forum. A chat forum. I have started to design the homepage. But there is still much more work to do.

The thing is I dont know how the folowing things work:

Member login and that each member has their own profile page
The member has the ability to to post what ever is on his/her mind.
The posting can either be on his/her own wall (like in facebook) or make a new article (like here on daniweb)
An admin account that has higher privilaged so that I can delete posts that doesn't follow my forum's rules

I dont know how to implement these things and how they work in theory. This site is going to be a local site and isnt
going to recieve heavy trafic.
If anyone could explain this to me, I will apreciate it as I am rather into this project and would like to make it.

Thanks in advance....

Dani AI

Generated

A small forum is best built from four cooperating parts: storage (a database), server-side logic (authentication, authorization, content APIs), a client UI (HTML/CSS/JS), and a simple moderation layer. and pointed toward persistent storage and server processing; and highlighted that server frameworks (ASP.NET/C#, Java, PHP) run on the server and serve standard HTML/JSON to any browser. The sketch below is a compact, practical blueprint that can be applied whether the backend is PHP, ASP.NET, or Java.

A minimal data model (MySQL/InnoDB, utf8mb4):

CREATE TABLE users (
  id INT AUTO_INCREMENT PRIMARY KEY,
  username VARCHAR(50) NOT NULL UNIQUE,
  email VARCHAR(255) NOT NULL UNIQUE,
  password_hash VARCHAR(255) NOT NULL,
  role ENUM('user','admin') NOT NULL DEFAULT 'user',
  created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
  is_active TINYINT(1) DEFAULT 1
) ENGINE=InnoDB CHARSET=utf8mb4;

CREATE TABLE profiles (
  user_id INT PRIMARY KEY,
  display_name VARCHAR(100),
  bio TEXT,
  avatar_url VARCHAR(255),
  FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
) ENGINE=InnoDB CHARSET=utf8mb4;

CREATE TABLE posts (
  id INT AUTO_INCREMENT PRIMARY KEY,
  user_id INT NOT NULL,
  type ENUM('wall','article') NOT NULL DEFAULT 'article',
  parent_id INT NULL,
  content TEXT NOT NULL,
  created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
  edited_at DATETIME NULL,
  is_deleted TINYINT(1) DEFAULT 0,
  FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
) ENGINE=InnoDB CHARSET=utf8mb4;

Example (safe) auth pattern in PHP/PDO: use prepared statements and PHP's password API.

$hash = password_hash($password, PASSWORD_DEFAULT);
$stmt = $pdo->prepare('INSERT INTO users (username,email,password_hash) VALUES (?,?,?)');
$stmt->execute([$username,$email,$hash]);

// login
$stmt = $pdo->prepare('SELECT id,password_hash,role FROM users WHERE username = ?');
$stmt->execute([$username]);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
if ($row && password_verify($password,$row['password_hash'])) {
    session_start();
    session_regenerate_id(true);
    $_SESSION['user_id'] = $row['id'];
    $_SESSION['role'] = $row['role'];
}

Practical checklist and tips: always use prepared statements; escape or sanitize post output to prevent XSS (whitelist HTML if needed); protect forms with CSRF tokens; implement email verification and time-limited reset tokens; log moderation actions; prefer soft-deletes (is_deleted) so posts can be reviewed; enforce role checks server-side for admin actions. Start small: implement registration/login, then profile pages, then wall posts, then admin moderation. If the goal is to move faster, consider mature forum packages rather than coding everything from scratch.

Recommended Answers

All 8 Replies

I assume you want to use a database? A login page is basically a form, which submits to a script that does the actual validation. If successful, it can set a session or cookie to allow access to other pages. If you look in the PHP forum, am sure you'll find some login examples, just to get an idea. Although some things depend on the language you will be using.

I am planning on using only html and javascript. Maby a bit of C# or Java. I just am not sure by using C# / Java that my webpage will be comaptible on all browsers e.g. VBScript only runs in IE. If it will run on all major web browsers, then i might implement it, otherwise it is just javascript and ofcourse html+css for the layout

Login should only ever be done server-side with something like PHP. Anyone know if C# can work with ASP?

Anyone know if C# can work with ASP?

ASP.NET

Personally, I'd use only html, css, php and mysql, I'm biased because they are the languages I know, but
they are reasonably easy to learn and forums etc are plentiful.

ASP.NET

Right.. I'm not familiar with ASP and all of that, I just knew there was some sort of connection with .NET and ASP somwehere... I'd better have a read-up.

Personally, I'd use only html, css, php and mysql

I'm in the same boat... Quick and straight-forward to learn. Javascript can be useful, but I've only ever really needed it to hide and show some window-like elements on some of my pages.

ASP and ASP.NET are not similar except for the three characters in the name. Actually ASP and PHP are more similar.

Basic ASP.NET is easy to learn and Visual Studio helps with the development, but I recommend if you go down the ASP.NET/C# route, that you get some good books and other resources and get a good understanding before you begin your project.

If you are just starting to learn server side scripting, you may want to also look at PHP. I'm not strong on PHP because for years I've been tinkering with ASP.NET, but I do see the value in going the PHP route.

Member Avatar for Member #895185

php will work out very well, its easy to learn. I have never attempted other languages like c# bt im sure php coupled with mysql will do a great job for you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.