-
Notifications
You must be signed in to change notification settings - Fork 1
/
InitialRegister1st.php
executable file
·106 lines (99 loc) · 2.63 KB
/
InitialRegister1st.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
<?php
/*
Copyright © 2009,2015,2022 Siggi Bjarnason.
Licensed under GNU GPL v3 and later. Check out LICENSE.TXT for details
or see <https://www.gnu.org/licenses/gpl-3.0-standalone.html>
Page for initial setup. Only valid if setup hasn't been done,
should self destruct once successful.
*/
require("header.php");
if(isset($_POST["btnSubmit"]))
{
$btnSubmitValue = $_POST["btnSubmit"];
}
else
{
$btnSubmitValue = "";
}
if($strReferer != $strPageURL and $PostVarCount > 0)
{
printPg("Invalid operation, Bad Reference!!!","error");
exit;
}
if(!isset($GLOBALS["ConfArray"]["InitSetup"]) )
{
printPg("Setup Mode isn't enable so you can't use this page","error");
exit;
}
require("FileInv.php");
$strQuery = "UPDATE tblmenu SET iReadPriv='300' WHERE vcLink = 'FileInv.php';";
UpdateSQL($strQuery,"update");
$RegHeader = $TextArray["RegForm"];
$strQuery = "SELECT iPrivLevel FROM tblprivlevels WHERE vcPrivName LIKE '%admin%';";
$iLevel = GetSQLValue($strQuery);
if($iLevel < 1)
{
$iLevel = 300;
}
$strName = "";
$strAddr1 = "";
$strAddr2 = "";
$strCity = "";
$strState = "";
$strZip = "";
$strCountry = "";
$iPrivLevel = "";
$strEmail = "";
$strUserID = "";
$strCell = "";
$bSuccess = FALSE;
$bRegOK = FALSE;
if($btnSubmitValue == "Submit")
{
require_once("CleanReg.php");
if($strEmail)
{
$strNameParts = explode(" ",$strName);
$HowMany = count($strNameParts);
if($HowMany==1)
{
printPg("Please provide both first and last name","error");
}
else
{
if(!$bSpam)
{
require("UserAdd.php");
}
}
}
else
{
printPg("Can't create new admin account without an email..","error");
}
}
$bSuccess = $bRegOK;
if($bSuccess)
{
$strQuery = "DELETE FROM tblconf WHERE vcValueName='InitSetup' LIMIT 1;";
UpdateSQL($strQuery,"delete");
$strQuery = "DELETE FROM tblPageTexts WHERE vcTextName='SetupReg' LIMIT 1;";
UpdateSQL($strQuery,"delete");
$strQuery = "DELETE FROM tblmenu WHERE vcLink='$strPageName' LIMIT 1;";
UpdateSQL($strQuery,"delete");
if(strtolower($DevEnvironment) != "true")
{
unlink($strPageName);
}
printPg("<a href='index.php'>Setup completed. Click here to go home</a>","note");
}
else
{
printPg("$RegHeader","note");
print "<form method=\"POST\">\n";
require("UserRegForm.php");
print "<tr>\n<td colspan=\"2\" align=\"center\"><input type=\"Submit\" value=\"Submit\" name=\"btnSubmit\"></td>\n</tr>\n";
print "</table>\n</form>\n";
}
require("footer.php");
?>