<?php
include "../CheckUser.php";
include "../comm/config.php";
?>
<?php 
$action = $_GET["action"]; 


	if ($action == "WebConfig")
	{
		$yywdyb_companyName = $_POST["yywdyb_companyName"];
		$yywdyb_SaleTel = $_POST["yywdyb_SaleTel"];
		$yywdyb_TechTel = $_POST["yywdyb_TechTel"];
		$yywdyb_Fax = $_POST["yywdyb_Fax"];
		$yywdyb_Address = $_POST["yywdyb_Address"];
		$yywdyb_mobile = $_POST["yywdyb_mobile"];
		$yywdyb_QQ = $_POST["yywdyb_QQ"];
		$yywdyb_Mail = $_POST["yywdyb_Mail"];
		$CopyRight = $_POST["CopyRight"];
		$WebTitle = $_POST["WebTitle"];
		$WebDescription = $_POST["WebDescription"];
		$file = fopen("../comm/Inc.php","w"); 
		$SetText = "<?php 
		";
		$SetText = $SetText."\$localhost = "."\"".$localhost."\";
		";
		$SetText = $SetText."\$datebase = "."\"".$datebase."\";
		";
		$SetText = $SetText."\$username = "."\"".$username."\";
		";
		$SetText = $SetText."\$passwd = "."\"".$passwd."\";
		";
		$SetText = $SetText."\$db = "."'yyth_';
		";
		$SetText = $SetText."\$server_name = "."\"".$server_name."\";
		";
		$SetText = $SetText."\$adminUser = "."\"".$adminUser."\";
		";
		$SetText = $SetText."\$adminPass = "."\"".$adminPass."\";
		";
		$SetText = $SetText."\$img_file_url = "."\"".$img_file_url."\";
		";
		
		$SetText = $SetText."\$companyName = "."\"".$yywdyb_companyName."\";
		";	
		$SetText = $SetText."\$Address = "."\"".$yywdyb_Address."\";
		";
		$SetText = $SetText."\$SaleTel = "."\"".$yywdyb_SaleTel."\";
		";	
		$SetText = $SetText."\$TechTel = "."\"".$yywdyb_TechTel."\";
		";
		$SetText = $SetText."\$Fax = "."\"".$yywdyb_Fax."\";
		";	
		$SetText = $SetText."\$mobile = "."\"".$yywdyb_mobile."\";
		";
		$SetText = $SetText."\$QQ = "."\"".$yywdyb_QQ."\";
		";
		$SetText = $SetText."\$Mail = "."\"".$yywdyb_Mail."\";
		";	
		$SetText = $SetText."\$CopyRight = "."\"".$CopyRight."\";
		";
		$SetText = $SetText."\$WebTitle = "."\"".$WebTitle."\";
		";
		$SetText = $SetText."\$WebDescription = "."\"".$WebDescription."\";
		";
		$SetText = $SetText."\$WebLinkType = "."\"".$WebLinkType."\";
		";				
		$SetText = $SetText."?>";
		
		fwrite($file,$SetText); 
		fclose($file); 
		header("location:WebConfig.php");
	}else if($action == "SetUser" )
	{
		$yywdyb_adminUser = $_POST["yywdyb_adminUser"];
		$yywdyb_adminPass = $_POST["yywdyb_adminPass"];
		$yywdyb_adminPass2 = $_POST["yywdyb_adminPass2"];
		$OldPass = $_POST["OldPass"];
		
		if($yywdyb_adminPass == $yywdyb_adminPass2 && $yywdyb_adminUser == $adminUser && $adminPass)
		{
		$file = fopen("../comm/Inc.php","w"); 
		$SetText = "<?php 
		";
		$SetText = $SetText."\$localhost = "."\"".$localhost."\";
		";
		$SetText = $SetText."\$datebase = "."\"".$datebase."\";
		";
		$SetText = $SetText."\$username = "."\"".$username."\";
		";
		$SetText = $SetText."\$passwd = "."\"".$passwd."\";
		";
		$SetText = $SetText."\$db = "."'yyth_';
		";
		$SetText = $SetText."\$server_name = "."\"".$server_name."\";
		";
		$SetText = $SetText."\$adminUser = "."\"".$yywdyb_adminUser."\";
		";
		$SetText = $SetText."\$adminPass = "."\"".$yywdyb_adminPass."\";
		";
		$SetText = $SetText."\$img_file_url = "."\"".$img_file_url."\";
		";
		
		$SetText = $SetText."\$companyName = "."\"".$companyName."\";
		";	
		$SetText = $SetText."\$Address = "."\"".$Address."\";
		";
		$SetText = $SetText."\$SaleTel = "."\"".$SaleTel."\";
		";	
		$SetText = $SetText."\$TechTel = "."\"".$TechTel."\";
		";
		$SetText = $SetText."\$Fax = "."\"".$Fax."\";
		";	
		$SetText = $SetText."\$mobile = "."\"".$mobile."\";
		";
		$SetText = $SetText."\$QQ = "."\"".$QQ."\";
		";
		$SetText = $SetText."\$Mail = "."\"".$Mail."\";
		";	
		$SetText = $SetText."\$CopyRight = "."\"".$CopyRight."\";
		";
		$SetText = $SetText."\$WebTitle = "."\"".$WebTitle."\";
		";
		$SetText = $SetText."\$WebDescription = "."\"".$WebDescription."\";
		";
		$SetText = $SetText."\$WebLinkType = "."\"".$WebLinkType."\";
		";							
		$SetText = $SetText."?>";
		
		
		fwrite($file,$SetText); 
		fclose($file); 
		}
		header("location:EditUser.php");	
	}else if($action == "SetSearch" )
	{
		$yywdyb_WebLinkType = $_POST["radiobutton"];
		if(trim($yywdyb_WebLinkType) != "")
		{
			$file = fopen("../comm/Inc.php","w"); 
			$SetText = "<?php 
			";
			$SetText = $SetText."\$localhost = "."\"".$localhost."\";
			";
			$SetText = $SetText."\$datebase = "."\"".$datebase."\";
			";
			$SetText = $SetText."\$username = "."\"".$username."\";
			";
			$SetText = $SetText."\$passwd = "."\"".$passwd."\";
			";
			$SetText = $SetText."\$db = "."'yyth_';
			";
			$SetText = $SetText."\$server_name = "."\"".$server_name."\";
			";
			$SetText = $SetText."\$adminUser = "."\"".$adminUser."\";
			";
			$SetText = $SetText."\$adminPass = "."\"".$adminPass."\";
			";
			$SetText = $SetText."\$img_file_url = "."\"".$img_file_url."\";
			";
			
			$SetText = $SetText."\$companyName = "."\"".$companyName."\";
			";	
			$SetText = $SetText."\$Address = "."\"".$Address."\";
			";
			$SetText = $SetText."\$SaleTel = "."\"".$SaleTel."\";
			";	
			$SetText = $SetText."\$TechTel = "."\"".$TechTel."\";
			";
			$SetText = $SetText."\$Fax = "."\"".$Fax."\";
			";	
			$SetText = $SetText."\$mobile = "."\"".$mobile."\";
			";
			$SetText = $SetText."\$QQ = "."\"".$QQ."\";
			";
			$SetText = $SetText."\$Mail = "."\"".$Mail."\";
			";	
			$SetText = $SetText."\$CopyRight = "."\"".$CopyRight."\";
			";
			$SetText = $SetText."\$WebTitle = "."\"".$WebTitle."\";
			";
			$SetText = $SetText."\$WebDescription = "."\"".$WebDescription."\";
			";
			$SetText = $SetText."\$WebLinkType = "."\"".$yywdyb_WebLinkType."\";
			";				
			$SetText = $SetText."?>";
			
			fwrite($file,$SetText); 
			fclose($file); 
		}
		header("location:SearchSet.php");
	}else
	{
		header("location:../Login.php");
	}
?>
