Last change
on this file since 240 was 240, checked in by luc, 9 years ago |
Piccole sistemazioni del codice
|
-
Property svn:executable
set to
*
|
File size:
1.1 KB
|
Line | |
---|
1 | <?php
|
---|
2 |
|
---|
3 |
|
---|
4 | error_reporting(E_ALL ^ E_NOTICE);
|
---|
5 | function check_admin() {
|
---|
6 | @require_once("../../../../config.php");
|
---|
7 | @require_once("db.class.php");
|
---|
8 | $db=new DBConnection($dbhost,$dbuname,$dbpass,$dbname);
|
---|
9 |
|
---|
10 | if(isset($HTTP_COOKIE_VARS)) {
|
---|
11 | $_COOKIE = $HTTP_COOKIE_VARS;
|
---|
12 | }
|
---|
13 | $admin = $_COOKIE['admin'];
|
---|
14 |
|
---|
15 | if (!$admin) { return 0; }
|
---|
16 | $adminSave = 0;
|
---|
17 | static $adminSave;
|
---|
18 | if (isset($adminSave)) return $adminSave;
|
---|
19 | $admin = base64_decode($admin);
|
---|
20 | $admin = addslashes($admin);
|
---|
21 | $admin = explode(':', $admin);
|
---|
22 |
|
---|
23 | $aid = $admin[0];
|
---|
24 | $pwd = $admin[1];
|
---|
25 | $site_id = $admin[3];
|
---|
26 |
|
---|
27 | $aid = substr(addslashes($aid), 0, 25);
|
---|
28 | if (!empty($aid) && !empty($pwd)) {
|
---|
29 |
|
---|
30 | $query = "SELECT pwd, site_id FROM ".$prefix."_authors WHERE aid='$aid'";
|
---|
31 | $res=$db->rq($query);
|
---|
32 | if (!$res)
|
---|
33 | {
|
---|
34 | echo " Errore di MySQL: (" . mysql_errno() . ") " . mysql_error() . " \n";
|
---|
35 | exit();
|
---|
36 | }
|
---|
37 |
|
---|
38 | $pass=$db->afetch($res);
|
---|
39 | $db->free_result($res);
|
---|
40 |
|
---|
41 | if ((($pass[0] == $pwd && !empty($pass[0])) AND ($pass[1] == $site_id && !empty($pass[1])))) {
|
---|
42 | return $adminSave = 1;
|
---|
43 | } else {
|
---|
44 | return $adminSave = 0;
|
---|
45 | }
|
---|
46 | }
|
---|
47 | }
|
---|
48 |
|
---|
49 | ?>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.