PhD thesis Appendix Source Code

Appendix: Source Code

10.1. Command to Create a new My SQL Database User
10.2. Config to connect to MySQL Database from PHP
10.3. Customer Table
10.4. View Customer Data
10.5. Enter Customer Data
10.6. Account Table
10.7. View Account Data
10.8. Enter Account Data
10.9. Balance Enquiry
10.10. Deposit Money
10.11. Withdraw Money
10.12. Business To Invest Table
10.13. Business Investment Info
10.14. Deposit Money to Business
10.15. Interest Earned from Business
10.16. Bank Menu

10.1. Command to Create a new My SQL Database User

CREATE USER ‘user1’@’localhost’ IDENTIFIED BY ‘Test678!’;

GRANT ALL PRIVILEGES ON *.* TO ‘user1’@’localhost’ WITH GRANT OPTION;

 

10.2. Config to connect to MySQL Database from PHP

File name: config.php

<?php
define(“DB_USER”, “user1“);
define(“DB_PASSWORD”, “Test678!“);
define(“DB_DATABASE”, “test”);
define(“DB_HOST”, “localhost”);
$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
?>

10.3. Customer Table

USE test;

CREATE TABLE Customer (

Customer_id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,

Customer_name VARCHAR(50),

SSN VARCHAR(15),

Gender VARCHAR(10),

Date_of_Birth VARCHAR(25),

Address VARCHAR(50),

City VARCHAR(25),

State VARCHAR(25),

PIN VARCHAR(25),

Mobile_Number VARCHAR(25),

Email VARCHAR(50),

Password VARCHAR(25)

) ENGINE = InnoDB;

 

10.4. View Customer Data

File name: Customer_landing_page.php

<form action=”” method=”post”>

<center><b><p style=”color:blue;font-size:30px”>Customer Info (View, Edit, Delete)</p></b></center>

<table style=”border:1px solid black;margin-left:auto;margin-right:auto;” border=1px border=solid border=black align=”Center”>

<tr>

<td><center><b><p style=”color:blue;font-size:20px”>Enter SSN to view Customer Details</p></b></center></td>

</tr>

<tr>

<td>SSN:<input type=”text” name=”SSN” id=”SSN”><br></td>

</tr>

<tr>

<td><center><button type=”submit” name=”customer”>Submit</button></center></td>

</tr>

</table>

</form>

<?php

if(isset($_POST[‘customer’]))

{

//echo $_POST[‘SSN’].”<br>”;

$url = “http://localhost/PhD_Dissertation_Project/View_Customer_Info/index.php?SSN=”.$_POST[‘SSN’];

header(“refresh: 0; url = “.$url);

}

?>

 

File name: delete.php

<?php

$LOG_PATH = “C:\wamp64\www\PhD_Dissertation_Project\View_Customer_Info\LOG”;

$myfile = fopen($LOG_PATH.”/log.txt”, “w”) or die(“Unable to open log.txt”);

//$myfile = fopen($LOG_PATH.”/log.txt”, “a”) or die(“Unable to open log.txt”);

fwrite($myfile, “delete.php\n”);

$data=$_GET[‘Customer_id_and_SSN’];

fwrite($myfile, “data = $data\n”);

$data_2 = preg_split(“/\,/”,$data);

$Customer_id = $data_2[0];

fwrite($myfile, “Customer_id = $Customer_id\n”);

$SSN = $data_2[1];

fwrite($myfile, “SSN = $SSN\n”);

include(‘config.php’);

$sql = “DELETE FROM Customer WHERE Customer_id=”.$Customer_id.” and SSN=’”.$SSN.”‘”;

fwrite($myfile, “sql = $sql\n”);

$mysqli->query($sql);

$url = “index.php?SSN=”.$SSN;

header(“refresh: 0; url = “.$url);

fclose($myfile);

?>

 

File name: index.php

<!DOCTYPE html>

<html>

<head>

<title>Customer Info</title>

<!– Latest compiled and minified CSS –>

<link rel=”stylesheet” href=”https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css”&gt;

https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js

https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js

<link href=”https://cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap3-editable/css/bootstrap-editable.css” rel=”stylesheet”/>

https://cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap3-editable/js/bootstrap-editable.min.js

</head>

<body>

<div class=”container”>

<h3>Customer Info (View, Edit, Delete)</h3>

<table class=”table table-bordered”>

<tr>

<th>Customer_id</th>

<th>Customer_name</th>

<th>SSN</th>

<th>Gender</th>

<th>Date_of_Birth</th>

<th>Address</th>

<th>City</th>

<th>State</th>

<th>PIN</th>

<th>Mobile_Number</th>

<th>Email</th>

<th>Password</th>

</tr>

<?php

require(‘config.php’);

$SSN=$_GET[‘SSN’];

$LOG_PATH = “C:\wamp64\www\PhD_Dissertation_Project\View_Customer_Info\LOG”;

$myfile = fopen($LOG_PATH.”/log.txt”, “w”) or die(“Unable to open log.txt”);

//$myfile = fopen($LOG_PATH.”/log.txt”, “a”) or die(“Unable to open log.txt”);

fwrite($myfile, “index.php\n”);

fwrite($myfile, “SSN = $SSN\n”);

$sql = “SELECT Customer_id,Customer_name,SSN,Gender,Date_of_Birth,Address,City,State,PIN,Mobile_Number,Email,Password FROM Customer where SSN=’”.$SSN.”‘”;

fwrite($myfile, “sql = $sql\n”);

$users = $mysqli->query($sql);

