-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
56ee5c7
commit 6717eb0
Showing
11 changed files
with
245 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
<?php $path=is_numeric($GLOBALS['PAGE'])?'/':''; ?> | ||
<div id="footer"> | ||
<p><small><a class="tool" target="_blank" href="https://github.com/GM-Script-Writer-62850/PHP-Scanner-Server/issues"><?php echo html($GLOBALS['NAME']); ?><span class="tip">Help and Support</span></a> version <a class="tool" href="download.php?ver=<?php echo html($GLOBALS['VER']); ?>&downloadServer"><?php echo $GLOBALS['VER']; ?><span class="tip">Download</span></a> is | ||
running on <a href="/"><?php echo html($_SERVER['SERVER_NAME']); ?></a> and there are <a href="index.php?page=About">release notes</a> advailable.</small></p> | ||
<p><small><a class="tool" target="_blank" href="https://github.com/GM-Script-Writer-62850/PHP-Scanner-Server/issues"><?php echo html($GLOBALS['NAME']); ?><span class="tip">Help and Support</span></a> version <a class="tool" href="<?php echo $path; ?>download.php?ver=<?php echo html($GLOBALS['VER']); ?>&downloadServer"><?php echo $GLOBALS['VER']; ?><span class="tip">Download</span></a> is | ||
running on <a href="/"><?php echo html($_SERVER['SERVER_NAME']); ?></a> and there are <a href="<?php echo $path; ?>index.php?page=About">release notes</a> advailable.</small></p> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
function html($X){ | ||
return htmlspecialchars($X);// Name is too long and subject to frequent typos | ||
} | ||
$PAGE=http_response_code(); | ||
$NAME="PHP Scanner Server"; | ||
$VER="1.3-7_dev"; | ||
$page="Error"; | ||
include("header.php"); | ||
?> | ||
<div class="box box-full"><h2>HTTP Status Code: <?php echo $PAGE; ?></h2><p style="text-align:center"><?php echo $PAGE==200?'Ok, you found me':'That is a error'; ?></p></div> | ||
<?php | ||
include("footer.php"); | ||
?></body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
<?php | ||
if(isset($_POST['json'])&&!isset($PAGE)){ | ||
$file='../config/.htaccess'; | ||
if(!is_file($file)){// For security reasons | ||
$file=@fopen($file,'w+'); | ||
@fwrite($file,"<files \"accounts.json\">\n\tDeny from all\n</files>\n");// Options All -Indexes\n | ||
@fclose($file); | ||
} | ||
function Allow(){ | ||
setcookie("Authenticated",true,time()+86400,"/",$_SERVER['SERVER_NAME']); | ||
} | ||
$file="../config/accounts.json"; | ||
$json=json_decode(is_file($file)?file_get_contents($file):'{}'); | ||
|
||
$mode=$_POST["mode"]; | ||
$user=$_POST["name"]; | ||
$pass=$_POST["pass"]; | ||
|
||
if(strlen($user)==0) | ||
die('{"message":"You must have a name","error":true}'); | ||
if($mode=="login"){ | ||
if(isset($json->{$user})){ | ||
if($json->{$user}->{"md5"}==md5($pass)){ | ||
$msg="You are now logged in"; | ||
Allow(); | ||
} | ||
else | ||
die('{"message":"Invalid password","error":true}'); | ||
} | ||
else | ||
die('{"message":"Invalid User Name","error":true}'); | ||
} | ||
else if($mode=="create"){ | ||
if(isset($json->{$user})){ | ||
die('{"message":"The user name \''.$user.'\' is taken","error":true}'); | ||
} | ||
if(!isset($json->{"root"})&&$user=='root'){ | ||
if($pass!=$_POST["auth"]) | ||
die('{"message":"Authorization was unsuccessful","error":true}'); | ||
$json->{"root"}=array("md5" => md5($pass) ); | ||
$msg="The user '$user' has been created. DON'T FORGET YOUR PASSWORD, YOU SHOULD KNOW BETTER"; | ||
} | ||
else if(isset($json->{'root'})){ | ||
if(md5($_POST["auth"])==$json->{"root"}->{"md5"}){ | ||
$json->{$user}=array("md5" => md5($pass) ); | ||
$msg="The user '$user' has been created"; | ||
} | ||
} | ||
else | ||
die('{"message":"Authorization was unsuccessful","error":true}'); | ||
Allow(); | ||
} | ||
else if($mode=="forgot"){ | ||
if(!isset($json->{$user})) | ||
die('{"message":"Invalid User Name","error":true}'); | ||
if(!isset($json->{'root'})) | ||
$json->{"root"}=array( "md5" => null ); | ||
if($json->{"root"}->{"md5"}!=md5($_POST["auth"])) | ||
die('{"message":"Authorization was unsuccessful","error":true}'); | ||
$json->{$user}->{"md5"}=md5($pass); | ||
if(strlen($_POST["newp"])==0){ | ||
unset($json->{$user}); | ||
$msg="The user '$user' has been deleted"; | ||
} | ||
else | ||
$msg="'$user' now has a new password"; | ||
Allow(); | ||
} | ||
else if($mode=="change"){ | ||
if(!isset($json->{$user})) | ||
die('{"message":"Invalid User Name","error":true}'); | ||
if($json->{$user}->{"md5"}==md5($pass)) | ||
$json->{$user}->{"md5"}=md5($_POST["newp"]); | ||
else | ||
die('{"message":"Invalid password","error":true}'); | ||
if(strlen($_POST["newp"])==0){ | ||
unset($json->{$user}); | ||
$msg="The user '$user' has been deleted"; | ||
} | ||
else | ||
$msg="'$user' now has a new password"; | ||
Allow(); | ||
} | ||
else | ||
die('{"message":"What mode?","error":true}'); | ||
if($mode!="login"){ | ||
$file=@fopen($file,'w+'); | ||
@fwrite($file,json_encode($json)); | ||
@fclose($file); | ||
if(is_bool($file)) | ||
die(json_encode(array("message" => "Unable to create <code>$file</code>, go read the instructions.", "error" => true))); | ||
} | ||
die(json_encode(array("message" => $msg, "error" => false))); | ||
} | ||
else if(isset($_GET['nojs'])) | ||
header("Location: http://www.enable-javascript.com/"); | ||
?><div class="box box-full dualForm"><h2>Authorization Required</h2> | ||
<form action="/inc/login.php?nojs=true" method="POST" onsubmit="return login(this);"> | ||
<h3>Login</h3><p> | ||
<input type="hidden" name="mode" value="login"/> | ||
<span>User Name:</span><input type="text" name="name"/><br/> | ||
<span>Password:</span><input type="password" name="pass"/><br/> | ||
<input type="submit" value="Login"/> | ||
</p></form> | ||
<form class="m" action="/inc/login.php" method="POST" onsubmit="return login(this);" autocomplete="off"> | ||
<h3>Create Account</h3><p> | ||
<input type="hidden" name="mode" value="create"/> | ||
<span>User Name:</span><input type="text" name="name"/></span><br/> | ||
<span>Password:</span><input type="password" name="pass"/><br/> | ||
<span>Authorization:</span><input type="password" name="auth"/><br/> | ||
<input type="submit" value="Register"/> | ||
</p></form> | ||
</div> | ||
|
||
<div class="box box-full dualForm"><h2>Account Recovery</h2> | ||
<form action="/inc/login.php?nojs=true" method="POST" onsubmit="return login(this);" autocomplete="off"> | ||
<h3>Change Password</h3><p> | ||
<input type="hidden" name="mode" value="change"/> | ||
<span>User Name:</span><input type="text" name="name"/><br/> | ||
<span>Old Password:</span><input type="password" name="pass"/><br/> | ||
<span>New Password:</span><input type="password" name="newp"/><br/> | ||
<input type="submit" value="Change"/> | ||
</p></form> | ||
<form class="m" action="/inc/login.php?nojs=true" method="POST" onsubmit="return login(this);" autocomplete="off"> | ||
<h3>Forgot Password</h3><p> | ||
<input type="hidden" name="mode" value="forgot"/> | ||
<span>User Name:</span><input type="text" name="name"/></span><br/> | ||
<span>New Password:</span><input type="password" name="pass"/><br/> | ||
<span>Authorization:</span><input type="password" name="auth"/><br/> | ||
<input type="submit" value="Change"/> | ||
</p></form> | ||
<div class="footer">Leave 'New Password' blank to delete the account</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.