<?php

################################################
# EVILCMS FLATFILE RECODE - 100% FUNCTIONALITY #
################################################

Session_Start();

If($CMS->LoggedIn):
	If($_USER['rank'] == "admin") {
		If(isset($_POST['username']) && isset($_POST['variable']) && isset($_POST['value'])) {
			If($CMS->User_Exist($_POST['username']) && in_array($_POST['variable'], $CMS->UserFiles)) {
				$CMS->User_SetValue($_POST['username'], $_POST['variable'], $_POST['value']);
				Echo "User updated.<br />";
			}Else{
				$CMS->Error("Invalid values or user, please redo request.");
			}
		}
		Echo "<form method=\"post\" action=\"?p=edituser\">";
		Echo "User: ".$CMS->printAllUsers("username")."<br />";
		Echo "Setting: ".$CMS->printSettings("variable")."<br />";
		Echo "Value: <input type=\"text\" name=\"value\"><br />";
		Echo "<input type=\"submit\" value=\"Edit!\">";
		Echo "</form>";
	}else{
		Echo "You dont have sufficient rights.";
	}
Else:
	Echo "Please login first.";
EndIf;

?>