<?php

$file='config.php';

include 'config.php';
if($__testMode==true)
{
	return true;
}
else
{

if(!isset($_GET["ONLYINFO"]))
{

	if((!isset($_GET["username"]) || $_GET["username"] =="" ) || (!isset($_GET["password"]) || $_GET["password"] =="" ) )
	{
		echo "UserName and password is required";
		return;
	}
	if(isset($_GET["username"]) && $_GET["username"] !="" )
	{
		$content=file_get_contents($file);
		$content = preg_replace('/\$__username=\"(.*?)\";/', '$__username="'. $_GET["username"] .'";', $content);
		file_put_contents($file,$content);	
	}
	if(isset($_GET["password"]) && $_GET["password"] !="" )
	{
		$content=file_get_contents($file);
		$content = preg_replace('/\$__password=\"(.*?)\";/', '$__password="'. $_GET["password"] .'";', $content);
		file_put_contents($file,$content);	
	}

}


if(isset($_GET["default_publisher"]) && $_GET["default_publisher"] !="" )
{
	$content=file_get_contents($file);
	$content = preg_replace('/\$__default_publisher=\"(.*?)\";/', '$__default_publisher="'. $_GET["default_publisher"] .'";', $content);
	file_put_contents($file,$content);	
}
if(isset($_GET["default_publisher_email"]) && $_GET["default_publisher_email"] !="" )
{
	$content=file_get_contents($file);
	$content = preg_replace('/\$__default_publisher_email=\"(.*?)\";/', '$__default_publisher_email="'. $_GET["default_publisher_email"] .'";', $content);
	file_put_contents($file,$content);	
}
if(isset($_GET["default_PublisherWebsite"]) && $_GET["default_PublisherWebsite"] !="" )
{
	$content=file_get_contents($file);
	$content = preg_replace('/\$__default_PublisherWebsite=\"(.*?)\";/', '$__default_PublisherWebsite="'. $_GET["default_PublisherWebsite"] .'";', $content);
	file_put_contents($file,$content);	
}

if(isset($_GET["FCM_SERVER_KEY"]) && $_GET["FCM_SERVER_KEY"] !="" )
{
	$content=file_get_contents($file);
	$content = preg_replace('/\$__FCM_SERVER_KEY=\"(.*?)\";/', '$__FCM_SERVER_KEY="'. $_GET["FCM_SERVER_KEY"] .'";', $content);
	file_put_contents($file,$content);	
}
echo "success";

}
?>