<?php
	$path="../../";
	include("../../map.php");
	if($_GET["durum"]=="dsifre"){
		$Rss = mysqli_query($conn, "update genel set t2='".v3e($_POST["pass"])."', t3='".v3e($_POST["gkod"])."' where ne='asifre' and t1='YWRtaW4=' and t2='".v3e($_POST["epass"])."'");
		echo  "<i class=\"fa fa-check\" style=\"font-size:24px; color:#1f4a04\"></i> ".$sdil[212]."";
	}elseif($_GET["durum"]=="kaydet"){
		if(!empty($_POST['n10'])) {
		$firm_array = array();	//Firma
		foreach ($_POST as $key => $value)
			if($key[0]=="x"){
				$firm_array = $firm_array + array( substr($key, 1) => $value);
			}
		}
		$social_array = array();	//Sosyal
		foreach ($_POST as $key => $value){
			if($key[0]=="y"){
				$social_array = $social_array + array( substr($key, 1) => $value);
			}
		}
		$t_array = array();	//tbox
		foreach ($_POST as $key => $value){
			if($key[0]=="j"){
				$t_array = $t_array + array( substr($key, 1) => $value);
			}
		}
		$all_array = array();
		foreach ($_POST as $key => $value){
			if($key[0]=="t" or $key[0]=="n" or $key[0]=="i" or $key[0]=="x" or $key[0]=="y" or $key[0]=="j"){}else{
				$all_array = $all_array + array( $key => $value);
			}
		}
		if (!$all_array) { exit(); }	//Ayarların boşalmasını engellemek için
		
		$ex_array = array(
			"d" => date("d"),
			"m" => date("m"),
			"y" => date("Y"),
			"h" => date("h"),
			"usd" => $_POST["zusd"],
			"eur" => $_POST["zeur"],
			"gbp" => $_POST["zgbp"],
			"grgold" => $_POST["zgr"],
			"btc" => $_POST["zbtc"]
		);
		$rexchange = json_encode($ex_array, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
		$t40s = $rexchange;	//manuelse gelen veriyi basıyor.
		$rall = json_encode($all_array, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
		$rtbox = json_encode($t_array, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
		$rfirm = json_encode($firm_array, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
		$rsocial = json_encode($social_array, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
		if($_POST["s8"]<>""){
			$plangs = explode(',',$_POST["m1"]); $l=0; foreach($plangs as $plang){$l++;
				$Rsq = mysqli_query($conn, "update lang".$l." set n1='".addslashes(stripslashes($_POST["n1"]))."', n2='".addslashes(stripslashes($_POST["n2"]))."', n4='".addslashes(stripslashes($_POST["n4"]))."' where ne='ayarlar'");
			}
		}else{
			$Rsq = mysqli_query($conn, "update ".$_SESSION['lang']." set n1='".addslashes(stripslashes($_POST["n1"]))."', n2='".addslashes(stripslashes($_POST["n2"]))."', n4='".addslashes(stripslashes($_POST["n4"]))."' where ne='ayarlar'");
		}
		$Rsq = mysqli_query($conn, "update ".$_SESSION['lang']." set i2='".$_POST["i2"]."', i3='".$_POST["i3"]."', i4='".$_POST["i4"]."', i5='".$_POST["i5"]."', i6='".$_POST["i6"]."', i7='".$_POST["i7"]."', i8='".$_POST["i8"]."', i9='".$_POST["i9"]."', i10='".$_POST["i10"]."', i11='".$_POST["i11"]."', i12='".$_POST["i12"]."', i13='".$_POST["i13"]."', i14='".$_POST["i14"]."', i15='".$_POST["i15"]."', i16='".$_POST["i16"]."', i17='".$_POST["i17"]."', i18='".$_POST["i18"]."', i19='".$_POST["i19"]."', i20='".$_POST["i20"]."', i21='".$_POST["i21"]."', i22='".$_POST["i22"]."', i23='".$_POST["i23"]."', i24='".$_POST["i24"]."', i25='".$_POST["i25"]."', i26='".$_POST["i26"]."', i27='".$_POST["i27"]."', i28='".$_POST["i28"]."', i29='".$_POST["i29"]."', i30='".$_POST["i30"]."' where ne='ayarlar'");
		$Rsq = mysqli_query($conn, "update ".$_SESSION['lang']." set t1='".$_POST["t1"]."', t2='".$_POST["t2"]."', t3='".$_POST["t3"]."', t4='".$_POST["t4"]."', t5='".$_POST["t5"]."', t6='".$_POST["t6"]."', t7='".$_POST["t7"]."', t8='".$_POST["t8"]."', t9='".$_POST["t9"]."', t10='".$_POST["t10"]."', t11='".$_POST["t11"]."', t12='".$_POST["t12"]."', t13='".$_POST["t13"]."', t14='".$_POST["t14"]."', t15='".$_POST["t15"]."', t16='".$_POST["t16"]."', t17='".$_POST["t17"]."', t18='".$_POST["t18"]."', t19='".$_POST["t19"]."', t20='".$_POST["t20"]."' where ne='ayarlar'");
		$Rsq = mysqli_query($conn, "update ".$_SESSION['lang']." set n3='".$_POST["n3"]."', n9='".$_POST["n9"]."', n10='".addslashes(stripslashes($_POST["n10"]))."', n11='".addslashes(stripslashes($rfirm))."', n14='".$_POST["n14"]."', n15='".addslashes(stripslashes($_POST["n15"]))."', n16='".addslashes(stripslashes($rsocial))."', n19='".addslashes(stripslashes($rtbox))."', n20='".addslashes(stripslashes($_POST["n20"]))."', t28='".$_POST["t28"]."' where ne='ayarlar'");
		$plangs = explode(',',$_POST["m1"]); $l=0; foreach($plangs as $plang){$l++;
			$Rsq = mysqli_query($conn, "update lang".$l." set n5='".$_POST["n5"]."', n6='".$_POST["n6"]."', n7='".$_POST["n7"]."', n8='".$_POST["n8"]."', n12='".addslashes(stripslashes($_POST["n12"]))."', n13='".addslashes(stripslashes($_POST["n13"]))."', n14='".addslashes(stripslashes($_POST["n14"]))."', n17='".addslashes(stripslashes($_POST["n17"]))."', n18='".addslashes(stripslashes($rall))."', t21='".$_POST["t21"]."', t22='".$_POST["t22"]."', t23='".$_POST["t23"]."', t24='".$_POST["t24"]."', t25='".$_POST["t25"]."', t26='".$_POST["t26"]."', t28='".$_POST["t28"]."', t36='".$_POST["t36"]."', t37='".$_POST["t37"]."', t38='".$_POST["t38"]."', t40='".addslashes(stripslashes($t40s))."', t41='".$_POST["t41"]."', t42='".$_POST["t42"]."', t43='".$_POST["t43"]."', t46='".$_POST["t46"]."', i2='".$_POST["i2"]."' where ne='ayarlar'");
		}
		echo  "<i class=\"fa fa-check\" style=\"font-size:24px; color:#1f4a04\"></i> ".$sdil[212]."";
	}
	//}
	include("../public/log.php");
	include("../public/set_script.php");
?>