root/dev/common/class.session.php @ 10

Revision 10, 1.4 KB (checked in by exi, 15 years ago)

Changed portrait generation to cache the pictures from img.eve.is
Changed about-page-spacing
Changed MapView? to use PNG instead of GIF
Added BugCompat? to MapView? for the GD<>imagefilledellipse()-Issue
Added Code for NPC-Corphandling (Corps have to be added manually)
Changed Raw-Killmail Window slightly
Added Killmail-Delete option within the killmail itself
Fixed privilege bug between admin and superadmin
Removed the need to enter the postpassword if you're logged in as admin
Changed coding style to Allman/BSD in all touched files
Various small changes i cant remember

Line 
1<?php
2require_once("db.php");
3
4class Session
5{
6    function Session($cookie, $ip)
7    {
8        $this->qry_ = new DBQuery();
9        $this->sql_ = "select *
10                       from kb3_sessions ses
11                      where ses.ses_id = '" . $cookie . "'
12                        and ses.ses_ip = '" . $ip . "'";
13    }
14
15    function isAdmin()
16    {
17        $this->execQuery();
18        return $this->qry_->recordCount() == 1;
19    }
20
21    function isSuperAdmin()
22    {
23        $this->execQuery();
24        return ($this->qry_->recordCount() == 1 && $this->row_['ses_super'] == 1);
25    }
26
27    function execQuery()
28    {
29        if (!$this->qry_->executed_)
30            $this->qry_->execute($this->sql_);
31
32        $this->row_ = $this->qry_->getRow();
33    }
34
35    function cleanup()
36    {
37        $qry = new DBQuery();
38        $qry->execute("delete from kb3_sessions
39                       where ses_logon < date_sub( now(), INTERVAL '120:0' MINUTE_SECOND )");
40    }
41
42    function create($super)
43    {
44        $current = time();
45        $random = $_SERVER['REMOTE_ADDR'] . $current . KB_SITE;
46        $ses_id = md5($random);
47
48        if (!setcookie("EVK_COOKIE", $ses_id, 0))
49            die("Unable to set cookie");
50
51        $qry = new DBQuery();
52        $qry->execute("insert into kb3_sessions values ('" . $ses_id . "',
53                                                        '" . $_SERVER['REMOTE_ADDR'] . "',
54                                                        now(), " . $super . " )");
55    }
56}
57?>
Note: See TracBrowser for help on using the browser.