Jump to content

Simple MySQL based forum script with register/login?


Xoom3r

Recommended Posts

But by what I do understand is this:

  • Create a login/register script. Action: insert user data into database (username, password, email)
  • Create Post topic page. Action: insert thread data into database (Thread ID, Thread title, who wrote it, date)
  • Create INDEX page. Action: Shows listing of Thread ID and Title, who wrote, Date wrote, last reply.
  • And lotsa bunch of stuff like private messages ect.

Well think you will have to do some reading then. You can accomplish what you want with simple login script and sessions or cookies and a MySQL database. Just look for a php login script.

 

here is a sample of one I have used in the past. It is called auth.php and this is where your login form would be pointed to after the user enters his/her information.

<?php
session_start();
  if((!$_POST['username']) or (!$_POST['password'])){
  header("Location:login.php");
  exit();
  }
  $username= $_POST['username'];
  $password= md5($_POST['password']);
  // get mysql variables
  require('config.php');
  // connect to mysql
  include('includes/mysql.php');
  $sql = "select * from users where username='$username' and password = '$password'";
  $rs = mysql_query($sql) or die(mysql_error());
  $match = mysql_num_rows($rs);
  $userinfo = mysql_fetch_assoc($rs);
  if ($match != 0) {
  mysql_close($mysql_conn);
  $_SESSION['user_name'] = $userinfo['username'];
  $_SESSION['user_id'] = $userinfo['id'];
  header("Location:index.php");
  exit();
  } else {
  header("Location:loginhelp.php");
  exit();
  }
?>

 

Ray

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.