<?php 
session_start();
// Connect to the database
require_once('dbconnect.php'); 

// Set username and password variables for this script
$icode = $_POST['icode'];
 

// Make sure the username and password match, selecting all the client's
// data from the database if it does. Store the data into $clientdata
$clientdata = mysql_query("SELECT * FROM bill WHERE icode = '$icode'") or die (mysql_error());

// Put the $clientdata query into an array we can work with
$data = mysql_fetch_array($clientdata, MYSQL_ASSOC);

// If the username and password matched, we should have one entry in our
// $clientdata array. If not, we should have 0. So, we can use a simple
// if/else statement
if(mysql_num_rows($clientdata) == 1){
	// Start a new blank session. This will assign the user's server
	// with a session with an idividual ID
		header('Location: cbdtransferingic.php');
}
else
{
session_regenerate_id();
	$_SESSION['SESS_ICERRMSG'] = "Invalid Funds Insurance Code";
	session_write_close();
	header('location: cbdtransfericverification.php');
	}
			
?>