So I have a simple login form.I can enter username and password,submit the data to my script.The script checks if username and password are correct.
The question:
How do I start a session only if the data submitted is correct?
I don't want to have:
at the very top of my login.php,because even if the data is not correct,the form is still submited,so if I use:PHP Code:<?php
session_start();
$_SESSION['username'] = $_POST['username'];
$_SESSION['password'] = $_POST['password'];
?>
the user would still be logged in.PHP Code:<?php
session_start();
if(isset($_SESSION['username'])) {
if (isset($_SESSION['password']))
{




Reply With Quote