Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!defined("WHMCS"))
- die("This file cannot be accessed directly");
- function hook_validate_PlayerUID($vars) {
- $firstname = $vars['firstname'];
- $lastname = $vars['lastname'];
- $email = $vars['email'];
- $customField = $vars['customfield'];
- //print_r($customField);
- //print("A2ID: " + $customField[42]);
- $armaSteamID = $customField[42];
- // send Query to server to see if we get a result.
- $conn = new mysqli($servername, $username, $password);
- // check conn
- if ($conn->connect_error) {
- $error = "DB Connect Failed: " . $conn->connect_error;
- return $error;
- }
- $query = "";
- if ($stmt = $conn->prepare("SELECT PlayerName FROM dayzepoch_vp.player_data WHERE playerUID=?")) {
- $stmt->bind_param("s",$armaSteamID);
- $stmt->execute();
- $stmt->bind_result($res);
- $stmt->fetch();
- $rowCount = $res->num_rows;
- if ($res != "")
- {
- printf("%s has name %s\n", $armaSteamID, $res);
- } else {
- $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";
- $stmt->close();
- $conn->close();
- return $error;
- }
- $stmt->close();
- } else {
- $error = "Something is wrong";
- return $error;
- }
- //echo "We connected!";
- $conn->close();
- //$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";
- }
- add_hook("ClientDetailsValidation",1,"hook_validate_PlayerUID");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement