<?php 
	
	// We check in which language we will work
	if (isset($_SESSION["DATAGLOBAL"][0]) && !empty($_SESSION["DATAGLOBAL"][0])) $C->LANGUAGE = $_SESSION["DATAGLOBAL"][0];

	$this->load_langfile('inside/admin.php');

	// We are here only if you're logged in
	if (!$this->user->is_logged || !$this->user->info->is_network_admin) {
		echo('0: '.$this->lang('admin_no_session'));
		die();
	}
	
	$errored = 0;
	$txterror = '';
	
	$action=0;
	
	if (isset($_POST["todo"]) && $_POST["todo"] != '') $action = $this->db1->e($_POST["todo"]);
	if (!is_numeric($action)) {
		$errored = 1;
		$txterror .= 'Error... ';
		echo('0: '.$txterror);
		die();
	}

	// Edit ad of user
	if ($action == 1)	{
		$emailpay = $emailpaynot = '';
		
		if (isset($_POST["empay"]) && !empty($_POST["empay"])) $emailpay = $this->db1->e($_POST["empay"]);
		if (isset($_POST["empaynot"]) && !empty($_POST["empaynot"])) $emailpaynot = $this->db1->e($_POST["empaynot"]);
		
		if (empty($emailpay)) { $errored = 1; $txterror .= 'Error... '; }
		if (empty($emailpaynot)) { $errored = 1; $txterror .= 'Error... '; }
	}


	
	if ($errored == 1) {
		echo('0: '.$txterror);
	} else {

		if ($action == 1) {
		
			$this->db1->query("UPDATE settings SET value='".$emailpay."' WHERE word='EMAIL_PAYPAL' LIMIT 1");
			$this->db1->query("UPDATE settings SET value='".$emailpaynot."' WHERE word='EMAIL_NOTIFICATION_PAYPAL' LIMIT 1");
			$txtreturn = $this->lang('admin_ads_configads_msgok');
			echo('1: '.$txtreturn);
			return;
		}
	
	}
?>