3
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by Rakesh Nagekar
0

What is done in login page is:

You just compare your typed name and password with database name and password,
if they are correct ,then you just put them in sessions like:

session_unregister(user_name);
session_register(user_name);
$_SESSION['user_name'];

Then you can use them where ever you want...

please reffer some session materials by googling...

0

why do you use session_register(). i thought it was depreciated.

just set your user id into a session.
here is some sample code

if (isset($_POST['submit'])) {
  $user = mysql_real_escape_string($_POST['user']);
  $pass = mysql_real_escape_string($_POST['pass']);
  $sql = "SELECT * FROM `tablename` WHERE `username` = '{$user}' AND `password` = '{$pass}'";
  $query = mysql_query($sql);
  $total = mysql_num_rows($query);
  if ($total > 0) {
    $res = mysql_fetch_assoc($query);
    $_SESSION['member'] = $res['id'];
    header('Location: the/members/page.php');
  }
  else {
     echo 'User name and/or password incorrect';
  }
}
0

Than u keith, for giving the valuable information
can u please tell me abt the blogs in PHP and how to program


Thank u

Rakesh Nagekar

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.