-
Notifications
You must be signed in to change notification settings - Fork 19
/
chess_club_page.php
172 lines (126 loc) · 4.71 KB
/
chess_club_page.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<?php
////////////////////////////////////////////////////////////////////////////
//
// (c) phpChess Limited, 2004-2006, in association with Goliath Systems.
// All rights reserved. Please observe respective copyrights.
// phpChess - Chess at its best
// you can find us at http://www.phpchess.com.
//
////////////////////////////////////////////////////////////////////////////
define('CHECK_PHPCHESS', true);
$host = $_SERVER['HTTP_HOST'];
$self = $_SERVER['PHP_SELF'];
$query = !empty($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : null;
$url = !empty($query) ? "http://$host$self?$query" : "http://$host$self";
header("Content-Type: text/html; charset=utf-8");
session_start();
ob_start();
$isappinstalled = 0;
include("./includes/install_check.php");
if($isappinstalled == 0){
header("Location: ./not_installed.php");
}
// This is the vairable that sets the root path of the website
$Root_Path = "./";
$config = $Root_Path."bin/config.php";
$Contentpage = "cell_chess_club_page.php";
require($Root_Path."bin/CSkins.php");
//Instantiate the CSkins Class
$oSkins = new CSkins($config);
$SkinName = $oSkins->getskinname();
$oSkins->Close();
unset($oSkins);
//////////////////////////////////////////////////////////////
//Skin - standard includes
//////////////////////////////////////////////////////////////
$SSIfile = "./skins/".$SkinName."/standard_cfg.php";
if(file_exists($SSIfile)){
include($SSIfile);
}
//////////////////////////////////////////////////////////////
require($Root_Path."bin/CR3DCQuery.php");
require($Root_Path."bin/CTipOfTheDay.php");
require($Root_Path."includes/siteconfig.php");
require($Root_Path."includes/language.php");
//////////////////////////////////////////////////////////////
//Instantiate the CR3DCQuery Class
$oR3DCQuery = new CR3DCQuery($config);
$bCronEnabled = $oR3DCQuery->IsCronManagementEnabled();
//////////////////////////////////////////////////////////////
if(!isset($_SESSION['sid']) && !isset($_SESSION['user']) && !isset($_SESSION['id']) ){
$user = trim($_POST['txtName']);
$pass = trim($_POST['txtPassword']);
if($user != "" && $pass !=""){
$sid = $oR3DCQuery->Login($user, $pass);
$id = $oR3DCQuery->GetIDByUserID($config, $user);
if($sid != ""){
$_SESSION['sid'] = $sid;
$_SESSION['user'] = $user;
$_SESSION['id'] = $id;
$_SESSION['password'] = $pass;
$_SESSION['language'] = $languagefile;
//Get Chessboard colors
$d = "";
$l = "";
$oR3DCQuery->GetChessBoardColors($config, $_SESSION['id'], $l, $d);
$_SESSION['lcolor'] = $l;
$_SESSION['dcolor'] = $d;
if($oR3DCQuery->IsPlayerDisabled($id) == false){
//Create the cookie if auto login
if($chkAutoLogin == "1"){
$cookie_data = $user."|".base64_encode($pass)."|".$languagefile;
setcookie("TestCookie", $cookie_data, time()+360000);
}
$oR3DCQuery->AddOnlinePlayerToGraphData($_SESSION['user']);
$oR3DCQuery->UpdateLastLoginInfo($_SESSION['id']);
if($_SESSION['PageRef'] != ""){
header("Location: ".$_SESSION['PageRef']."");
}else{
header("Location: ./chess_members.php");
}
}else{
if($_COOKIE['TestCookie'] != ""){
setcookie("TestCookie", $cookie_data, time()-360000);
}
header("Location: ./chess_logout.php");
}
}
}
}else{
if($oR3DCQuery->CheckLogin($config, $_SESSION['sid']) == false){
header('Location: ./chess_login.php');
}
}
if(!$bCronEnabled){
if($oR3DCQuery->ELOIsActive()){
$oR3DCQuery->ELOCreateRatings();
}
$oR3DCQuery->MangeGameTimeOuts();
}
// Posted variables
$clubid = $_GET['clubid'];
?>
<html>
<head>
<title><?php echo GetStringFromStringTable("IDS_PAGETITLES_30", $config);?></title>
<META NAME="keywords" CONTENT="">
<META NAME="DESCRIPTION" CONTENT="">
<META NAME="OWNER" CONTENT="Christian">
<META NAME="RATING" CONTENT="General">
<META NAME="ROBOTS" CONTENT="index,follow">
<META HTTP-EQUIV="CONTENT-LANGUAGE" CONTENT="English">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="<?php echo $Root_Path."skins/".$SkinName."/";?>layout.css" type="text/css">
<?php include($Root_Path."includes/javascript.php");?>
</head>
<body>
<?php include("./skins/".$SkinName."/layout_cfg.php");?>
</body>
</html>
<?php
//////////////////////////////////////////////////////////////
$oR3DCQuery->Close();
unset($oR3DCQuery);
//////////////////////////////////////////////////////////////
ob_end_flush();
?>