Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require '../xf_connector.php';
- require __DIR__ . '/rcon/SourceQuery/bootstrap.php';
- $servername = "localhost";
- $username = "admin_xenforo";
- $password = "DATABASE PASSWORD HERE";
- $dbname = "admin_xenforo";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- use xPaw\SourceQuery\SourceQuery;
- // For the sake of this example
- //Header( 'Content-Type: text/plain' );
- //Header( 'X-Content-Type-Options: nosniff' );
- // Edit this ->
- define( 'SQ_SERVER_ADDR', '81.169.231.76' );
- define( 'SQ_SERVER_PORT', 28016 );
- define( 'SQ_TIMEOUT', 1 );
- define( 'SQ_ENGINE', SourceQuery::SOURCE );
- // Edit this <-
- //CHECK IF USER IS DONATOR
- if(isset($steamId)){
- //$player = $_POST['player'];
- $sql = "SELECT * FROM xf_user_upgrade_active WHERE user_id=$userId";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- // output data
- while($row = $result->fetch_assoc()) {
- $UserID = $row['user_id'];
- $UserUpgradeID = $row['user_upgrade_id'];
- if($row['user_upgrade_id'] == 1){ //IF USER IS DONATOR PACKAGE ID 1
- $sql = "SELECT * FROM donators WHERE userid=$UserID";
- $result2 = $conn->query($sql);
- if ($result2->num_rows > 0) {
- while($row2 = $result2->fetch_assoc())
- {
- echo "<center><p style='color:red;'>You already redeemed your donation!</p></center>";
- die();
- }
- }
- else{
- $Query = new SourceQuery( );
- try
- {
- $Query->Connect( SQ_SERVER_ADDR, SQ_SERVER_PORT, SQ_TIMEOUT, SQ_ENGINE );
- $Query->SetRconPassword( '@Game-Maniac!' );
- $Query->Rcon( "usergroup add $steamId donator1" );
- echo "<center><p style='color:green;'>You are added as a Dontator on Rust!</p></center>";
- }
- catch( Exception $e )
- {
- //echo $e->getMessage( );
- }
- finally
- {
- $Query->Disconnect( );
- }
- $sql = "INSERT INTO donators (name, userid)
- VALUES ('$username', '$UserID')";
- if ($conn->query($sql) === TRUE) {
- echo "<center><p style='color:green;'>Kit Redeem Succesfull!</p></center>";
- } else {
- echo "Error: " . $sql . "<br>" . $conn->error;
- }
- }
- }
- }
- }
- else{
- echo "<center><p style='color:red;'>You are NOT a donator!</p>";
- die();
- }
- //$conn->close();
- }
- else{
- echo "<center><p style='color:red;'>You have no Steam Account configured on this Forum account!</p><a style='color:orange;' target='_parent' href='https://game-maniacs.com/forum/index.php?register/steam&reg=1&assoc=1' >Associate with Steam</a></center>";
- die();
- }
- ?>
Add Comment
Please, Sign In to add comment