Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Main PHP
- <?php
- require 'steamauth/steamauth.php';
- require 'connection.php';
- $Credits = 0;
- if(isset($_SESSION['steamid'])){
- include ('steamauth/userInfo.php');
- $steamid = $steamprofile['steamid'];
- $SteamName = $steamprofile['personaname'];
- $isAdmin = false;
- $sql_table = "users";
- $sql_Admin_table = "betterbot_administrators";
- $sql = "SELECT * FROM $sql_table WHERE steamId = $steamid;";
- $sql_insert_data = mysqli_query($conn,"INSERT INTO $sql_table (steamId, steam_Name)
- VALUES ('$steamid', '$SteamName');");
- $results = $conn->query($sql);
- if ($results->num_rows > 0) {
- // output data of each row
- while($row = $results->fetch_assoc()) {
- echo "id: " . $row["id"]. " - steam_Name: " . $row["steam_Name"]. "- steamId: " . $row["steamId"]. "- isAdmin: " . $row["isAdmin"]."<br>";
- 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 == false) {
- $sql = mysqli_query($conn,"INSERT INTO $sql_Admin_table (`steamId`, `steam_Name`, `isAdmin`) VALUES ('$steamid', '$SteamName', '$admin');");
- if ($conn->query($sql) == true){
- }else{
- }
- }else{
- }
- }
- }else{
- $sql = mysqli_query($conn,"INSERT INTO $sql_Admin_table (SteamId, SteamName) VALUES ('$steamid', '$SteamName');");
- if ($conn->query($sql) == TRUE)
- {
- echo "New record created successfully";
- } else {
- echo "Error: " . $sql . "<br>" . $conn->error;
- }
- }
- }
- }
- else
- {
- }
- mysqli_close($conn);
- }
- ?>
- Connection Php
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "users";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- echo "Connected successfully";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement