<?php
$wp_include = "../wp-load.php";$i = 0;
while (!file_exists($wp_include) && $i++ < 10) {$wp_include = "../$wp_include";} require($wp_include);
if ( !is_user_logged_in() || !current_user_can('edit_posts') ) 
	wp_die(__("You are not allowed to be here","cloudfw"));

$id = $_GET["id"];
$ga = $_GET["ga"];
$nonce = $_GET["nonce"];

if (!isset($nonce)) {echo 'ERROR'; die();}

if (!isset($id) && !isset($ga)) {echo 'ERROR'; die();}

if (wp_create_nonce('cloudfw') !== $nonce) {echo 'ERROR'; die();}

check_admin_referer();



if (isset($ga)) {
	update_option(PFIX."_ga_id", NULL);
	update_option(PFIX."_ga_pass", NULL);
	update_option(PFIX."_ga_profile", NULL);
	wp_redirect($_SERVER['HTTP_REFERER']);
};

global $_params;
update_option($id, $_params[$id]);

wp_redirect($_SERVER['HTTP_REFERER']);

?>