Session notice
You have a session starting somewhere, and then again in C:\xampp\htdocs\bank\header.php
's second line. You should do if PHP >= 5.4.0:
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
If PHP < 5.4.0:
if(session_id() == '') {
session_start();
}
This can be seen here: Check if PHP session has already started.
Undefined index and other issues
However, your code has the following issues:
- It is subject to SQL injection.
mysql_*
is not secure anymore. You should be using PDO or MySQLi for the database handling.
- Are you seriously storing passwords in the database as plain text? You need to properly hash them.
Fixing it (PHP >= 5.5):
$DB = new PDO(/* CORRECT PARAMETERS HERE */);
if (isset($_POST['login']) && isset($_POST['password'])) {
$STH = $DB->prepare("SELECT * FROM customers WHERE loginid = ?");
$STH->execute(array($_POST['login']));
$Result = $STH->fetch();
if(password_verify($_POST['password'], $Result['password'])) {
/* Do what you need to do */
}
}
For PHP <= 5.5, you need to add a library for using if(password_verify(...))
. Check password_compat library for more info, but it's basically this:
include "password_compat.php";
$DB = new PDO(/* CORRECT PARAMETERS HERE */);
if (isset($_POST['login']) && isset($_POST['password'])) {
$STH = $DB->prepare("SELECT * FROM customers WHERE loginid = ?");
$STH->execute(array($_POST['login']));
$Result = $STH->fetch();
if(password_verify($_POST['password'], $Result['password'])) {
/* Do what you need to do */
}
}