language: PHP (php 5.4.4)
date: 196 days 14 hours ago
link:
visibility: private
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!DOCTYPE html>
<html>
        <head>
                <title>Generate Signature</title>
        </head>
 
        <body>
                <p>
                <?php
                        $font_dir = 'fonts/';
                        $image_dir = 'images/';
                        $picture_dir = 'userpics/';
 
                        if(isset($_POST['username'])){
 
                                $error = 0;
                                
                                $username = $_POST['username'];
                                $avatar = $_POST['avatar'];
                                $motto = $_POST['motto'];
 
                                if(strlen($username)>11){
                                        $error = 1;
                                        echo('Username too long!<br>');
                                }
 
                                if(strlen($motto)>16){
                                        $error = 1;
                                        echo('Motto too long!<br>');
                                }
                                
                                if($username==''){
                                        $error = 1;
                                        echo('You must enter a username!<br>');
                                }
                                
                                if($avatar==''){
                                        $error = 1;
                                        echo('You must choose an avatar!<br>');
                                }
 
                                if($motto==''){
                                        $error = 1;
                                        echo('You must enter a motto!<br>');
                                }
 
                                if($error ==0){
                                        
                                        $background = '';
                                        $background .= $image_dir."signature_".$avatar;
                                        $fontpath = $font_dir.'trajanProRegular.ttf';
                                        $username = strtoupper($username);
                                        $avatar = strtoupper($avatar);
                                        
                                        $img = imagecreatefrompng($background);
 
                                        $font_color = imagecolorallocate($img, 82, 41, 16);
 
                                        imagettftext($img, 36, 0, 177, 102, $font_color, $fontpath, $username);
                                        imagettftext($img, 24, 0, 179, 136, $font_color, $fontpath, $username);
 
                                        $r = rand(0,1000);
                                        
                                        $pic = $picture_dir.$username.$r.'.png';
 
                                        imagepng($img, $picture_dir);
                                        imagedestroy($img);
                                        
                                        echo('<img src = "'.$pic.'"/>');
                                        echo('<br/><br/>If you like the image please save it as we do not provide hosting.');
                                }
 
                        }
 
                ?>
                </p>
                <p><a href="index.php">Create a new signature</p>
        </body>
</html>