Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "cFeu11qJgQ8lNxhO";
- $dbname = "users";
- $Subscribed = "false";
- $steamids = "";
- $Botid = "";
- $BotName = "";
- $BotsID = "";
- $BotLink = "";
- $BotAvatar = "";
- $BotMedAvatar = "";
- $BotFullAvatar = "";
- $BotOnlineStatus = "";
- $Botstatus = "Offline";
- $UserID = false;
- $AdminID = false;
- $Sell_Price = "";
- $Keys_Price = "";
- $Refs_Price = "";
- $f_Bot_Id = "";
- $s_Bot_Id = "";
- $item_Id = "";
- $item_Name = "";
- $itemPicture = "";
- $market_Value = "";
- $bptf_Value = "";
- $content = "";
- $id = "";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- if (isset($_POST['sub']))
- {
- $name = $_POST["name"];
- $email = $_POST["mail"];
- $sql_table = "newsletter";
- $sql = "SELECT * FROM $sql_table WHERE Email = '$email' AND Name = '$name';";
- $results = $conn->query($sql);
- if ($results) {
- $sql = "INSERT INTO $sql_table (Name, Email) VALUES ('$name', '$email');";
- $results = $conn->query($sql);
- if ($results)
- {
- $_CONFIG['Subscribe'] = true;
- } else {
- echo "Error: " . $sql . "<br>" . $conn->error;
- }
- } else {
- echo "Error: " . $sql . "<br>" . $conn->error;
- }
- }
- if(isset($_SESSION['steamid'])){
- include ('steamauth/userInfo.php');
- $steamid = $steamprofile['steamid'];
- $SteamName = $steamprofile['personaname'];
- $avatarfull = $steamprofile['avatarfull'];
- $avatarmedium = $steamprofile['avatarmedium'];
- $avatar = $steamprofile['avatar'];
- $search = "none";
- $isAdmin = false;
- $sql_table = "users";
- if($UserID == true){
- $sql = "SELECT * FROM $sql_table WHERE steamId = $steamid;";
- $results = $conn->query($sql);
- if ($results->num_rows > 0) {
- // output data of each row
- while($row = $results->fetch_assoc())
- {
- if ($row["isAdmin"] == "true")
- {
- $isAdmin = true;
- if ($isAdmin == true)
- {
- $admin =$row["isAdmin"];
- $sql = "SELECT * FROM $sql_Admin_table WHERE steamId = $steamid;";
- $result = $conn->query($sql);
- if ($result->num_rows == 0)
- {
- $sql = "INSERT INTO $sql_Admin_table (SteamId, SteamName, isAdmin) VALUES ('$steamid', '$SteamName', '$admin');";
- if ($conn->query($sql) == TRUE)
- {
- echo "New record created successfully";
- } else {
- echo "Error: " . $sql . "<br>" . $conn->error;
- }
- }
- else
- {
- }
- }
- }
- }
- }
- else
- {
- $sql = mysqli_query($conn,"INSERT INTO $sql_table (steamId, steam_Name, avatar, avatarmedium, avatarfull) VALUES ('$steamid', '$SteamName', '$avatar', '$avatarmedium', '$avatarfull');");
- if ($conn->query($sql) == TRUE)
- {
- echo "New record created successfully";
- } else {
- echo "Error: " . $sql . "<br>" . $conn->error;
- }
- }
- mysqli_close($conn);
- }
- if($AdminID == "true"){
- $sql = "SELECT * FROM $sql_table";
- $results = $conn->query($sql);
- if ($results->num_rows > 0) {
- // output data of each row
- while($row = $results->fetch_assoc())
- {
- if ($row["isAdmin"] == "true")
- {
- $isAdmin = true;
- if ($isAdmin == true)
- {
- $sql = "SELECT * FROM $sql_Admin_table WHERE steamId = $A;";
- $result = $conn->query($sql);
- if ($result->num_rows == 0)
- {
- $admin =$row["isAdmin"];
- $_USER['avatarfull'] =$row['avatarfull'];
- }
- else
- {
- }
- }
- }
- }
- }
- }
- }
- if (isset($_POST['submit'])) {
- $Sell_Price = $_POST['sell'];
- $Keys_Price = $_POST['keys'];
- $Refs_Price = $_POST['refs'];
- $sql_table = "users";
- $sql = "SELECT * FROM $sql_table WHERE steamId=?";
- /* Prepare statement */
- $stmt = $conn->prepare($sql);
- if($stmt === false) {
- trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->errno . ' ' . $conn->error, E_USER_ERROR);
- }
- $id = $_SESSION['steamid'];
- /* Bind parameters. Types: s = string, i = integer, d = double, b = blob */
- $stmt->bind_param("s", $id);
- /* Execute statement */
- if ($stmt->execute()){
- /* Fetch result to array */
- $res = $stmt->get_result();
- while($row = $res->fetch_array(MYSQLI_ASSOC)) {
- $f_Bot_Id = $row['Bot_Id'];
- }
- }
- $sql_table = "bot_items_db";
- $sql = "SELECT * FROM $sql_table WHERE Bot_Id=?";
- /* Prepare statement */
- $stmt = $conn->prepare($sql);
- if($stmt === false) {
- trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->errno . ' ' . $conn->error, E_USER_ERROR);
- }
- $id = $f_Bot_Id;
- /* Bind parameters. Types: s = string, i = integer, d = double, b = blob */
- $stmt->bind_param("s", $id);
- /* Execute statement */
- if ($stmt->execute()){
- /* Fetch result to array */
- $res = $stmt->get_result();
- while($row = $res->fetch_array(MYSQLI_ASSOC)) {
- $s_Bot_Id = $row['Bot_Id'];
- $item_Id = $row['item_Id'];
- $item_Name = $row['item_Name'];
- $Sell_Price = $row['Sell_Price'];
- $Keys_Price = $row['Keys_Price'];
- $Refs_Price = $row['Refined_Price'];
- }
- }
- if($s_Bot_Id == $f_Bot_Id ){
- if(isset($_POST['sell'])){
- $content = $_POST['sell'];
- $sql_table = "bot_items_db";
- $sql = "UPDATE $sql_table SET Sell_Price=? WHERE Bot_Id=?";
- $id = $s_Bot_Id;
- $stmt = $conn->prepare($sql);
- $stmt->bind_param('ss', $content, $id);
- if ($stmt->execute()){
- return $stmt->affected_rows;
- $stmt->close();
- }else {
- echo "save not working";
- }
- }
- if(isset($_POST['keys'])){
- $content = $_POST['keys'];
- $sql_table = "bot_items_db";
- $sql = "UPDATE $sql_table SET `Keys_Price` = ? WHERE Bot_Id = ?;";
- $id = $s_Bot_Id;
- $stmt = $conn->prepare($sql);
- $stmt->bind_param('ss', $content, $id);
- if ($stmt->execute()){
- return $stmt->affected_rows;
- $stmt->close();
- }else {
- echo "save not working";
- }
- }
- if(isset($_POST['refs'])){
- $content = $_POST['refs'];
- $sql_table = "bot_items_db";
- $sql = "UPDATE $sql_table SET Refined_Price=? WHERE Bot_Id=?";
- $id = $s_Bot_Id;
- $stmt = $conn->prepare($sql);
- $stmt->bind_param('ss', $content, $id);
- if ($stmt->execute()){
- return $stmt->affected_rows;
- $stmt->close();
- }else {
- echo "save not working";
- }
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement