· 8 years ago · Jan 09, 2018, 06:44 PM
1<?
2error_reporting(E_ALL ^ (E_NOTICE | E_DEPRECATED));
3ini_set('session.bug_compat_warn','off');
4
5$secret_key = '61845214455ef11cbe81d856244dad79c172ca9c';
6
7
8$secret_key = $_GET['secret_key'];
9$post_data = array(
10 'api_key' => $secret_key,
11 'command' => 'server_info'
12 );
13
14$url ="https://net-speak.pl/api_client/";
15
16$ch = curl_init();
17
18curl_setopt($ch, CURLOPT_URL, $url) or die("error");
19curl_setopt($ch, CURLOPT_POST, 1);
20curl_setopt($ch, CURLOPT_TIMEOUT, 20);
21curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
22curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
23curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
24curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
25curl_setopt($ch, CURLOPT_HEADER, 0);
26curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
27curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
28
29$curl_response = curl_exec($ch);
30curl_close($ch);
31
32$response = json_decode($curl_response);
33$response_data=$response->{'response'};
34$result=$response_data->{'result'};
35
36if($result=="success")
37 {
38 $virtualserver_name=$response_data->{'virtualserver_name'};
39 $virtualserver_clientsonline=$response_data->{'virtualserver_clientsonline'};
40 $virtualserver_queryclientsonline=$response_data->{'virtualserver_queryclientsonline'};
41 $virtualserver_maxclients=$response_data->{'virtualserver_maxclients'};
42 $virtualserver_uptime=$response_data->{'virtualserver_uptime'};
43
44$text="Własny tekst reklamowy"; //---------------- wstaw własny tekst
45
46$data = date('d.m.Y');
47$godzina = date('H:i');
48
49
50function LoadJpeg($imgname)
51{
52 $im = @imagecreatefromjpeg($imgname);
53
54 if(!$im)
55 {
56 $im = imagecreatetruecolor(525, 80);
57 $bgc = imagecolorallocate($im, 255, 255, 255);
58 $tc = imagecolorallocate($im, 0, 0, 0);
59
60 imagefilledrectangle($im, 0, 0, 525, 80, $bgc);
61
62 imagestring($im, 1, 5, 5, 'Nierozpoznana grafika: ' . $imgname, $tc);
63 }
64
65 return $im;
66}
67
68
69$font = './EncodeSansCompressed-SemiBold.ttf';
70$fonta = './arial.ttf';
71$fontc = './verdanai.ttf';
72$img = LoadJpeg('background.jpg');
73
74$white=ImageColorAllocate($img,10 ,10 ,10);
75$green=ImageColorAllocate($img,223 ,223 ,223);
76$red=ImageColorAllocate($img,237 ,42 ,33);
77$fsize_text='';
78$ile_text=strlen($text);
79if($ile_text > 27)$fsize_text=14;
80if($ile_text < 27)$fsize_text=19;
81
82$bbox = imagettfbbox(26, 0, $font, $virtualserver_name);
83$center1 = (imagesx($img) / 2) - (($bbox[2] - $bbox[0]) / 2);
84
85$bbox2 = imagettfbbox($fsize_text, 0, $font, $text);
86$center2 = (imagesx($img) / 2) - (($bbox2[2] - $bbox2[0]) / 2);
87
88$this_image1=explode("-",$imga);
89$this_image=$this_image1[1];
90
91imagettftext($img, 26, 0, $center1 +4, 50 +4, $white, $font, $virtualserver_name);
92imagettftext($img, 26, 0, $center1, 50, $green, $font, $virtualserver_name);
93imagettftext($img, 13, 0, 797, 180, $white, $font, $godzina);
94imagettftext($img, 14, 0, 795, 185, $white, $font, $godzina);
95imagettftext($img, 13.5, 0, 797, 183, $green, $font, $godzina);
96imagettftext($img, 13, 0, 104, 180, $white, $font, $data);
97imagettftext($img, 14, 0, 102, 185, $white, $font, $data);
98imagettftext($img, 13.5, 0, 104, 183, $green, $font, $data);
99imagettftext($img, $fsize_text, 0, $center2 +4, 240 +4, $white, $font, $text);
100imagettftext($img, $fsize_text, 0, $center2, 240, $green, $font, $text);
101
102
103$save = "baner/baner.jpg";
104chmod($save,0755);
105imagejpeg($img, $save, 100);
106imagedestroy($img);
107?>
108<meta charset="utf-8"/>
109Baner został utworzony <a href='baner/baner.jpg' target='_BLANK'>tutaj</a>
110<?
111}
112else
113 {
114
115 print_r($response); //------ Wyświetlenie błędu
116
117 }
118?>