forked from MEschenbacher/ts3web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheader.php
114 lines (101 loc) · 3.18 KB
/
header.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
/*
*Copyright (C) 2012-2013 Psychokiller
*
*This program is free software; you can redistribute it and/or modify it under the terms of
*the GNU General Public License as published by the Free Software Foundation; either
*version 3 of the License, or any later version.
*
*This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
*without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*See the GNU General Public License for more details.
*
*You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
if(!defined("SECURECHECK")) {die("Error: The file can not be executed alone");}
session_start();
if(isset($_POST['skey']) OR isset($_SESSION['server_ip']) AND isset($_SESSION['server_tport']))
{
if(!isset($_SESSION['server_ip']) AND !isset($_SESSION['server_tport']) OR isset($_POST['skey']))
{
$_SESSION['skey']=$_POST['skey'];
$_SESSION['server_ip']=$server[$_POST['skey']]['ip'];
$_SESSION['server_tport']=$server[$_POST['skey']]['tport'];
}
$ts3=new ts3admin($_SESSION['server_ip'], $_SESSION['server_tport']);
if($ts3->getElement('success', $ts3->connect())===true)
{
$serverstatus=true;
}
else
{
$serverstatus=false;
}
}
$uip=$_SERVER['REMOTE_ADDR'];
if(isset($_POST['loginUser'])) {$lg_user=$_POST['loginUser'];}
if(isset($_POST['loginPw'])) {$lg_pw=$_POST['loginPw'];}
$loginstatus=false;
$hoststatus=false;
if(!empty($lg_user) AND !empty($lg_pw))
{
if($ts3->getElement('success', $ts3->login($lg_user, $lg_pw))===true)
{
$loginstatus=true;
$_SESSION['logged']=true;
$_SESSION['userip']=$uip;
$_SESSION['loginuser']=$lg_user;
$_SESSION['loginpw']=base64_encode(serialize($lg_pw));
$whoami=$ts3->getElement('data', $ts3->whoAmI());
check_version_consistency($neededversionkey);
if($whoami['client_origin_server_id']!=0)
{
$_SESSION['loginsid']=$whoami['client_origin_server_id'];
}
else
{
$hoststatus=true;
}
}
}
if(isset($_SESSION['logged']) AND $_SESSION['logged']===true AND $_SESSION['userip']==$uip AND $serverstatus===true)
{
if($ts3->getElement('success', $ts3->login($_SESSION['loginuser'], unserialize(base64_decode($_SESSION['loginpw']))))===false)
{
$loginstatus=false;
$hoststatus=false;
$ts3->logout();
session_destroy();
}
else
{
$loginstatus=true;
$whoami=$ts3->getElement('data', $ts3->whoAmI());
check_version_consistency($neededversionkey);
if($whoami['client_origin_server_id']==0)
{
$hoststatus=true;
}
}
}
if(isset($_SESSION['logged']) AND $_SESSION['logged']===true AND $_SESSION['userip']!=$uip)
{
$loginstatus=false;
$hoststatus=false;
$ts3->logout();
session_destroy();
}
if($site=='logout' AND $loginstatus===true)
{
$hoststatus=false;
$loginstatus=false;
$ts3->logout();
session_destroy();
}
require_once('site/footer.php');
$footer=implode("", file('templates/'.$style.DS.'index.tpl'));
if(md5($footer2.$footer3)!='3065534252aa6d5e72504589c7910335' OR strpos($footer, '{$footer}')===false)
{
die();
}
?>