<?php
$path="../../";
include("../../map.php");
include("../../secure.php");
if($_GET["durum"]=="isayfa"){
	$xiarr = array();
	foreach ($_POST as $key => $value){
		if(substr($key,0,3)=="spi"){
			$xiarr = $xiarr + array($key => $value);
		}
	}
	$xrjsi = json_encode($xiarr, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
	if($_POST['xs2']==""){$s2=0;}else{$s2=$_POST['xs2'];}
	if($_POST['s7']==""){$s7=0;}else{$s7=$_POST['s7'];}
	if($_POST['s13']==""){$s13=0;}else{$s13=$_POST['s13'];}
	if($_POST['s19']==""){$s19=$_SESSION["user_id"];}else{$s19=$_POST['s19'];}
	if(!empty($_GET["isayfaid"])){
		$Rsq = mysqli_query($conn, "update t1 set t1='".addslashes(stripslashes($_POST["xt1"]))."', t2='".$_POST['xt2']."', t3='".$_POST['xt3']."', t4='".$_POST['xt4']."', t5='".$_POST['xt5']."', t6='".$_POST['xt6']."', n1='".addslashes(stripslashes($_POST["xn1"]))."', n2='".addslashes(stripslashes($_POST["xn2"]))."', n3='".addslashes(stripslashes($_POST["xn3"]))."', n4='".addslashes(stripslashes($_POST["xn4"]))."', n5='".$_POST['xn5']."', n6='".$_POST['xn6']."', n17='".addslashes(stripslashes($xrjsi))."', s2='".$s2."', s7='".$s7."', s13='".$s13."', s19='".$s19."' Where ne='isayfa' and id='".$_GET['isayfaid']."' ");
	}else{
		$conn->query("insert INTO t1(t1,t2,t3,t4,t5,t6,ne,n1,n2,n3,n4,n5,n6,n17,s1,s2,s7,s13,s19,ts1) VALUES ('".addslashes(stripslashes($_POST["xt1"]))."', '".$_POST['xt2']."', '".$_POST['xt3']."', '".$_POST['xt4']."', '".$_POST['xt5']."', '".$_POST['xt6']."', 'isayfa', '".addslashes(stripslashes($_POST["xn1"]))."', '".addslashes(stripslashes($_POST["xn2"]))."', '".addslashes(stripslashes($_POST["xn3"]))."', '".addslashes(stripslashes($_POST["xn4"]))."', '".$_POST['xn5']."', '".$_POST['xn6']."', '".addslashes(stripslashes($xrjsi))."', '".$_GET['id']."', '".$s2."', '".$s7."', '".$s13."', s19='".$s19."', now());");
		echo "url:?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&id=".$_GET["id"]."&durum=ok&tab=isayfa";
	}
}elseif($_GET["durum"]=="sisayfa"){
	$sql=mysqli_query($conn, "select * from medya where t3='".$_GET["ne"]."' and s1=".$_GET["id"]." and s4=".$_GET["isayfaid"].""); while($rsi=mysqli_fetch_assoc($sql)){
		if($_SESSION["V3Server"]==""){
			$dosya1="../../../deppo/image/".$rsi["t1"].""; unlink($dosya1);
			$dosya2="../../../deppo/image/k_".$rsi["t1"].""; unlink($dosya2);
			$dosya3="../../../deppo/video/".$rsi["t7"].".jpg";unlink($dosya3);
			$dosya4="../../../deppo/dosya/".$rsi["t1"]."";unlink($dosya4);
			$sql = mysqli_query($conn, "delete from medya where id=".$rsi["id"]."");
		}
	}
	$sql = mysqli_query($conn, "delete from t1 where id=".$_GET["isayfaid"]);	
}
?>