<?php
session_start();
ob_start();
if (isset($_SESSION['us_name']) AND isset($_SESSION['us_password'])){
	require_once("db_connect.php");
	$change=htmlspecialchars($_GET["change"]);
	$sql="UPDATE system SET on_off='$change' WHERE id=1";
	if ($conn->query($sql) === TRUE) {
		$_SESSION['on_off']=$change;
		header("Location: user.php");
					    

	} else {
		header("Location: user.php");
	}


}else{
  header ("Location: index.php"); 
}
ob_end_flush();
?>