Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();error_reporting(0);
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>RUS GOLD Internal Sale</title>
- <link rel="icon" href="favicon.ico">
- <style>
- .logo {float: left;} .nav {float: right; margin: 30px; margin-right: 45px;}
- .nav a {font-size: 25px;text-decoration:none;color: #000; font-family: Lucida Sans Unicode; font-weight: normal;} .nav a:hover {opacity:.5;}
- .sign { width: 40%; }
- h1 {margin-left:170px;font-family: arial; font-size: 35px; color: #5E0000;}
- .sign input { float: right; padding: 15px; border: none;border-bottom: 1px solid #ccc; width: 60%; margin-right: 40px;}
- input[type="submit"] {background-color:#5E0000;color:white;padding:14px 20px;margin:8px 0;border:0;cursor:pointer;width:35%;opacity:.9;}
- .history {height: auto; width: 50%;float: right; margin-top: -370px;}
- .history h2 {text-align:center;font-family: arial; font-size: 35px; color: #5E0000;}
- .start {height: 400px; overflow-y: auto; }
- ::-webkit-scrollbar {width: 10px;}
- ::-webkit-scrollbar-track {background: #f1f1f1; }
- ::-webkit-scrollbar-thumb {background: #888; }
- ::-webkit-scrollbar-thumb:hover {background: #555; }
- </style>
- </head>
- <body>
- <div class="logo">
- <img style="height: 80px;" src="rus_logo.png">
- <p style="margin-top: -15px; margin-left: 60px; opacity: 0.7;">beta</p>
- </div>
- <div class="nav"><a href="index.php">Claim RUS GOLD</a></div><br><br><br><br><br><br><br><br>
- <h1>Transfer RUS GOLD</h1><br><br>
- <div class="sign">
- <form method="POST">
- <input type="text" name="tousername" placeholder="Enter Receiver Username...."><br><br><br><br><br>
- <input type="number" name="toamount" step=".01" placeholder="Enter Amount..."><br><br><br><br><br>
- <input type="submit" name="submit" value="Transfer RUS GOLD"><br><br>
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "users";
- if (isset($_POST['submit'])) {
- $conn = new mysqli($servername, $username, $password, $dbname);
- $user = $_SESSION['username'];
- $hi = mysqli_query($conn, "SELECT sum(points) from points WHERE username='$user'");
- $ji = mysqli_fetch_array($hi);
- $user = $_SESSION['username'];
- $username = $_POST['tousername'];
- $amount = $_POST['toamount'];
- if ($ji[0] < $amount) {
- echo "<script> alert('Insufficent Balances'); </script>";
- } else {
- $transfer = $ji[0] - $amount;
- $sql = "DELETE FROM points WHERE username = '$user'";
- $conn->query($sql);
- $sq = "INSERT INTO points (username, points) VALUES ('$user', '$transfer')";
- $conn->query($sq);
- $s = "INSERT INTO points (username, points) VALUES ('$username', '$amount')";
- if ($conn->query($s) === TRUE) {
- $tim = gmdate("l jS F Y h:i:s A ") . "( GMT )";
- $sa = "INSERT INTO transfer (from_u, amount, to_u, tim) VALUES ('$user', '$amount', '$username', '$tim')";
- $conn->query($sa);
- echo "<script>alert('Successfully Transfered " .$amount. " to " .$username. "');
- window.location.href='sale.php'; </script>";
- } else {
- echo "There is an Error, Please Try Again Later."; //$conn->error;
- }
- }
- }
- ?>
- </form>
- </div>
- <div class="history">
- <h2>Last Transactions</h2>
- <div class="start">
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "users";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- $sql = "SELECT * FROM transfer ORDER BY id DESC";
- $result = $conn->query($sql);
- if (!$result){
- die('There is an Error. Please Try Again. ');//.mysqli_error($conn));
- } else {
- echo "<br>";
- echo "<table style='width:100%;'>";
- echo "<tr>"; echo "<th>From</th>"; echo "<th>Amount</th>"; echo "<th>To</th>";
- echo "<th>Time</th>";
- echo "<tr>";
- while($row = mysqli_fetch_assoc($result)) {
- echo "<tr>";
- echo "<td style='text-align: center; padding:15px; border-bottom:1px solid #000;'>"; echo $row["from_u"]; echo "</td>";
- echo "<td style='text-align: center; border-bottom:1px solid #000;'>"; echo $row["amount"]; echo "</td>";
- echo "<td style='text-align: center; border-bottom:1px solid #000;'>"; echo $row["to_u"]; echo "</td>";
- echo "<td style='text-align: center; border-bottom:1px solid #000;'>"; echo $row["tim"]; echo "</td>";
- echo "</tr>";
- }
- }
- ?>
- </div>
- </div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment