Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.60 KB | None | 0 0
  1. <?php
  2.  
  3. if (!defined("WHMCS"))
  4.     die("This file cannot be accessed directly");
  5.  
  6. function hook_validate_PlayerUID($vars) {
  7.     $firstname = $vars['firstname'];
  8.     $lastname = $vars['lastname'];
  9.     $email = $vars['email'];
  10.    
  11.     $customField = $vars['customfield'];   
  12.    
  13.     //print_r($customField);
  14.     //print("A2ID: " + $customField[42]);
  15.     $armaSteamID = $customField[42];
  16.    
  17.     // send Query to server to see if we get a result.
  18.    
  19.     $conn = new mysqli($servername, $username, $password);
  20.    
  21.     // check conn
  22.     if ($conn->connect_error) {
  23.         $error = "DB Connect Failed: " . $conn->connect_error;
  24.         return $error;
  25.     }
  26.     $query = "";
  27.     if ($stmt = $conn->prepare("SELECT PlayerName FROM dayzepoch_vp.player_data WHERE playerUID=?")) {
  28.         $stmt->bind_param("s",$armaSteamID);
  29.         $stmt->execute();
  30.         $stmt->bind_result($res);
  31.         $stmt->fetch();
  32.         $rowCount = $res->num_rows;
  33.                
  34.         if ($res != "")
  35.         {
  36.             printf("%s has name %s\n", $armaSteamID, $res);        
  37.         } else {
  38.             $error = "You must enter a valid SteamUID used to connect to our server!<br>If you have not connected to the server yet, plesae do so and try again.<br> You can find this value in your profiles page on the main menu in arma2";
  39.             $stmt->close();
  40.             $conn->close();
  41.             return $error;
  42.         }      
  43.         $stmt->close();
  44.     } else {
  45.         $error = "Something is wrong";
  46.         return $error;
  47.     }
  48.    
  49.    
  50.     //echo "We connected!";
  51.     $conn->close();
  52.    
  53.     //$error = "You must enter a valid SteamUID used to connect to our server!<br>If you have not connected to the server yet, plesae do so and try again";
  54.    
  55. }
  56.  
  57. add_hook("ClientDetailsValidation",1,"hook_validate_PlayerUID");
  58.  
  59. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement