Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $logenable = true;
- $debug = false;
- $x = 90;
- $y = 90;
- $resized = imagecreatetruecolor($x,$y);
- function loginfo($value){
- $file = 'LogsFile.txt';
- $current = file_get_contents($file);
- $tolog = "[".date("F j, Y, g:i a")."] - [" . $_SERVER['REMOTE_ADDR'] . "]" . " || " . $value;
- $current .= $tolog."\n";
- file_put_contents($file, $current);
- }
- function LoadPNG($ext,$imgname)
- {
- /* Attempt to open */
- if($ext == "png"){
- $im = @imagecreatefrompng($imgname);
- header('Content-Type: image/png');
- }else if($ext == "jpg"){
- $im = @imagecreatefromjpeg($imgname);
- header('Content-Type: image/jpeg');
- }else if($ext == "gif"){
- $im = imagecreatefromgif($imgname);
- header('Content-Type: image/gif');
- }
- return $im;
- }
- $api = "http://test.reactiongaming.us/api.php";
- $hash = "API_HASH_HERE";
- if(isset($_GET['id'])){
- //api.php?action=getAvatar&value=USERNAME&hash=API_KEY
- $id = $_GET['id'];
- $apigetav = $api."?action=getuserbyid&value=".$id."&hash=".$hash;
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_URL,$apigetav);
- $result = json_decode(curl_exec($ch),true);
- $avatarlink = "http://test.reactiongaming.us/data/avatars/m/0/".$id.".jpg?".$result[0]['avatar_date'];
- if($result[0]['gender'] == "male"){
- if($result[0]['avatar_date']){
- $img = LoadPNG("jpg",$avatarlink);
- }else{
- $img = LoadPNG("png","http://test.reactiongaming.us/styles/default/xenforo/avatars/avatar_male_m.png");
- }
- }else if($result[0]['gender'] == "female"){
- if($result[0]['avatar_date']){
- $img = LoadPNG("jpg",$avatarlink);
- }else{
- $img = LoadPNG("png","http://test.reactiongaming.us/styles/default/xenforo/avatars/avatar_female_m.png");
- }
- }else{
- if($result[0]['avatar_date']){
- $img = LoadPNG("jpg",$avatarlink);
- }else{
- $img = LoadPNG("png","http://test.reactiongaming.us/styles/default/xenforo/avatars/avatar_m.png");
- }
- }
- imagecopyresampled($resized, $img, 0, 0, 0, 0, $x, $y, imagesx($img), imagesy($img));
- imagepng($resized);
- imagedestroy($img);
- loginfo('Avatar Request ID #'.$_GET['id']);
- break;
- }else if(isset($_POST['user']) && isset($_POST['pass'])){
- loginfo("Received POST Request.");
- $username = $_POST['user'];
- $password = $_POST['pass'];
- $auth_url = $api."?action=authenticate&username=".$username."&password=".$password;
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_URL,$auth_url);
- $auth_result = json_decode(curl_exec($ch),true);
- $hashkey = $auth_result['hash'];
- if(isset($hashkey)){
- $getuserinfo_req = $api."?action=getUser&value=".$username."&hash=".$hash;
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_URL,$getuserinfo_req);
- $getuserinfo_result = json_decode(curl_exec($ch),true);
- $name = $getuserinfo_result['username'];
- $userid = $getuserinfo_result['user_id'];
- $useremail = $getuserinfo_result['email'];
- if($getuserinfo_result['is_banned'] == 1){
- echo "fail#You have been permanently banned from ReactM, which means you cannot play online again.#1#Anonymous#anonymous@example.com#0#";
- loginfo($name . " , Banned user, tried to connect.");
- die();
- }else{
- if($getuserinfo_result['user_state'] == "email_confirm"){
- echo "fail#Account not activated, please check your email inbox.#1#Anonymous#anonymous@example.com#0#";
- loginfo($name . " tried to connect with innactive account.");
- die();
- }else{
- if($getuserinfo_result['is_admin'] == 1 || $getuserinfo_result['is_staff'] == 1){
- echo "ok#Success.#".$userid."#".$name."#".$useremail."#1337#";
- loginfo('Staff/Admin connected ['.$name.'].');
- die();
- }else{
- echo "ok#Success.#".$userid."#".$name."#".$useremail."#1337#";
- loginfo("Player connected [".$name."].");
- die();
- }
- }
- }
- }else if(isset($auth_result['error'])){
- if($debug){
- loginfo("Failed to login with username ".$_POST['user']." and password ".$_POST['pass'].".");
- }else{
- loginfo("failed to login [".$_POST['user']."]");
- }
- echo "fail#Bad Username and Password Combination.#1#Anonymous#anonymous@example.com#0#";
- die();
- }
- curl_close($ch);
- break;
- }else{
- loginfo("tried to access script directly.");
- echo "gtfo m9, dun ivin trai.";
- die();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement