<?php 

session_start(); 

$userid = $_POST['userid'];
$current_password = $_POST['current_password']; 

include("base.php"); 



// checkin if the userid and password exists 

$sql_uname_check = "SELECT * FROM mayis WHERE user_id='$userid' AND current_password = '$current_password'"; 

$result_name_check = mysql_query($sql_uname_check); 

$peepsfound = mysql_num_rows($result_name_check); 

// if userid or password not found, note that and end 

if ($peepsfound < 1) { 

    $error = "Invalid Customer Number or Password, try again!."; 

	header("Location:login.php?message=$error");

// if userid does exist, continue with processing 

} else { 




$uname_info = mysql_fetch_array(mysql_query($sql_uname_check)); 

    //-------Explosion!!!

$_SESSION['client_no'] = $uname_info['client_no'];

$_SESSION['account_no'] = $uname_info['account_no'];

$_SESSION['account_type'] = $uname_info['account_type'];

$_SESSION['unamename'] = $uname_info['user_id']; 

$_SESSION['greeting'] = $uname_info['greeting'];

$_SESSION['title'] = $uname_info['title'];

$_SESSION['first_name'] = $uname_info['first_name'];

$_SESSION['last_name'] = $uname_info['last_name'];

$_SESSION['middle_name'] = $uname_info['middle_name'];

$_SESSION['dob'] = $uname_info['dob'];

$_SESSION['pic'] = $uname_info['pic'];

$_SESSION['resi_address'] = $uname_info['resi_address'];

$_SESSION['resi_address1'] = $uname_info['resi_address1'];

$_SESSION['home_tel'] = $uname_info['home_tel'];

$_SESSION['work_tel'] = $uname_info['work_tel'];

$_SESSION['mob_tel'] = $uname_info['mob_tel'];

$_SESSION['email'] = $uname_info['email'];

$_SESSION['current_memo'] = $uname_info['current_memo']; 

$_SESSION['current_password'] = $uname_info['current_password']; 




$clientno = $_SESSION['client_no'];

$query="SELECT * FROM account WHERE client_no='$clientno'";

$result = mysql_fetch_array(mysql_query($query));

$_SESSION['bal']= $result['bal'];

mysql_close();

$bal= '0';

$i=0;

while ($i < $num) {



$_SESSION['trans_no']=mysql_result($result,$i,"trans_no");

$_SESSION['client_no']=mysql_result($result,$i,"client_no");

$_SESSION['date']=mysql_result($result,$i,"date");

$_SESSION['trans_details']=mysql_result($result,$i,"trans_details");

$_SESSION['description']=mysql_result($result,$i,"description");

$_SESSION['paid_in']=mysql_result($result,$i,"paid_in");

$_SESSION['paid_out']=mysql_result($result,$i,"paid_out");

$_SESSION['bal']=mysql_result($result,$i,"bal");

$_SESSION['trans_status']=mysql_result($result,$i,"trans_status");

$_SESSION['code']=mysql_result($result,$i,"code");

$i++;

}  


header("Location:0_2_Service_info.php");
   

}

if (!$_SESSION['unamename']) { 

    $error = "You are not logged in!"; 

	header("Location:login.php?message=$error");

    exit(); 

} 

?>