This repository has been archived by the owner on Mar 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 71
/
index.php
237 lines (226 loc) · 8.87 KB
/
index.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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<?php
/**
Open source CAD system for RolePlaying Communities.
Copyright (C) 2017 Shane Gill
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
(at your option) any later version.
This program comes with ABSOLUTELY NO WARRANTY; Use at your own risk.
**/
if(!file_exists(getcwd().'/oc-config.php') && is_writable(getcwd())){
header('Location://'.$_SERVER['SERVER_NAME'].'/oc-install/start.php');
}
require_once(__DIR__ . "/oc-config.php");
require_once(__DIR__ . "/actions/register.php");
require_once(__DIR__ . "/actions/publicFunctions.php");
$testing = false; //If set to true, will default some data for you
session_start();
$_SESSION['root_path'] = getcwd();
$registerError = "";
$registerSuccess = "";
$loginMessage = "";
if ( (isset($_SESSION['logged_in'])) == "YES" )
{
header ('Location: ./dashboard.php');
; //echo $_SESSION['name']." is logged in!";
}
if (isset($_GET['loggedOut']))
{
$loginMessage = '<div class="alert alert-success" style="text-align: center;" ><span>You\'ve successfully been logged out</span></div>';
}
if(isset($_SESSION['register_error']))
{
}
if(isset($_SESSION['register_error']))
{
$registerError = '<div class="alert alert-danger" style="text-align: center;"><span>'.$_SESSION['register_error'].'</span></div>';
unset($_SESSION['register_error']);
}
if(isset($_SESSION['register_success']))
{
$registerError = '<div class="alert alert-success" style="text-align: center;"><span>'.$_SESSION['register_success'].'</span></div>';
unset($_SESSION['register_success']);
}
if(isset($_SESSION['loginMessageDanger']))
{
$loginMessage = '<div class="alert alert-danger" style="text-align: center;"><span>'.$_SESSION['loginMessageDanger'].'</span></div>';
unset($_SESSION['loginMessageDanger']);
}
?>
<!DOCTYPE html>
<html lang="en">
<?php include "./oc-includes/header.inc.php"; ?>
<body class="login">
<div>
<a class="hiddenanchor" id="signup"></a>
<a class="hiddenanchor" id="signin"></a>
<a class="hiddenanchor" id="civreg"></a>
<div class="login_wrapper">
<div class="animate form login_form civ_login">
<?php echo $loginMessage;?>
<section class="login_content">
<form role="form" action="<?php echo BASE_URL; ?>/actions/login.php" method="post">
<h1>Login</h1>
<div>
<input class="form-control" placeholder="Email" name="email" type="text" value="<?php if($testing){echo "[email protected]";}?>" required>
</div>
<div>
<input class="form-control" placeholder="Password" name="password" type="password" value="<?php if($testing){echo "password";}?>" required >
</div>
<div>
<input name="login_btn" type="submit" class="btn btn-default submit" value="Login" />
<a class="reset_pass" href="#" onclick="alert('Request an administrator reset your password through your community.');" >Lost your password?</a>
</div>
<?php if (CIV_REG === true) { ?>
<div class="clearfix"></div>
<div class="separator">
<p class="change_link">New?
<a href="#signup" class="to_register"> Request Access </a>
</p>
<p class="change_link">Civilian Only?
<a href="#civreg" class="to_register"> Request Access as Civilian </a>
</p>
<div class="clearfix"></div>
<br />
<div>
<h1><i class="fas fa-users"></i> <?php echo COMMUNITY_NAME?> CAD System</h1>
<h2> OpenCAD Version <?php getOpenCADVersion();?> </h2>
</div>
</div>
<?php } else { ?>
<div class="clearfix"></div>
<div class="separator">
<p class="change_link">New?
<a href="#signup" class="to_register"> Request Access </a>
</p>
<p class="change_link">Civilian Only? Not Enabled
</p>
<div class="clearfix"></div>
<br />
<div>
<h1><i class="fas fa-users"></i> <?php echo COMMUNITY_NAME?> CAD System</h1>
<h2> OpenCAD Version <?php getOpenCADVersion();?> </h2>
</div>
</div>
<?php } ?>
</form>
</section>
</div>
<div id="register" class="animate form registration_form">
<section class="login_content">
<?php echo $registerError, $registerSuccess;?>
<form action="<?php echo BASE_URL; ?>/actions/register.php" method="post">
<h1>Request Access</h1>
<div>
<input class="form-control" placeholder="Name" name="uname" type="text" required>
</div>
<div>
<input class="form-control" placeholder="Email" name="email" type="email" required>
</div>
<div>
<input class="form-control" placeholder="Identifier (Code Number, Unit ID)" name="identifier" type="text" required>
</div>
<div class="form-group">
<input class="form-control" placeholder="Password" name="password" type="password" value="<?php if($testing){echo "password";}?>" required>
</div>
<!-- ./ form-group -->
<div class="form-group">
<input class="form-control" placeholder="Confirm Password" name="password1" type="password" required>
</div>
<!-- ./ form-group -->
<div class="form-group">
<label>Division (Select all that apply)</label>
<select class="form-control selectpicker" id="division" name="division[]" multiple="multiple" size="6" required>
<?php getDataSetTable($dataSet = "departments", $column1 = "department_id", $column2 = "department_long_name", $leadTrim = 17, $followTrim = 11, $isRegistration = true, $isVehicle = false); ?>
</select>
</div>
<div class="clearfix"></div>
<div>
<input name="register" type="submit" class="btn btn-default btn-sm pull-right" value="Request Access" />
</div>
<div class="clearfix"></div>
<div class="separator">
<p class="change_link">Already a member?
<a href="#signin" class="to_register"> Log in </a>
</p>
<div class="clearfix"></div>
<br />
<div>
<h1><i class="fas fa-users"></i> <?php echo COMMUNITY_NAME ?> CAD System</h1>
<h2> OpenCAD Version <?php getOpenCADVersion();?> </h2>
</div>
</div>
</form>
</section>
</div>
<?php if (CIV_REG === true) { ?>
<div id="civ" class="animate form civilian_form">
<section class="login_content">
<?php echo $registerError, $registerSuccess;?>
<form action="<?php echo BASE_URL; ?>/actions/register.php" method="post">
<h1>Civilian Registration</h1>
<div>
<input class="form-control" placeholder="Name" name="uname" type="text" value="<?php if($testing){echo "Test";}?>" required>
</div>
<div>
<input class="form-control" placeholder="Email" name="email" type="email" value="<?php if($testing){echo "[email protected]";}?>" required>
</div>
<div>
<input class="form-control" placeholder="Identifier (Code Number, Unit ID)" name="identifier" type="text" value="<?php if($testing){echo "1A-1";}?>" required>
</div>
<div class="form-group">
<input class="form-control" placeholder="Password" name="password" type="password" value="<?php if($testing){echo "password";}?>" required>
</div>
<!-- ./ form-group -->
<div class="form-group">
<input class="form-control" placeholder="Confirm Password" name="password1" type="password" value="<?php if($testing){echo "password";}?>" required>
</div>
<!-- ./ form-group -->
<div class="clearfix"></div>
<div>
<input name="civreg" type="submit" class="btn btn-default btn-sm pull-right" value="Register" />
</div>
<div class="clearfix"></div>
<div class="separator">
<p class="change_link">Already a member?
<a href="#signin" class="to_register"> Log in </a>
</p>
<div class="clearfix"></div>
<br />
<div>
<h1><i class="fas fa-users"></i> <?php echo COMMUNITY_NAME ?> CAD System</h1>
<h2> OpenCAD Version <?php getOpenCADVersion();?> </h2>
</div>
</div>
</form>
</section>
</div>
<?php } else { ?>
<div id="civ" class="animate form civilian_form">
<?php echo $registerError, $registerSuccess;?>
<p>Stop trying to backdoor into OpenCAD
This has been logged. </p>
<div class="clearfix"></div>
<div class="separator">
<p class="change_link">Already a member?
<a href="#signin" class="to_register"> Log in </a>
</p>
<div class="clearfix"></div>
<div>
<h1><i class="fas fa-users"></i> <?php echo COMMUNITY_NAME ?> CAD System</h1>
<h2> OpenCAD Version <?php getOpenCADVersion();?> </h2>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
<?php include "./oc-includes/jquery-colsolidated.inc.php"; ?>
<script type="text/javascript">
$(document).ready(function() {
// $('#division').multiselect();
});
</script>
</body>
</html>