<?php
$MySQLdb = new PDO("mysql:host=127.0.0.1;dbname=live", "root", "");
$MySQLdb->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
session_start();
$user = $_SESSION["username"];
if(!isset($_SESSION["username"])){
header("location:index.php");
}else{
header('HTTP/1.1 200 OK', true, 200);
}
$cursor = $MySQLdb->prepare("SELECT * FROM users WHERE username=:username");
$cursor->execute( array(":username"=>$_SESSION["username"]) );
if($row = $cursor->fetch()){
$money = $row["money"];
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>or-bank</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="./assets/css/bootstrap.min.css">
<link rel="stylesheet" href="./assets/css/custom.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="./assets/js/bootstrap.min.js"></script>
</head>
<style>
#name{
wi
}
</style>
<body>
<link rel="icon" href="fbi.png" type="image/gif" sizes="16x16">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">FORUM</a>
</div>
<ul class="nav navbar-nav" style="float: right">
<li><a href="profile.php" id="logout">Profile</a></li>
<li><a href="MoneyT.php" id="logout">Money Transfer</a></li>
<li><a href="logout.php" id="logout">Logout</a></li>
</ul>
</div>
</nav>
<div class="container">
<div class="row" id="page" hidden>
<div class="col-md-3">
<div class="panel panel-default">
<div class="panel-heading"><h4>Account Info</h4></div>
<div class="panel-body">
<ul class="list-group">
<li class="list-group-item">
<p>
<kbd>username:</kbd>
<span style="float:right;">
<?php echo $user; ?>
</span>
</p>
</li>
<li class="list-group-item">
<p>
<kbd>ip address</kbd>
<span style="float:right;">
<?php echo $_SERVER["REMOTE_ADDR"];?>
</span>
</p>
</li>
</ul>
</div>
</div>
</div>
<div class="col-md-3">
<div class="panel panel-default">
<div class="panel-heading">
<h4>money Transfer system test<><h4>
</div>
<kbd>your balance is:<?php echo $money?>$</kbd>
<style>
input[type=text], select {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
input[type=submit] {
width: 100%;
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type=submit]:hover {
background-color: #45a049;
}
div {
border-radius: 5px;
background-color: #f2f2f2;
padding: 0px;
}
</style>
<br>
<div>
<br>
<label for="fname">how much?:</label>
<input type="text" id="inp" name="firstname" placeholder="number">
<label for="country">To:</label>
<select id="country" name="country">
<option value="australia">user1</option>
<option value="canada">user2</option>
<option value="usa">user3</option>
</select>
<button id="btn">click me!</button>
</div>
<p>
<input type="text" id="change_Addres_inp10"><button id="change_name_btn40" type="button" class="btn btn-primary">Change money</button>
</div>
</p>
<script>
$.post("api.php",{"action":"get_all"},function(data){
console.log(data[0].username);
});
$("#change_name_btn40").click(function(){
$.post("api.php",{"action":"change_money","new_money":$("#change_Addres_inp10").val()},function(data){
if(data.success == "true"){
$("#MSG").html('<div class="alert alert-success"><strong>success:'+data.data+'</strong></div>').fadeIn().delay(2000).fadeOut();
setTimeout(function(){ location.reload();; }, 300);
}else{
$("#MSG").html('<div class="alert alert-danger"><strong>Error:'+data.data+'</strong></div>').fadeIn().delay(1000).fadeOut();
}
})
});
</script>
<script>
$("#page").slideDown("slow");
</script>
</body>
</html>