PHP签名脚本

时间:2017-01-22 18:41:22

标签: php signature imagettftext

代码中的某些内容是错误但我无法找到它,但是当我打开页面时,页面是空的。我的VPS上的signature.php的http://5.230.28.164/ucp/signature.php?nick=Vladimir_Adamo链接。

 <?php
 ob_start();
 require_once 'dbconnect.php';

$name = $_GET['nick']; // This gets the player his name from the previous page.

/* To protect MySQL injection. */
$name = stripslashes($name);
$name = mysqli_real_escape_string($name);

$res=mysqli_query($conn,"SELECT * FROM accounts WHERE Name='$name'"; // Gets all the information about the player.
$korisnik=mysqli_fetch_array($res);

if(mysqli_num_rows($res) != 0)
{

    $nick = $korisnik['Name'];
    $novacukupno = $korisnik['NovacDzep'];
    $lvl = $korisnik['Level'];


    // Creating of the .png image.
    header('Content-Type: image/png;');
    $im = @imagecreatefrompng('images/signature.png');
    $text_color = imagecolorallocate($im, 197,197,199); // RED, GREEN, BLUE --> Go to www.colorpicker.com, select a nice color. Copy the R/G/B letters provided by colorpicker and put them here.
    $ime = "$nick"; // This gets the information about player name to be showed in the picture.
    $level = "$lvl"; // Same as above ^^
    $novac = "$novacukupno"; // Same as above ^^
    $font = 'fonts/fontawesome-webfont.ttf'; //Upload your custum font to the directory where this file is placed. Then change the name here.
    /* USAGE OF THE imagettftext: First ($im) shouldn't be changed. (16) is the text-size. (0) is the angle of your text. Change it, and you'll see what's going on. (20) is de X-coordinate of the text.
    (36) is the Y-coordinate of the text. */
    imagettftext($im, 16, 0, 20, 36, $text_color, $font, $ime); // Prints the username in the picture. 
    imagettftext($im, 16, 0, 72, 69, $text_color, $font, $level); // Prints the score in the picture.
    imagettftext($im, 16, 0, 72, 99, $text_color, $font, $novac); // Prints the money in the picture.
    imagepng($im);
    imagedestroy($im);
} 
//else echo('Nema igraca pod tim nickom.'); // If the username doesn't exist (so the row is 0) then it'll give en error.

mysqli_close($conn);

?>
<?php ob_end_flush(); ?> 

0 个答案:

没有答案