while($user = $users->fetch_assoc()){

?>

<tr>

<td><a href=”” class=”update” data-name=”Customer_id” data-type=”text” data-pk=”<?php echo $user[‘Customer_id’] ?>” data-title=”Edit Customer_id”><?php echo $user[‘Customer_id’] ?></a></td>

<td><a href=”” class=”update” data-name=”Customer_name” data-type=”text” data-pk=”<?php echo $user[‘Customer_id’] ?>” data-title=”Edit Customer_name”><?php echo $user[‘Customer_name’] ?></a></td>

<td><a href=”” class=”update” data-name=”SSN” data-type=”text” data-pk=”<?php echo $user[‘Customer_id’] ?>” data-title=”Edit SSN”><?php echo $user[‘SSN’] ?></a></td>

<td><a href=”” class=”update” data-name=”Gender” data-type=”text” data-pk=”<?php echo $user[‘Customer_id’] ?>” data-title=”Edit Gender”><?php echo $user[‘Gender’] ?></a></td>

<td><a href=”” class=”update” data-name=”Date_of_Birth” data-type=”text” data-pk=”<?php echo $user[‘Customer_id’] ?>” data-title=”Edit Date_of_Birth”><?php echo $user[‘Date_of_Birth’] ?></a></td>

<td><a href=”” class=”update” data-name=”Address” data-type=”text” data-pk=”<?php echo $user[‘Customer_id’] ?>” data-title=”Edit Address”><?php echo $user[‘Address’] ?></a></td>

<td><a href=”” class=”update” data-name=”City” data-type=”text” data-pk=”<?php echo $user[‘Customer_id’] ?>” data-title=”Edit City”><?php echo $user[‘City’] ?></a></td>

<td><a href=”” class=”update” data-name=”State” data-type=”text” data-pk=”<?php echo $user[‘Customer_id’] ?>” data-title=”Edit State”><?php echo $user[‘State’] ?></a></td>

<td><a href=”” class=”update” data-name=”PIN” data-type=”text” data-pk=”<?php echo $user[‘Customer_id’] ?>” data-title=”Edit PIN”><?php echo $user[‘PIN’] ?></a></td>

<td><a href=”” class=”update” data-name=”Mobile_Number” data-type=”text” data-pk=”<?php echo $user[‘Customer_id’] ?>” data-title=”Edit Mobile_Number”><?php echo $user[‘Mobile_Number’] ?></a></td>

<td><a href=”” class=”update” data-name=”Email” data-type=”text” data-pk=”<?php echo $user[‘Customer_id’] ?>” data-title=”Edit Email”><?php echo $user[‘Email’] ?></a></td>

<td><a href=”” class=”update” data-name=”Password” data-type=”text” data-pk=”<?php echo $user[‘Customer_id’] ?>” data-title=”Edit Password”><?php echo $user[‘Password’] ?></a></td>

<td><a href=”delete.php?Customer_id_and_SSN=<?php echo $user[‘Customer_id’].”,”.$SSN; ?>”>Delete</a></td>

</tr>

<?php }

?>

</table>

</div> <!– container / end –>

</body>

<script type=”text/javascript”>

$(‘.update’).editable({

url: ‘update.php’,

type: ‘text’,

pk: 1,

name: ‘Customer_name’,

title: ‘Enter Customer_name’

});

</script>

</html>

 

File name: update.php

<?php

require(‘config.php’);

$LOG_PATH = “C:\wamp64\www\PhD_Dissertation_Project\View_Customer_Info\LOG”;

$myfile = fopen($LOG_PATH.”/log.txt”, “w”) or die(“Unable to open log.txt”);

//$myfile = fopen($LOG_PATH.”/log.txt”, “a”) or die(“Unable to open log.txt”);

fwrite($myfile, “update.php\n”);

if(isset($_POST)){

$sql = “UPDATE Customer SET “.$_POST[‘name’].”=’”.$_POST[‘value’].”‘ WHERE Customer_id=”.$_POST[‘pk’];

fwrite($myfile, “sql = $sql\n”);

$mysqli->query($sql);

echo ‘Updated successfully.’;

}

fclose($myfile);

?>

 

10.5. Enter Customer Data

File name: Enter_Customer_Info.php

<form action=”” method=”post”>

<center><b><p style=”color:blue;font-size:30px”>Customer Info Entry form</p></b></center>

<table style=”border:1px solid black;margin-left:auto;margin-right:auto;” border=1px border=solid border=black align=”Center”>

<tr>

<td><center><b><p style=”color:blue;font-size:20px”>Enter Customer Info</p></b></center></td>

</tr>

<tr>

<td>Customer_name:<input type=”text” name=”Customer_name” id=”Customer_name”><br></td>

</tr>

<tr>

<td>SSN:<input type=”text” name=”SSN” id=”SSN”><br></td>

</tr>

<tr>

<td>Gender:<input type=”text” name=”Gender” id=”Gender”><br></td>

</tr>

<tr>

<td>PIN:<input type=”password” name=”PIN” id=”PIN”><br></td>

</tr>

<tr>

<td>Show PIN:<input type=”checkbox” onclick=”myFunction(‘PIN’)”><br></td>

</tr>

<tr>

<td>Password:<input type=”password” name=”Password” id=”Password”><br></td>

</tr>

<tr>

<td>Show Password:<input type=”checkbox” onclick=”myFunction(‘Password’)”><br></td>

</tr>

<tr>

<td>Date_of_Birth:<input type=”text” name=”Date_of_Birth” id=”Date_of_Birth”><br></td>

</tr>

<tr>

<td>Address:<input type=”text” name=”Address” id=”Address”><br></td>

</tr>

<tr>

<td>City:<input type=”City” name=”City” id=”City”><br></td>

</tr>

<tr>

<td>State:<input type=”text” name=”State” id=State><br></td>

