1 | <?php
|
---|
2 |
|
---|
3 | ##############################################
|
---|
4 | # WL-CMS inclusion #
|
---|
5 | # adapted to Accessbile Portal #
|
---|
6 | # ================= #
|
---|
7 | # Copyright (c) 2010 by Weblord #
|
---|
8 | # http://www.weblord.it #
|
---|
9 | # http://www.webelite.it #
|
---|
10 | # http://www.portaleacccessibile.com #
|
---|
11 | ##############################################
|
---|
12 |
|
---|
13 | if (!defined('FILEMANAGER_FILE')) {
|
---|
14 | die("Non puoi accedere direttamente a questo file...");
|
---|
15 | }
|
---|
16 | error_reporting(E_ALL ^ E_NOTICE);
|
---|
17 | function check_admin() {
|
---|
18 | @require_once("../../../../config.php");
|
---|
19 | @require_once("db.class.php");
|
---|
20 | $db=new DBConnection($dbhost,$dbuname,$dbpass,$dbname);
|
---|
21 |
|
---|
22 | if(isset($HTTP_COOKIE_VARS)) {
|
---|
23 | $_COOKIE = $HTTP_COOKIE_VARS;
|
---|
24 | }
|
---|
25 | $admin = $_COOKIE['admin'];
|
---|
26 |
|
---|
27 | if (!$admin) { return 0; }
|
---|
28 | $adminSave = 0;
|
---|
29 | static $adminSave;
|
---|
30 | if (isset($adminSave)) return $adminSave;
|
---|
31 | $admin = base64_decode($admin);
|
---|
32 | $admin = addslashes($admin);
|
---|
33 | $admin = explode(':', $admin);
|
---|
34 |
|
---|
35 | $aid = $admin[0];
|
---|
36 | $pwd = $admin[1];
|
---|
37 | $site_id = $admin[3];
|
---|
38 |
|
---|
39 | $aid = substr(addslashes($aid), 0, 25);
|
---|
40 | if (!empty($aid) && !empty($pwd)) {
|
---|
41 |
|
---|
42 | $query = "SELECT pwd, site_id FROM ".$prefix."_authors WHERE aid='$aid'";
|
---|
43 | $res=$db->rq($query);
|
---|
44 | if (!$res)
|
---|
45 | {
|
---|
46 | echo " Errore di MySQL: (" . mysql_errno() . ") " . mysql_error() . " \n";
|
---|
47 | exit();
|
---|
48 | }
|
---|
49 |
|
---|
50 | $pass=$db->afetch($res);
|
---|
51 | $db->free_result($res);
|
---|
52 |
|
---|
53 | if ((($pass[0] == $pwd && !empty($pass[0])) AND ($pass[1] == $site_id && !empty($pass[1])))) {
|
---|
54 | return $adminSave = 1;
|
---|
55 | } else {
|
---|
56 | return $adminSave = 0;
|
---|
57 | }
|
---|
58 | }
|
---|
59 | }
|
---|
60 |
|
---|
61 | ?>
|
---|