root/dev/common/portrait_grab.php @ 192

Revision 192, 1.7 KB (checked in by exi, 15 years ago)

Fixed several potential security issues with unchecked variables.
Added .htaccess files to common/ and mods/.
Modified the sync module to not send item data anymore.

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