</tr>

<tr>

<td>Mobile_Number:<input type=”text” name=”Mobile_Number” id=”Mobile_Number”><br></td>

</tr>

<tr>

<td>Email:<input type=”text” name=”Email” id=”Email”><br></td>

</tr>

<tr>

<td><center><button type=”submit” name=”customer”>Submit</button></center></td>

</tr>

</table>

</form>

<?php

echo ‘<script type=”text/javascript”>’,

‘function myFunction(id) {‘,

‘var x = document.getElementById(id);’,

‘if (x.type === “password”) {‘,

‘ x.type = “text”;’,

‘ } else {‘,

‘ x.type = “password”;’,

‘ }’,

‘}’,

‘</script>’

;

if(isset($_POST[‘customer’]))

{

//echo $_POST[‘Customer_name’].”<br>”;

//echo $_POST[‘SSN’].”<br>”;

//echo $_POST[‘Gender’].”<br>”;

//echo $_POST[‘PIN’].”<br>”;

//echo $_POST[‘Password’].”<br>”;

//echo $_POST[‘Date_of_Birth’].”<br>”;

//echo $_POST[‘Address’].”<br>”;

//echo $_POST[‘City’].”<br>”;

//echo $_POST[‘State’].”<br>”;

//echo $_POST[‘Mobile_Number’].”<br>”;

//echo $_POST[‘Email’].”<br>”;

require(‘config.php’);

$sql = “INSERT INTO Customer (Customer_name,SSN,Gender,Date_of_Birth,Address,City,State,PIN,Password,Mobile_Number,Email) VALUES (‘$_POST[Customer_name]’,’$_POST[SSN]’,’$_POST[Gender]’,’$_POST[Date_of_Birth]’,’$_POST[Address]’,’$_POST[City]’,’$_POST[State]’,’$_POST[PIN]’,’$_POST[Password]’,’$_POST[Mobile_Number]’,’$_POST[Email]’)”;

$users = $mysqli->query($sql);

$mysqli -> close();

echo “Customer Info Inserted …”.”<br>”;

}

?>

 

10.6. Account Table

USE test;

CREATE TABLE Account (

Account_id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,

Customer_id VARCHAR(50),

Account_type VARCHAR(50),

SSN VARCHAR(15),

Initial_deposit VARCHAR(10)

) ENGINE = InnoDB;

 

10.7. View Account Data

File name: delete.php

<?php

$LOG_PATH = “C:\wamp64\www\PhD_Dissertation_Project\View_Account_Info\LOG”;

$myfile = fopen($LOG_PATH.”/log.txt”, “w”) or die(“Unable to open log.txt”);

//$myfile = fopen($LOG_PATH.”/log.txt”, “a”) or die(“Unable to open log.txt”);

fwrite($myfile, “delete.php\n”);

$data=$_GET[‘Customer_id_and_SSN’];

fwrite($myfile, “data = $data\n”);

$data_2 = preg_split(“/\,/”,$data);

$Account_id = $data_2[0];

fwrite($myfile, “Account_id = $Account_id\n”);

$SSN = $data_2[1];

fwrite($myfile, “SSN = $SSN\n”);

include(‘config.php’);

$sql = “DELETE FROM Account WHERE Account_id=”.$Account_id.” and SSN=’”.$SSN.”‘”;

fwrite($myfile, “sql = $sql\n”);

$mysqli->query($sql);

$url = “index.php?SSN=”.$SSN;

header(“refresh: 0; url = “.$url);

fclose($myfile);

?>

 

File name: index.php

<!DOCTYPE html>

<html>

<head>

<title>Customer Info</title>

<!– Latest compiled and minified CSS –>

<link rel=”stylesheet” href=”https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css”&gt;

https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js

https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js

<link href=”https://cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap3-editable/css/bootstrap-editable.css” rel=”stylesheet”/>

https://cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap3-editable/js/bootstrap-editable.min.js

</head>

<body>

<div class=”container”>

<h3>Account Info (View, Edit, Delete)</h3>

<table class=”table table-bordered”>

<tr>

<th>Account_id</th>

<th>Customer_id</th>

<th>Account_type</th>

<th>SSN</th>

<th>Initial_deposit</th>

</tr>

<?php

require(‘config.php’);

$SSN=$_GET[‘SSN’];

$LOG_PATH = “C:\wamp64\www\PhD_Dissertation_Project\View_Account_Info\LOG”;

$myfile = fopen($LOG_PATH.”/log.txt”, “w”) or die(“Unable to open log.txt”);

//$myfile = fopen($LOG_PATH.”/log.txt”, “a”) or die(“Unable to open log.txt”);

fwrite($myfile, “index.php\n”);

fwrite($myfile, “SSN = $SSN\n”);

$sql = “SELECT Account_id,Customer_id,Account_type,SSN,Initial_deposit FROM Account where SSN=’”.$SSN.”‘”;

fwrite($myfile, “sql = $sql\n”);

$users = $mysqli->query($sql);

while($user = $users->fetch_assoc()){

?>

<tr>

<td><a href=”” class=”update” data-name=”Account_id” data-type=”text” data-pk=”<?php echo $user[‘Account_id’] ?>” data-title=”Edit Account_id”><?php echo $user[‘Account_id’] ?></a></td>

<td><a href=”” class=”update” data-name=”Customer_id” data-type=”text” data-pk=”<?php echo $user[‘Account_id’] ?>” data-title=”Edit Customer_id”><?php echo $user[‘Customer_id’] ?></a></td>

<td><a href=”” class=”update” data-name=”Account_type” data-type=”text” data-pk=”<?php echo $user[‘Account_id’] ?>” data-title=”Edit Account_type”><?php echo $user[‘Account_type’] ?></a></td>

<td><a href=”” class=”update” data-name=”SSN” data-type=”text” data-pk=”<?php echo $user[‘Account_id’] ?>” data-title=”Edit SSN”><?php echo $user[‘SSN’] ?></a></td>

<td><a href=”” class=”update” data-name=”Initial_deposit” data-type=”text” data-pk=”<?php echo $user[‘Account_id’] ?>” data-title=”Edit Initial_deposit”><?php echo $user[‘Initial_deposit’] ?></a></td>

<td><a href=”delete.php?Customer_id_and_SSN=<?php echo $user[‘Account_id’].”,”.$SSN; ?>”>Delete</a></td>

</tr>

<?php }

?>

</table>

</div> <!– container / end –>

</body>

<script type=”text/javascript”>

$(‘.update’).editable({

url: ‘update.php’,

type: ‘text’,

pk: 1,

name: ‘Customer_name’,

title: ‘Enter Customer_name’

});

</script>

</html>

 

File name: update.php

<?php

require(‘config.php’);

$LOG_PATH = “C:\wamp64\www\PhD_Dissertation_Project\View_Account_Info\LOG”;

$myfile = fopen($LOG_PATH.”/log.txt”, “w”) or die(“Unable to open log.txt”);

//$myfile = fopen($LOG_PATH.”/log.txt”, “a”) or die(“Unable to open log.txt”);

fwrite($myfile, “update.php\n”);

if(isset($_POST)){

$sql = “UPDATE Account SET “.$_POST[‘name’].”=’”.$_POST[‘value’].”‘ WHERE Account_id=”.$_POST[‘pk’];

fwrite($myfile, “sql = $sql\n”);

$mysqli->query($sql);

echo ‘Updated successfully.’;

}

fclose($myfile);

?>

 

File name: Account_landing_page.php

<form action=”” method=”post”>

<center><b><p style=”color:blue;font-size:30px”>Account Info (View, Edit, Delete)</p></b></center>

<table style=”border:1px solid black;margin-left:auto;margin-right:auto;” border=1px border=solid border=black align=”Center”>

<tr>

<td><center><b><p style=”color:blue;font-size:20px”>Enter SSN to view Account Details</p></b></center></td>

</tr>

<tr>

<td>SSN:<input type=”text” name=”SSN” id=”SSN”><br></td>

</tr>

<tr>

<td><center><button type=”submit” name=”customer”>Submit</button></center></td>

</tr>

</table>

</form>

<?php

if(isset($_POST[‘customer’]))

{

//echo $_POST[‘SSN’].”<br>”;

$url = “http://localhost/PhD_Dissertation_Project/View_Account_Info/index.php?SSN=”.$_POST[‘SSN’];

header(“refresh: 0; url = “.$url);

}

?>

 

10.8. Enter Account Data

File name: Enter_Account_Info.php

<form action=”” method=”post”>

<center><b><p style=”color:blue;font-size:30px”>Account Info Entry form</p></b></center>

<table style=”border:1px solid black;margin-left:auto;margin-right:auto;” border=1px border=solid border=black align=”Center”>

<tr>

<td><center><b><p style=”color:blue;font-size:20px”>Enter Account Info</p></b></center></td>

</tr>

<tr>

<td>Customer_id:<input type=”text” name=”Customer_id” id=”Customer_id”><br></td>

</tr>

<tr>

<td>Account_type:

<select name=”Account_type”>

<option value=”Checking”>Checking</option>

<option value=”Saving”>Saving</option>

</select>

</td>

<tr>

<td>SSN:<input type=”text” name=”SSN” id=”SSN”><br></td>

</tr>

<tr>

<td>Initial_deposit:<input type=”text” name=”Initial_deposit” id=”Initial_deposit”><br></td>

</tr>

<tr>

<td><center><button type=”submit” name=”account”>Submit</button></center></td>

</tr>

</table>

</form>

<?php

if(isset($_POST[‘account’]))

{

//echo $_POST[‘Customer_id’].”<br>”;

//echo $_POST[‘Account_type’].”<br>”;

//echo $_POST[‘SSN’].”<br>”;

//echo $_POST[‘Initial_deposit’].”<br>”;

require(‘config.php’);

$sql = “INSERT INTO account (Customer_id,Account_type,SSN,Initial_deposit) VALUES (‘$_POST[Customer_id]’,’$_POST[Account_type]’,’$_POST[SSN]’,’$_POST[Initial_deposit]’)”;

$users = $mysqli->query($sql);

$mysqli -> close();

echo “Account Info Inserted …”.”<br>”;

}

?>

 

10.9. Balance Enquiry

File name: Balance_Enquiry_landing_page.php

<form action=”” method=”post”>

<center><b><p style=”color:blue;font-size:30px”>Balance Enquiry</p></b></center>

<table style=”border:1px solid black;margin-left:auto;margin-right:auto;” border=1px border=solid border=black align=”Center”>

<tr>

<td><center><b><p style=”color:blue;font-size:20px”>Enter SSN to for Balance Enquiry</p></b></center></td>

</tr>

<tr>

<td>SSN:<input type=”text” name=”SSN” id=”SSN”><br></td>

</tr>

<tr>

<td><center><button type=”submit” name=”Balance_Enquiry”>Submit</button></center></td>

</tr>

</table>

</form>

<?php

if(isset($_POST[‘Balance_Enquiry’]))

{

//echo $_POST[‘SSN’].”<br>”;

$url = “http://localhost/PhD_Dissertation_Project/Balance_Enquiry/index.php?SSN=”.$_POST[‘SSN’];

header(“refresh: 0; url = “.$url);

}

?>

 

 

File name: index.php

<!DOCTYPE html>

<html>

<head>

<title>Balance Enquiry</title>

<!– Latest compiled and minified CSS –>

<link rel=”stylesheet” href=”https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css”&gt;

https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js

https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js

<link href=”https://cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap3-editable/css/bootstrap-editable.css” rel=”stylesheet”/>

https://cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap3-editable/js/bootstrap-editable.min.js

</head>

<body>

<div class=”container”>

<h3>Current Balance</h3>

<table class=”table table-bordered”>

<tr>

<th>Account_id</th>

<th>Customer_id</th>

<th>Account_type</th>

<th>SSN</th>

<th>Account Balance ($)</th>

</tr>

<?php

require(‘config.php’);

$SSN=$_GET[‘SSN’];

$LOG_PATH = “C:\wamp64\www\PhD_Dissertation_Project\Balance_Enquiry\LOG”;

$myfile = fopen($LOG_PATH.”/log.txt”, “w”) or die(“Unable to open log.txt”);

//$myfile = fopen($LOG_PATH.”/log.txt”, “a”) or die(“Unable to open log.txt”);

fwrite($myfile, “index.php\n”);

fwrite($myfile, “SSN = $SSN\n”);

$sql = “SELECT Account_id,Customer_id,Account_type,SSN,Initial_deposit FROM Account where SSN=’”.$SSN.”‘”;

fwrite($myfile, “sql = $sql\n”);

$users = $mysqli->query($sql);

while($user = $users->fetch_assoc()){

?>

<tr>

<td><a href=”” class=”update” data-name=”Account_id” data-type=”text” data-pk=”<?php echo $user[‘Account_id’] ?>” data-title=”Edit Account_id”><?php echo $user[‘Account_id’] ?></a></td>

<td><a href=”” class=”update” data-name=”Customer_id” data-type=”text” data-pk=”<?php echo $user[‘Account_id’] ?>” data-title=”Edit Customer_id”><?php echo $user[‘Customer_id’] ?></a></td>

<td><a href=”” class=”update” data-name=”Account_type” data-type=”text” data-pk=”<?php echo $user[‘Account_id’] ?>” data-title=”Edit Account_type”><?php echo $user[‘Account_type’] ?></a></td>

<td><a href=”” class=”update” data-name=”SSN” data-type=”text” data-pk=”<?php echo $user[‘Account_id’] ?>” data-title=”Edit SSN”><?php echo $user[‘SSN’] ?></a></td>

<td><a href=”” class=”update” data-name=”Initial_deposit” data-type=”text” data-pk=”<?php echo $user[‘Account_id’] ?>” data-title=”Edit Initial_deposit”><?php echo $user[‘Initial_deposit’] ?></a></td>

</tr>

<?php }

?>

</table>

</div> <!– container / end –>

</body>

</html>

 

10.10. Deposit Money

File name: Deposit.php

<form action=”” method=”post”>

<center><b><p style=”color:blue;font-size:30px”>Deposit Money form</p></b></center>

<table style=”border:1px solid black;margin-left:auto;margin-right:auto;” border=1px border=solid border=black align=”Center”>

<tr>

<td><center><b><p style=”color:blue;font-size:20px”>Enter ammount ($) to Deposit money</p></b></center></td>

</tr>

<tr>

<td>SSN:<input type=”text” name=”SSN” id=”SSN”><br></td>

</tr>

<tr>

<td>Deposit ammount($): <input type=”text” name=”Deposit_ammount” id=”Deposit_ammount”><br></td>

</tr>

<tr>

<td><center><button type=”submit” name=”account”>Submit</button></center></td>

</tr>

</table>

</form>

<?php

if(isset($_POST[‘account’]))

{

//echo $_POST[‘SSN’].”<br>”;

//echo $_POST[‘Deposit_ammount’].”<br>”;

require(‘config.php’);

$sql = “SELECT Account_id,Customer_id,Account_type,SSN,Initial_deposit FROM Account where SSN=’”.$_POST[‘SSN’].”‘”;

$users = $mysqli->query($sql);

$Initial_deposit_value;

while($user = $users->fetch_assoc())

{

//echo “Initial_deposit: “.$user[‘Initial_deposit’].”<br>”;

$Initial_deposit_value = $user[‘Initial_deposit’];

}

echo “Present Balance: “.$Initial_deposit_value.”<br>”;

$Deposit = $_POST[‘Deposit_ammount’] + $Initial_deposit_value;

//echo “Deposit ammount: “.$Deposit.”<br>”;

$sql = “UPDATE Account SET “.”Initial_deposit”.”=’”.$Deposit.”‘ WHERE SSN=”.$_POST[‘SSN’];

$users = $mysqli->query($sql);

$mysqli->close();

echo $_POST[‘Deposit_ammount’]. ” Deposited …”.”<br>”;

echo $Deposit. ” Current Balance …”.”<br>”;

}

?>

 

10.11. Withdraw Money

File name: Deposit.php

<form action=”” method=”post”>

<center><b><p style=”color:blue;font-size:30px”>Deposit Money form</p></b></center>

<table style=”border:1px solid black;margin-left:auto;margin-right:auto;” border=1px border=solid border=black align=”Center”>

<tr>

<td><center><b><p style=”color:blue;font-size:20px”>Enter ammount ($) to Deposit money</p></b></center></td>

</tr>

<tr>

<td>SSN:<input type=”text” name=”SSN” id=”SSN”><br></td>

</tr>

<tr>

<td>Deposit ammount($): <input type=”text” name=”Deposit_ammount” id=”Deposit_ammount”><br></td>

</tr>

<tr>

<td><center><button type=”submit” name=”account”>Submit</button></center></td>

</tr>

</table>

</form>

<?php

if(isset($_POST[‘account’]))

{

//echo $_POST[‘SSN’].”<br>”;

//echo $_POST[‘Deposit_ammount’].”<br>”;

require(‘config.php’);

$sql = “SELECT Account_id,Customer_id,Account_type,SSN,Initial_deposit FROM Account where SSN=’”.$_POST[‘SSN’].”‘”;

$users = $mysqli->query($sql);

$Initial_deposit_value;

while($user = $users->fetch_assoc())

{

//echo “Initial_deposit: “.$user[‘Initial_deposit’].”<br>”;

$Initial_deposit_value = $user[‘Initial_deposit’];

}

echo “Present Balance: “.$Initial_deposit_value.”<br>”;

$Deposit = $_POST[‘Deposit_ammount’] + $Initial_deposit_value;

//echo “Deposit ammount: “.$Deposit.”<br>”;

$sql = “UPDATE Account SET “.”Initial_deposit”.”=’”.$Deposit.”‘ WHERE SSN=”.$_POST[‘SSN’];

$users = $mysqli->query($sql);

$mysqli->close();

echo $_POST[‘Deposit_ammount’]. ” Deposited …”.”<br>”;

echo $Deposit. ” Current Balance …”.”<br>”;

}

?>

 

10.12. Business To Invest Table

USE test;

CREATE TABLE Business_To_Invest (

Row_id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,

SSN VARCHAR(15),

Month VARCHAR(15),

Year VARCHAR(15),

Ammount_To_Invest VARCHAR(15),

Fixed_Monthly_Interest_Rate VARCHAR(15)

) ENGINE = InnoDB;

 

10.13. Business Investment Info

File name: Business_To_Invest_Info_landing_page.php

<form action=”” method=”post”>

<center><b><p style=”color:blue;font-size:30px”>Business To Invest Info</p></b></center>

<table style=”border:1px solid black;margin-left:auto;margin-right:auto;” border=1px border=solid border=black align=”Center”>

<tr>

<td><center><b><p style=”color:blue;font-size:20px”>Enter SSN to see Business To Invest Info</p></b></center></td>

</tr>

<tr>

<td>SSN:<input type=”text” name=”SSN” id=”SSN”><br></td>

</tr>

<tr>

<td><center><button type=”submit” name=”Business_To_Invest_Info”>Submit</button></center></td>

</tr>

</table>

</form>

<?php

if(isset($_POST[‘Business_To_Invest_Info’]))

{

//echo $_POST[‘SSN’].”<br>”;

$url = “http://localhost/PhD_Dissertation_Project/View_Business_To_Invest_Info/index.php?SSN=”.$_POST[‘SSN’];

header(“refresh: 0; url = “.$url);

}

?>

 

File name: index.php

<!DOCTYPE html>

<html>

<head>

<title>Business To Invest Info</title>

<!– Latest compiled and minified CSS –>

<link rel=”stylesheet” href=”https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css”&gt;

https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js

https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js

<link href=”https://cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap3-editable/css/bootstrap-editable.css” rel=”stylesheet”/>

https://cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap3-editable/js/bootstrap-editable.min.js

</head>

<body>

<div class=”container”>

<h3>Money Invested in Business</h3>

<table class=”table table-bordered”>

<tr>

<th>Row_id</th>

<th>SSN</th>

<th>Month</th>

<th>Year</th>

<th>Ammount_To_Invest</th>

<th>Fixed_Monthly_Interest_Rate (%)</th>

</tr>

<?php

require(‘config.php’);

$SSN=$_GET[‘SSN’];

$LOG_PATH = “C:\wamp64\www\PhD_Dissertation_Project\View_Business_To_Invest_Info\LOG”;

$myfile = fopen($LOG_PATH.”/log.txt”, “w”) or die(“Unable to open log.txt”);

//$myfile = fopen($LOG_PATH.”/log.txt”, “a”) or die(“Unable to open log.txt”);

fwrite($myfile, “index.php\n”);

fwrite($myfile, “SSN = $SSN\n”);

$sql = “SELECT Row_id,SSN,Month,Year,Ammount_To_Invest,Fixed_Monthly_Interest_Rate FROM Business_To_Invest where SSN=’”.$SSN.”‘”;

fwrite($myfile, “sql = $sql\n”);

$users = $mysqli->query($sql);

while($user = $users->fetch_assoc()){

?>

<tr>

<td><a href=”” class=”update” data-name=”Row_id” data-type=”text” data-pk=”<?php echo $user[‘Row_id’] ?>” data-title=”Edit Row_id”><?php echo $user[‘Row_id’] ?></a></td>

<td><a href=”” class=”update” data-name=”SSN” data-type=”text” data-pk=”<?php echo $user[‘Row_id’] ?>” data-title=”Edit SSN”><?php echo $user[‘SSN’] ?></a></td>

<td><a href=”” class=”update” data-name=”Month” data-type=”text” data-pk=”<?php echo $user[‘Row_id’] ?>” data-title=”Edit Month”><?php echo $user[‘Month’] ?></a></td>

<td><a href=”” class=”update” data-name=”Year” data-type=”text” data-pk=”<?php echo $user[‘Row_id’] ?>” data-title=”Edit Customer_id”><?php echo $user[‘Year’] ?></a></td>

<td><a href=”” class=”update” data-name=”Ammount_To_Invest” data-type=”text” data-pk=”<?php echo $user[‘Row_id’] ?>” data-title=”Edit Ammount_To_Invest”><?php echo $user[‘Ammount_To_Invest’] ?></a></td>

<td><a href=”” class=”update” data-name=”Fixed_Monthly_Interest_Rate” data-type=”text” data-pk=”<?php echo $user[‘Row_id’] ?>” data-title=”Edit Fixed_Monthly_Interest_Rate”><?php echo $user[‘Fixed_Monthly_Interest_Rate’] ?></a></td>

</tr>

<?php }

?>

</table>

</div> <!– container / end –>

 

</body>

</html>

 

10.14. Deposit Money to Business

File name: Enter_Business_To_Invest.php

 

 

<form action=”” method=”post”>

<center><b><p style=”color:blue;font-size:30px”>Business To Invest Entry form</p></b></center>

<table style=”border:1px solid black;margin-left:auto;margin-right:auto;” border=1px border=solid border=black align=”Center”>

<tr>

<td><center><b><p style=”color:blue;font-size:20px”>Enter Business To Invest Info</p></b></center></td>

</tr>

<tr>

<td>SSN:<input type=”text” name=”SSN” id=”SSN”><br></td>

</tr>

<tr>

<td>Month:

<select name=”Month”>

<option value=”January”>January</option>

<option value=”February”>February</option>

<option value=”March”>March</option>

<option value=”April”>April</option>

<option value=”May”>May</option>

<option value=”June”>June</option>

<option value=”July”>July</option>

<option value=”August”>August</option>

<option value=”September”>September</option>

<option value=”October”>October</option>

<option value=”November”>November</option>

<option value=”December”>December</option>

</select>

</td>

<tr>

<td>Year:

<select name=”Year”>

<option value=”2023″>2023</option>

<option value=”2024″>2024</option>

<option value=”2025″>2025</option>

<option value=”2026″>2026</option>

<option value=”2027″>2027</option>

</select>

</td>

<tr>

<td>Ammount_To_Invest:<input type=”text” name=”Ammount_To_Invest” id=”Ammount_To_Invest”><br></td>

</tr>

<tr>

<td>Fixed_Monthly_Interest_Rate (%):<input type=”text” name=”Fixed_Monthly_Interest_Rate” id=”Fixed_Monthly_Interest_Rate” value=”3″><br></td>

</tr>

<tr>

<td><center><button type=”submit” name=”account”>Submit</button></center></td>

</tr>

</table>

</form>

<?php

if(isset($_POST[‘account’]))

{

//echo $_POST[‘SSN’].”<br>”;

//echo $_POST[‘Month’].”<br>”;

//echo $_POST[‘Year’].”<br>”;

//echo $_POST[‘Ammount_To_Invest’].”<br>”;

//echo $_POST[‘Fixed_Monthly_Interest_Rate’].”<br>”;

require(‘config.php’);

$sql = “INSERT INTO Business_To_Invest (SSN,Month,Year,Ammount_To_Invest,Fixed_Monthly_Interest_Rate) VALUES (‘$_POST[SSN]’,’$_POST[Month]’,’$_POST[Year]’,’$_POST[Ammount_To_Invest]’,’$_POST[Fixed_Monthly_Interest_Rate]’)”;

$users = $mysqli->query($sql);

$mysqli -> close();

echo “Business To Invest Info Inserted …”.”<br>”;

}

?>

 

10.15. Interest Earned from Business

File name: View_Total_Interest_Earned.php

<form action=”” method=”post”>

<center><b><p style=”color:blue;font-size:30px”>View Total Interest Earned from Business</p></b></center>

<table style=”border:1px solid black;margin-left:auto;margin-right:auto;” border=1px border=solid border=black align=”Center”>

<tr>

<td><center><b><p style=”color:blue;font-size:20px”>Enter SSN to see Total Interest Earned</p></b></center></td>

</tr>

<tr>

<td>SSN:<input type=”text” name=”SSN” id=”SSN”><br></td>

</tr>

<tr>

<td><center><button type=”submit” name=”Total_Interest_Earned”>Submit</button></center></td>

</tr>

</table>

</form>

<?php

if(isset($_POST[‘Total_Interest_Earned’]))

{

echo “SSN: “.$_POST[‘SSN’].”<br><br><br>”;

require(‘config.php’);

$sql = “SELECT Row_id,SSN,Month,Year,Ammount_To_Invest,Fixed_Monthly_Interest_Rate FROM Business_To_Invest where SSN=’”.$_POST[‘SSN’].”‘”;

$users = $mysqli->query($sql);

$Total_Ammount_Invested = 0;

$Month_Count = 0;

$Fixed_Monthly_Interest_Rate;

echo “****************************************************************”.”<br>”;

echo “<p style=\”color:blue;font-size:100%;\”>”.”Row_id, SSN, Year, Ammount Invested ($), Fixed Monthly Interest Rate (%)”.”</p>”;

while($user = $users->fetch_assoc())

{

echo $user[‘Row_id’].”, “.$user[‘SSN’].”, “.$user[‘Month’].”, “.$user[‘Year’].”, “.$user[‘Ammount_To_Invest’].”, “.$user[‘Fixed_Monthly_Interest_Rate’].”<br>”;

$Fixed_Monthly_Interest_Rate = $user[‘Fixed_Monthly_Interest_Rate’];

$Total_Ammount_Invested = $user[‘Ammount_To_Invest’] + $Total_Ammount_Invested;

$Month_Count = $Month_Count + 1;

}

$mysqli->close();

echo “****************************************************************”.”<br>”;

echo “<br><br><br>”;

echo “Total Ammount Invested: “.$Total_Ammount_Invested.”<br>”;

echo “Fixed Monthly Interest Rate (%): “.$Fixed_Monthly_Interest_Rate.”<br>”;

echo “Total Month Count: “.$Month_Count.”<br>”;

$Total_Interest_Earned = ($Total_Ammount_Invested/$Month_Count)*($Fixed_Monthly_Interest_Rate/100)*$Month_Count;

echo “<br>”;

echo “<p style=\”color:red;font-size:210%;\”>”.”Total Interest Earned from Business in “.$Month_Count.” Months = $”.$Total_Interest_Earned.”</p>”.”<br>”;

}

?>

 

10.16. Bank Menu

File Name: left_frame.html

<!DOCTYPE html>
<html>
<head>
<link rel = “stylesheet” href = “HTML_Style_Sheets.css”>
</head>
<body>
<h2 style=”background-color:yellow;font-family:verdana;font-size:230%;”>Mini-Banking System</h2>
<p><a href = “http://localhost/PhD_Dissertation_Project/View_Customer_Info/Customer_landing_page.php” target = “right” style=”background-color:powderblue;font-family:verdana;font-size:170%;”> View Customer Data </a></p>
<p><a href = “http://localhost/PhD_Dissertation_Project/Enter_Customer_Info/Enter_Customer_Info.php” target = “right” style=”background-color:powderblue;font-family:verdana;font-size:170%;”> Enter Customer Data </a></p>
<p><a href = “http://localhost/PhD_Dissertation_Project/View_Account_Info/Account_landing_page.php” target = “right” style=”background-color:powderblue;font-family:verdana;font-size:170%;”> View Account Data </a></p>
<p><a href = “http://localhost/PhD_Dissertation_Project/Enter_Account_Info/Enter_Account_Info.php” target = “right” style=”background-color:powderblue;font-family:verdana;font-size:170%;”> Enter Account Data </a></p>
<p><a href = “http://localhost/PhD_Dissertation_Project/Balance_Enquiry/Balance_Enquiry_landing_page.php” target = “right” style=”background-color:powderblue;font-family:verdana;font-size:170%;”> Balance Enquiry </a></p>
<p><a href = “http://localhost/PhD_Dissertation_Project/Deposit/Deposit.php” target = “right” style=”background-color:powderblue;font-family:verdana;font-size:170%;”> Deposit Money </a></p>
<p><a href = “http://localhost/PhD_Dissertation_Project/Withdrawal/Withdrawal.php” target = “right” style=”background-color:powderblue;font-family:verdana;font-size:170%;”> Withdraw Money </a></p>
<p><a href = “http://localhost/PhD_Dissertation_Project/View_Business_To_Invest_Info/Business_To_Invest_Info_landing_page.php” target = “right” style=”background-color:powderblue;font-family:verdana;font-size:170%;”> Business Investment Info </a></p>
<p><a href = “http://localhost/PhD_Dissertation_Project/Enter_Business_To_Invest/Enter_Business_To_Invest.php” target = “right” style=”background-color:powderblue;font-family:verdana;font-size:170%;”> Deposit Money to Business </a></p>
<p><a href = “http://localhost/PhD_Dissertation_Project/View_Total_Interest_Earned/View_Total_Interest_Earned.php” target = “right” style=”background-color:powderblue;font-family:verdana;font-size:170%;”> Interest Earned from Business </a></p>
</body>
</html>

 

File Name: Bank_Menu.html

<!DOCTYPE html>
<html>
<head>
<title> Mini Bank System </title>
</head>
<frameset cols = “35%,65%”>
<frame src = “left_frame.html” name=”left”>
<frame name=”right”>
</frameset>
</html>

 

File Name: HTML_Style_Sheets.css

body{
background-color: white;
color:brown;
font-family: arial;
font-size: 100%;
margin: 0px;
padding: 0px;
/*background-image: url(image.gif);*/
background-repeat: repeat-x;
}
div.noclass {
border: 0px solid #003B62;
}
div{
border: 1px solid #003B62;
/*font-family: verdana;*/
font-family: arial;
background-color: white;
/*font-size: 14px;*/
font-size: 15px;
padding: 5px 5px 20px 15px;
position : relative;
text-align: left;
overflow: auto;
/*height: 350px;*/
/*width: 95%;*/
}
div#column1tophalf {
overflow-y : scroll;
height: 24%;
}
div#column1bottomhalf {
overflow-y : scroll;
height: 73%;
}
div#column2{
/* 300 + 600 + 2*2 + 2*10 */
height: 50%;
overflow-y : scroll;
/*overflow-x : scroll;*/
}
div#display{
border: 1px solid #003B62;
}
table.main{
background-color: white;
color:black;
/* border:2px solid black;*/
padding: 0px;
width: 100%;
}
td{
background-repeat: repeat-x;
/*border:2px solid black;*/
/*padding: 2px;*/
/*margin: 0px;*/
/*height: 924px;*/
/*height: 25px;*/
}
td#menu{
width: 225px;
}
td#column2{
/*width: 1250px;*/
}
pre{
/*font-size: 16px;*/
font-size: 15px;
/* These are required to break lines in pre */
white-space:pre-wrap;
white-space:-moz-pre-wrap;
white-space:-pre-wrap;
white-space:-o-pre-wrap;
word-wrap:break-word;
}
a:link{
font-size:100%;
/*font-size: 12px;*/
text-decoration: underline;
font-weight: 540;
/*color:blue;*/
color:black;
}
a:visited {color:brown;}
a:hover{
text-decoration: none;
/*color: #C02020;*/
color: black;
text-decoration: underline;
word-spacing: 0px;
font-weight: 600;
}
h1{
background-color: #BEC5D8;
/*border-bottom: 1px solid #003B62;*/
/*padding: 3px;*/
/*border-bottom: 4px double black;*/
font-size: 100%;
}