Advertisement
DougCp

base.php

Feb 19th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.60 KB | None | 0 0
  1. <?php
  2. if (isset($_GET["user"]))
  3. {
  4.     $usr = file_get_contents("http://atelier801.com/profile?pr=".$_GET["user"]);
  5.     if (preg_match("|<img src=\"img/icones/16/on-offbis|is", $usr))
  6.     {
  7.         $user = array("name" => $_GET["user"]);
  8.  
  9.         // Rellenar todas estas variables:
  10.         $link = mysql_connect("91.121.68.87", "mices_es", "FryYgZKhdSp6QFGe");
  11.         mysql_select_db("statistiques", $link);
  12.         $result = mysql_query("SELECT * FROM player WHERE name='".$_GET["user"]."'", $link);
  13.         $result2 = mysql_query("SELECT * FROM member WHERE name='".$_GET["user"]."'", $link);
  14.         while($row = mysql_fetch_array($result)) {
  15.             if ($row["title"] == 81) { $user["title"] = "It's Over 9000"; }
  16.             else { $user["title"] = $row["title"]; }
  17.             $user["experience"] = (string) $row["experience"];
  18.             $user["first"] = (string) $row["first"];
  19.             $user["color1"] = (string) $row["color1"];
  20.             $user["color2"] = (string) $row["color2"];
  21.             $user["bootcamp"] = (string) $row["bootcamp"];
  22.             $user["round_played"] = (string) $row["round_played"];
  23.             $user["shaman_cheese"] = (string) $row["shaman_cheese"];
  24.             $user["saved_mice"] = (string) $row["saved_mice"];
  25.             $user["saved_mice_hard"] = (string) $row["saved_mice_hard"];
  26.             $user["saved_mice_divine"] = (string) $row["saved_mice_divine"];
  27.             $user["cheese_gathered"] = (string) $row["cheese_gathered"];
  28.         }
  29.         while($row2 = mysql_fetch_array($result2)) {
  30.             $user["id_spouse"] = $row2["id_spouse"];
  31.             $user["id_tribe"] = $row2["id_tribe"];
  32.             $user["marriage_date"] = $row2["marriage_date"];
  33.             if ($row2["id_gender"] == 0) { $user["gender"] = "Ninguno";}
  34.             elseif ($row2["id_gender"] == 1) { $user["gender"] = "Femenino"; }
  35.             else { $user["gender"] = "Masculino"; }
  36.         }
  37.         $result3 = mysql_query("SELECT * FROM tribe WHERE id=".$user["id_tribe"]);
  38.         while($row3 = mysql_fetch_array($result3)) {
  39.             $user["tribe"] = $row3["name"];
  40.         }
  41.         $result4 = mysql_query("SELECT * FROM player WHERE id=".$user["id_spouse"]);
  42.         while ($row4 = mysql_fetch_array($result4)){
  43.             $user["spouse"] = $row4["name"];
  44.         }
  45.         if (preg_match("|Date d'inscription : (.*?)</span>|is", $usr, $abc)) $user["registration_date"] = $abc[1];
  46.     else $user["registration_date"] = "";
  47.         $user["avatar"] = preg_match("|<div class=\"avatar-profil\"> <img src=\"http://avatars.atelier801.com/(.*?)\"|is", $usr, $a) ? "http://avatars.atelier801.com/".$a[1] : false;
  48.     $a = array();
  49.     $b = 0;
  50.     while (true)
  51.     {
  52.         if ($b == 0) { $a[$b+1] = 32; $c = 32; }
  53.         elseif ($b > 0 && $b < 29) { $a[$b+1] = ($c+2*($b+1))+$a[$b]; $c = $c+2*($b+1); }
  54.         elseif ($b > 28 && $b < 59) { $a[$b+1] = ($c+10*($b+1))+$a[$b]; $c = $c+10*($b+1); }
  55.         else { $a[$b+1] = ($c+15*($b+1))+$a[$b]; $c = $c+15*($b+1); }
  56.         if ($a[$b+1] > $user["experience"]) { $user["level"] = $b+1; break; }
  57.         if ($b == 887) { $user["level"] = 888; break; }
  58.         $b++;
  59.     }
  60.  
  61.         ######## Crear Imagen ########
  62.    
  63.         $width = 419;
  64.         $height = 364;
  65.         $img = ImageCreateTrueColor($width,$height);
  66.         imagesavealpha($img, true);
  67.         $bg = ImageColorAllocateAlpha($img, 0, 0, 0, 127);
  68.         ImageFill($img,0,0,$bg);
  69.      
  70.         ######## Asignar Fondo ########
  71.    
  72.         $bg1 = imagecreatefrompng('base.png');
  73.         $right_margin = 0;
  74.         $bottom_margin = 0;
  75.         $sx = imagesx($bg1);
  76.         $sy = imagesy($bg1);
  77.         imagecopy($img, $bg1, imagesx($img) - $sx - $right_margin, imagesy($img) - $sy - $bottom_margin, 0, 0, imagesx($bg1), imagesy($bg1));
  78.      
  79.         ######## Propiedades Titulo ########
  80.    
  81.         $font_color = ImageColorAllocate($img, 0, 161, 161);
  82.         $font = 'soopafre.ttf';
  83.         $font_color_texto = ImageColorAllocate($img, 194, 194, 218);
  84.         $font_color_sexo = ImageColorAllocate($img, 152, 226, 235);
  85.         $font_color_normal = ImageColorAllocate($img, 0, 157, 157);
  86.         $font_color_dificil = ImageColorAllocate($img, 186, 189, 47);
  87.         $font_color_divino = ImageColorAllocate($img, 203, 84, 107);
  88.         $stats = ImageColorAllocate($img, 108, 119, 193);
  89.         $tribe = ImageColorAllocate($img, 186, 189, 47);
  90.         $separador = ImageColorAllocate($img, 96, 96, 144);
  91.         $font_texto = 'ARIALN.TTF';
  92.      
  93.         ######## Imprimir Texto ########
  94.    
  95.         imagettftext($img,20,0,125,50,$font_color,$font,$_GET["user"]);
  96.         imagettftext($img,10,0,22,118,$font_color_texto,$font_texto,'Sexo : ');
  97.     $masculino = imagecolorallocate($img, 152, 226, 235);
  98.     $femenino = imagecolorallocate($img, 254, 177, 252);
  99.     $ninguno = imagecolorallocate($img, 108, 119, 193);
  100.     if ($user["gender"] == "Masculino") imagettftext($img,10,0,55,118,$masculino,$font_texto,"Masculino");
  101.     elseif ($user["gender"] == "Femenino") imagettftext($img,10,0,55,118,$femenino,$font_texto,"Femenino");
  102.     else imagettftext($img,10,0,55,118,$ninguno,$font_texto,"Ninguno");
  103.         imagettftext($img,10,0,22,132,$font_color_texto,$font_texto,'Pareja :');
  104.         imagettftext($img,10,0,63,132,$stats,$font_texto,$user["spouse"]);
  105.         imagettftext($img,10,0,22,146,$font_color_texto,$font_texto,'Fecha de registro :');
  106.         imagettftext($img,10,0,115,146,$stats,$font_texto,$user["registration_date"]);
  107.         imagettftext($img,10,0,22,160,$font_color_texto,$font_texto,'Tribu :');
  108.         imagettftext($img,10,0,58,160,$tribe,$font_texto,$user["tribe"]);
  109.         imagettftext($img,10,0,22,180,$font_color_texto,$font_texto,'Nivel');
  110.         imagettftext($img,10,0,50,180,$tribe,$font_texto,$user["level"]);
  111.         imagettftext($img,10,0,22,194,$font_color_texto,$font_texto,'Título actual : ');
  112.         imagettftext($img,10,0,92,194,$tribe,$font_texto,$user["title"]);
  113.         imagettftext($img,10,0,22,214,$font_color_texto,$font_texto,'Chaman');
  114.         imagettftext($img,10,0,25,228,$stats,$font_texto,'• Ratones salvados :');
  115.         imagettftext($img,10,0,32,242,$font_color_normal,$font_texto,$user["saved_mice"]);
  116.         imagettftext($img,10,0,72,242,$font_color_dificil,$font_texto,$user["saved_mice_hard"]);
  117.         imagettftext($img,10,0,112,242,$font_color_divino,$font_texto,$user["saved_mice_divine"]);
  118.         imagettftext($img,10,0,25,256,$stats,$font_texto,'• Quesos conseguidos como chamán : ');
  119.         imagettftext($img,10,0,210,256,$font_color_normal,$font_texto,$user["shaman_cheese"]);
  120.         imagettftext($img,10,0,22,276,$font_color_texto,$font_texto,'Ratón');
  121.         imagettftext($img,10,0,25,290,$stats,$font_texto,'• Quesos conseguidos siendo primero : ');
  122.         imagettftext($img,10,0,215,290,$font_color_normal,$font_texto,$user["first"]);
  123.         imagettftext($img,10,0,25,304,$stats,$font_texto,'• Quesos conseguidos : ');
  124.         imagettftext($img,10,0,139,304,$font_color_normal,$font_texto,$user["cheese_gathered"]);
  125.         imagettftext($img,10,0,25,318,$stats,$font_texto,'• Bootcamp : ');
  126.         imagettftext($img,10,0,87,318,$font_color_normal,$font_texto,$user["bootcamp"]);
  127.        
  128.         ######## Agregar Avatar ########
  129.  
  130.         if ($user["avatar"] != false)
  131.         {
  132.             $img_a = imagecreatefromjpeg($user["avatar"]);
  133.     $img_a = imagescale($img_a, 87);
  134.     imagecopy($img, $img_a, 8, 9, 0, 0, 87, 87);
  135.         }
  136.      
  137.         ######## Estructurar Imagen ########
  138.    
  139.         header('Content-Type: image/png');
  140.         ImagePNG($img);
  141.      
  142.         imagepng($img);
  143.         imagedestroy($img);
  144.  
  145.     }
  146. }
  147. else
  148. {
  149.     echo "Especifique un usuario.";
  150. }
  151.  
  152. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement