Location: PHPKode > projects > Admbook > admin/user-status.php
<?php
	class Timer {
		var $startTime;
		var $endTime;
		function start() {
			$this->startTime = gettimeofday();
		}
		function stop() {
			$this->endTime = gettimeofday();
		}
		function elapsed() {
			return (($this->endTime["sec"] - $this->startTime["sec"]) * 1000000 + ($this->endTime["usec"] - $this->startTime["usec"])) / 1000000;
		}
	}
	$timer = new Timer();
	$timer->start();
	session_start();
	include("../settings-data.php");
	include("../lib.php");
	checkPermissions($login, $password);
	if (!isset($id))
	{
		session_destroy();
		Header("Location: login.php");exit;
	}
	include("../users-data.php");
	$contentCnt = sizeof($user);
	$newContent = "<?php\n";
	if (!isset($user[$id-1]))
	{
		session_destroy();
		Header("Location: login.php");exit;
	}
	if ($user[$id-1]['status'])
		$user[$id-1]['status'] = 0;
	else
		$user[$id-1]['status'] = 1;

	for($i = 0; $i < $contentCnt; $i++)
	{
		while(list($key, $value) = each($user[$i]))
		{
			$newContent .= "\t\$user[".$i."]['".$key."'] = \"".$value."\";\n";
		}
		if ($i != $contentCnt-1)
			$newContent .= "\n";
	}
	$newContent .= "?>";
	reWriteDataInFile ($newContent,"../users-data.php");
	$timer->stop();
	Header("Location: user-list.php?".$timer->elapsed());exit;
?>
Return current item: Admbook