valid_gamertag($gamertag)) $this->error_sig("Gamertag is invalid."); if (!file_exists("{$this->bg_dir}/{$background}.gif")) $this->error_sig("The background you supplied doesn't exist."); $this->create_sig($gamertag, $background); } // function.__construct /* Group: generators */ /* Function: create_sig Description: Creates a Halo 3 signature. */ function create_sig ($gamertag, $background) { $image = @imagecreatefromgif("{$this->bg_dir}/{$background}.gif"); $text = imagecolorallocate($image, 255, 255, 255); $shadow = imagecolorallocate($image, 0, 0, 0); $width = imagesx($image); $height = imagesy($image); $pdata = pxml($gamertag); @imagettftext($image, 20, 0, 17, 41, $shadow, "fonts/segoe.ttf", $gamertag); @imagettftext($image, 20, 0, 16, 40, $text, "fonts/segoe.ttf", $gamertag); $pdata = array( "Service Tag" => $pdata->calltag, "Rank" => $pdata->rank, "Highest Skill" => $pdata->highestSkill, "Experience" => $pdata->experience, "KD Ratio" => $pdata->ranked->kDRatio, ); $cx = 21; $cy = 70; foreach( $pdata as $label => $value ) { @imagettftext($image, 11, 0, $cx+1, $cy+1, $shadow, "fonts/candara.ttf", "{$label}: {$value}"); @imagettftext($image, 11, 0, $cx, $cy, $text, "fonts/candara.ttf", "{$label}: {$value}"); $cy = $cy + 15; } @imagegif($image); @imagedestroy($image); } // function.create_sig /* Function: error_sig Description: Creates a plain image to show an error has been encountered. */ function error_sig ($message) { $image = @imagecreate(400, 150); $black = imagecolorallocate($image, 0, 0, 0); $white = imagecolorallocate($image, 255, 255, 255); @imagefill($image, 1, 1, $white); @imagettftext($image, 11, 0, 15, 27, $black, "fonts/segoe.ttf", wordwrap($message, 50, "\n", True)); imagegif($image); imagedestroy($image); die(); } //function.error_sig /* Group: validators */ /* Function: valid_gamertag Description: Finds if $gamertag is valid */ function valid_gamertag($gamertag) { if (preg_match("/^[a-zA-Z0-9\ ]+$/u", $gamertag)) { return True; } else { return 0; } } // function.valid_gamertag } // h3sig.class if (isset($_GET['gamertag']) && isset($_GET['background'])) new h3sig($_GET['gamertag'], $_GET['background']); else die("Sneaky devil"); ?>