root/dev/mods/signature_generator/sig.php @ 72

Revision 72, 1.6 KB (checked in by exi, 14 years ago)

Changed portrait to only store 128x128.
class.http.php now returns false on no connect.
Changed siggen, added errorpicture, changed output to jpg, enabled possibility to use several signatures, added 2 signatures as more examples

Line 
1<?php
2if (!$sig_name = $_GET['s'])
3{
4    $sig_name = 'default';
5}
6$sig_name = str_replace('.', '', $sig_name);
7$sig_name = str_replace('/', '', $sig_name);
8$sig_name = str_replace('/', '', $sig_name);
9
10if (!$plt_id = $_GET['i'])
11{
12    header('location: error.jpg');
13    exit;
14}
15require_once("common/class.pilot.php");
16require_once("common/class.corp.php");
17require_once("common/class.alliance.php");
18require_once("common/class.killlist.php");
19
20$pilot = new Pilot($plt_id);
21if (!$pilot->exists())
22{
23    header('Location: error.jpg');
24    exit;
25}
26$corp = $pilot->getCorp();
27$alliance = $corp->getAlliance();
28
29// we dont generate pictures for non-member
30if (ALLIANCE_ID && $alliance->getID() != ALLIANCE_ID)
31{
32    header('Location: error.jpg');
33    exit;
34}
35elseif (CORP_ID && $corp->getID() != CORP_ID)
36{
37    header('Location: error.jpg');
38    exit;
39}
40
41$id = abs(crc32($sig_name));
42// check for cached version
43if (file_exists('cache/data/sig_'.$id.'_'.$plt_id))
44{
45    $age = filemtime('cache/data/sig_'.$id.'_'.$plt_id);
46
47    // cache files for 30 minutes
48    if (time() - $age < 30*60)
49    {
50        header('Content-Type: image/jpg');
51        readfile('cache/data/sig_'.$id.'_'.$plt_id);
52        return;
53    }
54}
55
56// check template
57if (!is_dir('mods/signature_generator/signatures/'.$sig_name))
58{
59    header('Location: error.jpg');
60    exit;
61}
62
63require('mods/signature_generator/signatures/'.$sig_name.'/'.$sig_name.'.php');
64
65header('Content-Type: image/jpg');
66imagejpeg($im, 'cache/data/sig_'.$id.'_'.$plt_id, 95);
67readfile('cache/data/sig_'.$id.'_'.$plt_id);
68?>
Note: See TracBrowser for help on using the browser.