<?php 

$dir = '../../';

require_once $dir.'includes/main.php';

$admin_password = clean($_POST['admin_password']);

if(query("UPDATE _settings SET admin_password = '{$admin_password}'")){

    setcookie('admin_password', $admin_password, $t + (60*60*24*30*12), '/');

    // send success
    $message = array('type' => 'SUCCESS', 'message' => "Password updated successfully. Thank you");
    echo json_encode($message);

}else{

    // send success
    $message = array('type' => 'ERROR', 'message' => ERROR_DATABASE);
    echo json_encode($message);

}

?>