root/dev/common/portrait_grab.php @ 230

Revision 230, 1.7 KB (checked in by ralle030583, 15 years ago)

-IGB Portrait issues bugfix

Line 
1<?php
2require_once('common/includes/class.pilot.php');
3require_once('common/includes/class.corp.php');
4require_once('common/includes/class.alliance.php');
5
6$page = new Page('Capture portrait');
7
8$html .= '<html><head><title>Update portrait</title></head><body>';
9
10if (!$page->igb())
11{
12    $html .= 'You need to access this page from the EVE ingame browser.';
13}
14else
15{
16    if (($_SERVER['HTTP_EVE_TRUSTED'] == 'no'))
17    {
18        Header('eve.trustme:http://'.$_SERVER['HTTP_HOST'].'/::Need trust to grab character portrait.');
19        $html .= '<h1>Trust Required</h1>';
20        $html .= 'This site needs to be trusted in order to grab your character portrait.';
21    }
22    else
23    {
24        $now = date('Y-m-d H:m:s');
25
26        $alliance = new Alliance();
27        $all_id = $alliance->add($_SERVER['HTTP_EVE_ALLIANCENAME']);
28        $corp = new Corporation();
29        $crp_id = $corp->add($_SERVER['HTTP_EVE_CORPNAME'], $alliance, $now);
30        $pilot = new Pilot();
31        $plt_id = $pilot->add($_SERVER['HTTP_EVE_CHARNAME'], $corp, $now);
32        $id = intval($_SERVER['HTTP_EVE_CHARID']);
33        $pilot->setCharacterID($id);
34        @unlink("cache/portraits/".$id."_32.jpg");
35        @unlink("cache/portraits/".$id."_64.jpg");
36        @unlink("cache/portraits/".$id."_128.jpg");
37        @unlink("cache/portraits/".$id."_256.jpg");
38        @unlink("cache/portraits/".$id."_512.jpg");
39        $html .= "<img src=\"".$pilot->getPortraitURL(64)."\" border=\"0\">";
40        $html .= "Character portrait updated !<br>";
41        $html .= "<a href=\"?a=igb\">Return</a><br>";
42    }
43}
44
45$html .= "</body></html>";
46
47$page->setContent($html);
48$page->generate();
49?>
Note: See TracBrowser for help on using the browser.