how to automatically login after the user successfully completes registration.
now, the user after registration, need to enter username and password again to login. i don't want to enter username and password, he automatically loggged in after registration.
login.php
lock.php
now, the user after registration, need to enter username and password again to login. i don't want to enter username and password, he automatically loggged in after registration.
login.php
Code:
<?php
include("config.php");
session_start();
if($_SERVER["REQUEST_METHOD"] == "POST")
{
// username and password sent from form
/*$myusername= ucfirst ($_POST['uname']);
$mypass=($_POST ['password']);
$mypassword=md5($mypass);*/
$email = $_POST['email'];
$password = $_POST['password'];
$sql="SELECT * FROM member WHERE email='$email' and password='$password'";
$result=mysql_query($sql);
/*$row=mysql_fetch_array($result);
$active=$row['active'];*/
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1 and $email=="admin@reachmena.com")
{
session_register("admin");
$_SESSION['login_user']=$email;
header("location: admin.php");
}
else if($count==1)
{
session_register("email");
$_SESSION['login_user']=$email;
header("location: welcome_test.php");
}
else
{
$error="Your Login Name or Password is invalid";
}
}
?>
Code:
<?php
include('config.php');
session_start();
$user_check=$_SESSION['login_user'];
$ses_sql=mysql_query("select mname from member where email='$user_check' ");
$row=mysql_fetch_array($ses_sql);
$login_session=$row['mname'];
if(!isset($login_session))
{
header("Location:home.php");
}
?>
Comment