Jump to content

Looking for login script


Dyno

Recommended Posts

Hi, i'm looking for a Login Script Where On My Site i'll Have The Defualt Layout with Links on the left hand side.  But if someone logs in it will give them extra links that only logged in members can see. right now i have my site integrated with phpBB so when they login.  i'm just wondering if its easy to add extra links once there logged in.

 

Thanks

 

Dyno

Link to comment
Share on other sites

you want to use mysql create a table

 

users

-----------------

user_id

username

password

----------------

 

login.php
<?php

$username = $_POST['username'];
$password  = md5($_POST['password']);

$query = "SELECT username, password FROM users WHERE username = '".$username."' AND password = '".$password."'";

$result = mysql_result($query)
$count = mysql_num_rows($result);
$row    = mysql_fetch_array($result);

if ($count > 0)
{
     session_start();
     $_SESSION['username'] = $row['username'];
     $_SESSION['password']  = $row['password'];  
     $_SESSION['user_id']     = $row['user_id'];
}
else
{
      echo "Login details incorrect.<br \>\n";
}

?>

logout.php
<?php 

session_start();
unset($_SESSION['username']);
unset($_SESSION['password']);
unset($_SESSION['user_id']);
session_destroy();

?>

index.php
<?php

if (isset($_SESSION['username']) && isset($_SESSION['password']))
{
     echo "control panel here!<br />\n";
}

?>

 

this should work...just written it up now...very simple way of doing thinks which can be adapted upon..any problems give me a shout

 

Ricky

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.