Condense list verification and use in both add and sub

This commit is contained in:
Mcat12
2016-12-30 11:49:39 -05:00
parent 769525342b
commit 5ab9f75e45
3 changed files with 37 additions and 34 deletions
+29
View File
@@ -105,4 +105,33 @@ function check_domain() {
}
}
}
function list_verify($type) {
if(!isset($_POST['domain'], $_POST['list']) && !(isset($_POST['pw']) || isset($_POST['token']))) {
log_and_die("Missing POST variables");
}
if(isset($_POST['token']))
{
check_cors();
check_csrf($_POST['token']);
}
elseif(isset($_POST['pw']) && $_POST['list'] == "white")
{
require("password.php");
if(strlen($pwhash) == 0)
{
log_and_die("No password set - ${type}listing with password not supported");
}
elseif($wrongpassword)
{
log_and_die("Wrong password - ${type}listing of ${_POST['domain']} not permitted");
}
}
else
{
log_and_die("Not allowed!");
}
check_domain();
}
?>