Advertisement
DougCp

Profil viewer

Feb 2nd, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.53 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.     header("Content-type: image/png");
  8.     $user = array("name" => $_GET["user"]);
  9.     // Rellenar todas estas variables:
  10.     $link = mysql_connect("host", "db", "pw");
  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.     $result3 = mysql_query("SELECT * FROM tribe WHERE id=".$user["id_tribe"]);
  15.     while($row = mysql_fetch_array($result)) {
  16.     if ($row["title"] == 81) { $user["title"] = "It's Over 9000"; }
  17.     else { $user["title"] = $row["title"]; }
  18.     $user["experience"] = (string) $row["experience"];
  19.     $user["first"] = (string) $row["first"];
  20.     $user["bootcamp"] = (string) $row["bootcamp"];
  21.     $user["round_played"] = (string) $row["round_played"];
  22.     $user["shaman_cheese"] = (string) $row["shaman_cheese"];
  23.     $user["saved_mice"] = (string) $row["saved_mice"];
  24.     $user["saved_mice_hard"] = (string) $row["saved_mice_hard"];
  25.     $user["saved_mice_divine"] = (string) $row["saved_mice_divine"];
  26.     $user["cheese_gathered"] = (string) $row["cheese_gathered"];
  27.     }
  28.     while($row2 = mysql_fetch_array($result2)) {
  29.     $user["id_tribe"] = $row2["id_tribe"];
  30.     $user["marriage_date"] = $row2["marriage_date"];
  31.     if ($row2["id_gender"] == 0) { $user["gender"] = "Ninguno"; }
  32.     elseif ($row2["id_gender"] == 1) { $user["gender"] = "Femenino"; }
  33.     else { $user["gender"] = "Masculino"; }
  34.         }
  35.     while($row3 = mysql_fetch_array($result3)) {
  36.     $user["tribe"] = $row3["name"];
  37.         }
  38.     $user["avatar"] = preg_match("|<div class=\"avatar-profil\"> <img src=\"http://avatars.atelier801.com/(.*?)\"|is", $usr, $a) ? "http://avatars.atelier801.com/".$a[1] : false;
  39.     $img = imagecreatetruecolor(600, 300);
  40.     $colorfondo = imagecolorallocate($img, 28, 59, 64);
  41.     $colortexto = imagecolorallocate($img, 150, 159, 176);
  42.     $colortitulo = imagecolorallocate($img, 169, 173, 49);
  43.     $negro = imagecolorallocate($img, 0, 0, 0);
  44.     imagefilledrectangle($img, 0, 0, 600, 399, $colorfondo);
  45.     $fuente = "./soopafre.ttf";
  46.     $fuentetexto = "./arialbd.ttf";
  47.     imagettftext($img, 20, 0, 12, 32, $negro, $fuente, $user["name"]);
  48.     imagettftext($img, 20, 0, 8, 28, $negro, $fuente, $user["name"]);
  49.     imagettftext($img, 20, 0, 10, 30, $colortitulo, $fuente, $user["name"]);
  50.     $todoeltexto = "Título: ".$user["title"]."\r\nExperiencia: ".$user["experience"]."\r\nFirsts: ".$user["first"]."\r\nBootcamps: ".$user["bootcamp"]."\r\nRondas: ".$user["round_played"]."\r\nQuesos conseguidos como chamán: ".$user["shaman_cheese"]."\r\nRatones salvados: ".$user["saved_mice"]."\r\nRatones salvados en modo difícil: ".$user["saved_mice_hard"]."\r\nRatones salvados en modo divino: ".$user["saved_mice_divine"]."\r\nQuesos conseguidos: ".$user["cheese_gathered"]."\r\nFecha de matrimonio: ".$user["marriage_date"]."\r\nSexo: ".$user["gender"]."\r\nTribu: ".$user["tribe"]."";
  51.     imagettftext($img, 12, 0, 10, 60, $colortexto, $fuentetexto, $todoeltexto);
  52.     if ($user["avatar"] != false)
  53.     {
  54.         $img_a = imagecreatefromjpeg($user["avatar"]);
  55.         imagecopy($img, $img_a, 480, 20, 0, 0, 100, 100);
  56.     }
  57.     imagepng($img);
  58.     imagedestroy($img);
  59.     }
  60.     else
  61.     {
  62.         echo "El usuario no existe.";
  63.     }
  64. }
  65. else
  66. {
  67.     echo "Especifique un usuario.";
  68. }
  69. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement