<?php
	/*OmegaBB 0.9.4*/
	header( 'Cache-control: no-cache' );
	header( 'Cache-control: no-store' );
	header( 'Pragma: no-cache' );
	header( 'Expires: 0' ); 

    include('omegabb.php');
	
	$code=GetParam($_REQUEST,'code','');
    $expire_time=GetParam($_REQUEST,'expire_time','');
	$msg=GetParam($_REQUEST,'msg','');
	$turn_off=GetParam($_REQUEST,'turn_off','');
	$ck=GetParam($_REQUEST,'ck','');
	
	$auth_ret = Check_Auth();
    if (!IsMod($auth_ret)) {
    	echo "-1^?".intext("user not a moderator");
    	return;
    }   
	
    if ($code < 0) {
    	echo "-1^?".intext("Invalid data");
		return;
    }   
	
	$rowx = perform_query("select control_key from session where user_id=$auth_ret",SELECT);
	if ($rowx->control_key != $ck) {
	   echo "-1^?".intext("Bad control key");
	   return;
	}
	
	if ($turn_off) {echo UnsetLockdownButton($ck); return;}
	
	if (!isAdmin($auth_ret) && ($code > 15 || $expire_time == "i") ) {
    	echo "-1^?".intext("You must be an administrator to do this");
    	return;
    }   
	
    echo SetLockdownButton($auth_ret,$code,$expire_time,$msg,$ck);           		
?>