<?php
	header('Content-Type: text/html; charset=utf-8');
	error_reporting(0);
	$path="../../";
	include("../../map.php");
	include("../../secure.php");
	include("../../scripts.php");
	$sorgu ="";
	if($_GET["nedir"]<>""){
		$sorgu .=" and n3='".$_GET["nedir"]."'";
	}
	if($_GET["kid"]<>""){
		$sorgu .=" and n2='".$_GET["kid"]."'";
	}
	$grups=explode(',', $module["grup_inputs"]);
	$scats = json_decode(GetArr("s","categories"), true);
	$sitems = json_decode(GetArr("sayfa"), true);
	$hcats = json_decode(GetArr("h","categories"), true);
	$mcats = json_decode(GetArr("m","categories"), true);
	$mitems = json_decode(GetArr("msayfa"), true);
	$ccats = json_decode(GetArr("k","categories"), true);
	$citems = json_decode(GetArr("users"), true);
	$ucats = json_decode(GetArr("u","categories"), true);
	$uitems = json_decode(GetArr("kayit"), true);
	$rcats = json_decode(GetArr("r","categories"), true);
	$ritems = json_decode(GetArr("reklam"), true);
	$xcats = json_decode(GetArr("x","xmodules"), true);
?>
<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo $sdil[197]; //Özel Alan?></title>
</head>
<body>
	<div class="alert alert-warning" id="result" style="display:none;"></div>
    <div class="" style="padding:0px 15px; font-size:13px;">
        <div class="row">
            <!-- İçerik alanı -->
            <div class="col-12">
                <div class="tab-content" id="pills-tabContent">
                    <div class="tab-pane show active" id="pills-content-1" role="tabpanel" aria-labelledby="pills-tab-1">
							<table class="table filterable" style="min-width:1400px; font-size: 13px;">
							<form method="POST" action="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&nedir=<?php echo $_GET["nedir"];?>&kid=<?php echo $_GET["kid"];?>&durum=add" autocomplete="off" id="iform" name="iform" style="min-width:1000px; display:block;">
								<input name="s1" type="hidden" value="0">
								<tr class="addtr" onclick="vtr('trn8');">
									<td><input type="text" name="n1" id="n1" class="form-control" placeholder="Input Name"></td>
									<td class="w10 mw10">
										<select size="1" name="n2[]" id="n2"  class="form-control">
											<option value="0" <?php if($_GET["kid"]=="0"){echo "Selected";}?>>Tüm</option>
											<?php if($m14<>0){ ?>
												<optgroup label="<?php echo $t24s[0];?>">
													<option value="kSide" title="kSide" alt="kSide" class="v3-bg-success" <?php if($_GET["kid"]=="kSide" or $_SESSION["sn2"]=="kSide"){echo "Selected";}?>><?php echo $t24s[0];?> [Side]</option>
													<?php if($a4>0){?>
														<?php foreach($ucats as $key=>$value){?>
															<?php if(($value["ne"]=="ukategori" or ($value["t1"]=="kayit" and $value["s1"]=="0"))){?>
																<option value="<?php echo $value["id"];?>" class="v3-bg-danger" <?php if($_GET["kid"]==$value["id"] or $_SESSION["sn2"]==$value["id"]){echo "selected";}?>>+ <?php echo $value["item"];?> [<?php echo $value["id"];?>]</option>
															<?php }elseif(($value["ne"]=="ualt_kategori" or ($value["t1"]=="kayit" and $value["s1"]<>"0" and $value["s2"]=="0"))){?>
																<option value="<?php echo $value["id"];?>" class="v3-bg-danger" <?php if($_GET["kid"]==$value["id"] or $_SESSION["sn2"]==$value["id"]){echo "selected";}?>>- <?php echo $value["item"];?> [<?php echo $value["id"];?>]</option>
															<?php }elseif(($value["ne"]=="ualt_kategori2" or ($value["t1"]=="kayit" and $value["s2"]<>"0" and $value["s3"]=="0"))){?>
																<option value="<?php echo $value["id"];?>" class="v3-bg-danger" <?php if($_GET["kid"]==$value["id"] or $_SESSION["sn2"]==$value["id"]){echo "selected";}?>>. <?php echo $value["item"];?> [<?php echo $value["id"];?>]</option>
															<?php }?>
														<?php }?>
													<?php }?>
													<?php foreach($uitems as $key=>$value){?>
														<option value="<?php echo $value["id"];?>" class="v3-bg-info" <?php if($_GET["kid"]==$value["id"] or $_SESSION["sn2"]==$value["id"]){echo "selected";}?>># <?php echo $value["item"];?> [<?php echo $value["id"];?>]</option>
													<?php }?>
												</optgroup>
											<?php }?>
											<?php if($m13<>0){ ?>
												<optgroup label="<?php echo $t21;?>">
													<option value="sSide" title="sSide" alt="sSide" class="v3-bg-success" <?php if($_GET["kid"]=="sSide" or $_SESSION["sn2"]=="sSide"){echo "Selected";}?>><?php echo $t21s[0];?> [Side]</option>
													<?php if($d10>0){?>
														<?php foreach($scats as $key=>$value){?>
															<option value="<?php echo $value["id"];?>" class="v3-bg-danger" <?php if($_GET["kid"]==$value["id"] or $_SESSION["sn2"]==$value["id"]){echo "selected";}?>>+ <?php echo $value["item"];?> [<?php echo $value["id"];?>]</option>
														<?php }?>
													<?php }?>
													<?php foreach($sitems as $key=>$value){?>
														<option value="<?php echo $value["id"];?>" class="v3-bg-info" <?php if($_GET["kid"]==$value["id"] or $_SESSION["sn2"]==$value["id"]){echo "selected";}?>>#  <?php echo $value["item"];?> [<?php echo $value["id"];?>]</option>
													<?php }?>
												</optgroup>
											<?php }?>
											<?php if($m11<>0){ ?>
												<optgroup label="<?php echo $t22;?>">
													<option value="hSide" title="hSide" alt="hSide" class="v3-bg-success" <?php if($_GET["kid"]=="hSide" or $_SESSION["sn2"]=="hSide"){echo "Selected";}?>><?php echo $t22s[0];?> [Side]</option>
													<?php if($b1<>0){ ?>
														<?php foreach($hcats as $key=>$value){?>
															<option value="<?php echo $value["id"];?>" class="v3-bg-danger" <?php if($_GET["kid"]==$value["id"] or $_SESSION["sn2"]==$value["id"]){echo "selected";}?>>+ <?php echo $value["item"];?> [<?php echo $value["id"];?>]</option>
														<?php }?>
													<?php }?>
												</optgroup>
											<?php }?>
											<?php if($m15>0){?>
												<optgroup label="<?php echo $t25;?>">
													<option value="uSide" title="uSide" alt="uSide" class="v3-bg-success" <?php if($_GET["kid"]=="uSide" or $_SESSION["sn2"]=="uSide"){echo "Selected";}?>><?php echo $t25s[0];?> [Side]</option>
													<?php if($h4>0){?>
														<?php foreach($ccats as $key=>$value){?>
															<option value="<?php echo $value["id"];?>" class="v3-bg-danger" <?php if($_GET["kid"]==$value["id"] or $_SESSION["sn2"]==$value["id"]){echo "selected";}?>>+ <?php echo $value["item"];?> [<?php echo $value["id"];?>]</option>
														<?php }?>
													<?php }?>
												</optgroup>
											<?php }?>
											<?php if($c1<>0){?>
												<optgroup label="<?php echo $n8;?>">
													<option value="mSide" title="mSide" alt="mSide" class="v3-bg-success" <?php if($_GET["kid"]=="mSide" or $_SESSION["sn2"]=="mSide"){echo "Selected";}?>><?php echo $n8s[0];?> [Side]</option>
													<?php if($g7>0){ ?>
														<?php foreach($mcats as $key=>$value){?>
															<option value="<?php echo $value["id"];?>" class="v3-bg-danger" <?php if($_GET["kid"]==$value["id"] or $_SESSION["sn2"]==$value["id"]){echo "selected";}?>>+ <?php echo $value["item"];?> [<?php echo $value["id"];?>]</option>
														<?php }?>
													<?php }?>
													<?php foreach($mitems as $key=>$value){?>
														<option value="<?php echo $value["id"];?>" class="v3-bg-info" <?php if($_GET["kid"]==$value["id"] or $_SESSION["sn2"]==$value["id"]){echo "selected";}?>># <?php echo $value["item"];?> [<?php echo $value["id"];?>]</option>
													<?php }?>
												</optgroup>
											<?php }?>
										</select>
										
									</td>
									<td class="w7 mw7">
										<select name="n3" class="form-control" id="n3" onchange="change()">
											<option value="">Modul</option>
											<?php if($m11<>0){?>
												<optgroup label="<?php echo $t22;?>">
													<option value="haber" <?php if($_GET["nedir"]=="haber"){echo "selected";}?>><?php echo $t22s[0];?></option>
													<?php if($module["g1_haber"]==1){?>
														<option value="haber_isayfa" <?php if($_SESSION["sn3"]=="haber_isayfa"){echo "selected";}?>><?php echo $t22s[0];?> Alt</option>
													<?php }?>
													<?php if($module["d6_haber"]==1){?>
														<option value="haber_extra" <?php if($_SESSION["sn3"]=="haber_extra"){echo "selected";}?>><?php echo $t22s[0];?> Ext</option>
													<?php }?>
												</optgroup>
											<?php }?>
											<?php $sqlx=mysqli_query($conn, "select id,n1,n2 from genel where ne='xmodules' order by s10 asc,id desc"); while($rsx=mysqli_fetch_assoc($sqlx)){?>
												<optgroup label="<?php echo str_replace("-","",$rsx["n1"]);?>">
													<option value="<?php echo $rsx["n2"]?>" <?php if($_GET["nedir"]==$rsx["n2"] or $_SESSION["sn3"]==$rsx["n2"]){echo "selected";}?>><?php echo str_replace("-","",$rsx["n1"]);?></option>
													<?php if($module["g1_".$rsx["n2"].""]==1){?>
														<option value="<?php echo $rsx["n2"]?>_isayfa" <?php if($_SESSION["sn3"]=="".$rsx["n2"]."_isayfa"){echo "selected";}?>><?php echo str_replace("-","",$rsx["n1"]);?> Alt</option>
													<?php }?>
													<?php if($module["d6_".$rsx["n2"].""]==1){?>
														<option value="<?php echo $rsx["n2"];?>_extra" <?php if($_SESSION["sn3"]=="".$rsx["n2"]."_extra"){echo "selected";}?>><?php echo str_replace("-","",$rsx["n1"]);?> Ext</option>
													<?php }?>
												</optgroup>
											<?php }?>
											<?php if($m13<>0){?>
												<optgroup label="<?php echo $t21;?>">
													<option value="sayfa" <?php if($_GET["nedir"]=="sayfa" or $_SESSION["sn3"]=="sayfa"){echo "selected";}?>><?php echo $t21s[0];?></option>
													<?php if($module["g1_sayfa"]==1){?>
														<option value="sayfa_isayfa" <?php if($_SESSION["sn3"]=="sayfa_isayfa"){echo "selected";}?>><?php echo $t21s[0];?> Alt</option>
													<?php }?>
													<?php if($module["d6_sayfa"]==1){?>
														<option value="sayfa_extra" <?php if($_SESSION["sn3"]=="sayfa_extra"){echo "selected";}?>><?php echo $t21s[0];?> Ext</option>
													<?php }?>
												</optgroup>
											<?php }?>
											<?php if($c1<>0){?>
												<optgroup label="<?php echo $n8;?>">
													<option value="msayfa" <?php if($_GET["nedir"]=="msayfa" or $_SESSION["sn3"]=="msayfa"){echo "selected";}?>><?php echo $n8s[0];?></option>
													<?php if($module["g1_msayfa"]==1){?>
														<option value="msayfa_isayfa" <?php if($_SESSION["sn3"]=="msayfa_isayfa"){echo "selected";}?>><?php echo $n8s[0];?> Alt</option>
													<?php }?>
													<?php if($module["d6_msayfa"]==1){?>
														<option value="msayfa_extra" <?php if($_SESSION["sn3"]=="msayfa_extra"){echo "selected";}?>><?php echo $n8s[0];?> Ext</option>
													<?php }?>
												</optgroup>
											<?php }?>
											<?php if($m15<>0){?>
												<optgroup label="<?php echo $t25;?>">
													<option value="uye" <?php if($_GET["nedir"]=="uye" or $_SESSION["sn3"]=="uye"){echo "selected";}?>><?php echo $t25s[0];?></option>
													<option value="relations" <?php if($_GET["nedir"]=="relations" or $_SESSION["sn3"]=="relations"){echo "selected";}?>><?php echo $t25s[0];?> <?php echo ctranslate("İlişkileri");?></option>
													<?php if($module["h7"]==1){?>
														<option value="uye_extra" <?php if($_SESSION["sn3"]=="uye_extra"){echo "selected";}?>><?php echo $t25s[0];?> Ext</option>
													<?php }?>
												</optgroup>
											<?php }?>
											<?php if($m14<>0){?>
												<optgroup label="<?php echo $t24;?>">
													<option value="kayit" <?php if($_GET["nedir"]=="kayit" or $_SESSION["sn3"]=="kayit"){echo "selected";}?>><?php echo $t24s[0];?></option>
													<?php if($module["a11"]==1){?>
														<option value="kayit_isayfa" <?php if($_SESSION["sn3"]=="kayit_isayfa"){echo "selected";}?>><?php echo $t24s[0];?> Alt</option>
													<?php }?>
													<?php if($module["a6"]==1){?>
														<option value="kayit_extra" <?php if($_SESSION["sn3"]=="kayit_extra"){echo "selected";}?>><?php echo $t24s[0];?> Ext</option>
													<?php }?>
												</optgroup>
											<?php }?>
											<?php if($g9<>0){?>
												<option value="service" <?php if($_GET["nedir"]=="service" or $_SESSION["sn3"]=="service"){echo "selected";}?>><?php echo $t36s[0];?></option>
											<?php }?>
											<?php if($s20<>0){?>
												<option value="gorev" <?php if($_GET["nedir"]=="gorev" or $_SESSION["sn3"]=="gorev"){echo "selected";}?>><?php echo $tasks[0];?></option>
											<?php }?>
											<?php if($b6<>"0"){?>
												<option value="slide" <?php if($_GET["nedir"]=="slide" or $_SESSION["sn3"]=="slide"){echo "selected";}?>>Slide</option>
											<?php }?>
											<?php //if($_GET["nedir"]=="notlar"){?>
												<option value="notlar" <?php if($_GET["nedir"]=="notlar" or $_SESSION["sn3"]=="notlar"){echo "selected";}?>>Notlar</option>
												<?php //}?>
												<?php if($m9==1){?>
													<option value="reklam" <?php if($rs["n3"]=="reklam" or $_SESSION["sn3"]=="reklam"){echo "selected";}?>><?php echo $reklamlar; //Reklam Yönetimi?></option>
												<?php }?>
												<?php //if($a6<>0 or $d6<>0){?>
													<option value="kategori" <?php if($_GET["nedir"]=="kategori" or $_SESSION["sn3"]=="kategori"){echo "selected";}?>>Kategori</option>
													<?php //}?>
													<?php if($c2<>0){?>
														<option value="form" <?php if($_GET["nedir"]=="form" or $_SESSION["sn3"]=="form"){echo "selected";}?>>Form</option>
													<?php }?>
													<?php if($m16<>0){?>
														<option value="sepet" <?php if($_GET["nedir"]=="sepet" or $_SESSION["sn3"]=="sepet"){echo "selected";}?>>Sepet</option>
														<option value="siparis" <?php if($_GET["nedir"]=="siparis" or $_SESSION["sn3"]=="siparis"){echo "selected";}?>>Sipariş</option>
													<?php }?>
													<option value="ayarlar" <?php if($_GET["nedir"]=="ayarlar" or $_SESSION["sn3"]=="ayarlar"){echo "selected";}?>>Ayarlar</option>
													<option value="uniq">UniqCode</option>
												</select>
											</td>
											<td class="w7 mw7">
												<select name="n4" class="form-control" id="n4" onchange="change()">
													<option value=""><?php echo ctranslate("Tip")?></option>
													<option value="input" <?php if($_SESSION["sn4"]=="input"){echo "selected";}?>>Input</option>
													<option value="select" <?php if($_SESSION["sn4"]=="select"){echo "selected";}?>>Select</option>
													<option value="radio" <?php if($_SESSION["sn4"]=="radio"){echo "selected";}?>>Radio</option>
													<option value="checkbox" <?php if($_SESSION["sn4"]=="checkbox"){echo "selected";}?>>Checkbox</option>
													<option value="textarea" <?php if($_SESSION["sn4"]=="textarea"){echo "selected";}?>>Textarea</option>
													<option value="switch" <?php if($_SESSION["sn4"]=="switch"){echo "selected";}?>>Switch</option>
												</select>
											</td>
											<td class="w7 mw7">
												<select name="n5" class="form-control" id="n5" style="display:none;">
													<option value="">Model</option>
													<option value="text" <?php if($_SESSION["sn5"]=="text"){echo "selected";}?>><?php echo ctranslate("Yazı")?></option>
													<option value="number" <?php if($_SESSION["sn5"]=="number"){echo "selected";}?>><?php echo ctranslate("Sayı")?></option>
													<option value="email" <?php if($_SESSION["sn5"]=="email"){echo "selected";}?>>Email</option>
													<option value="password" <?php if($_SESSION["sn5"]=="password"){echo "selected";}?>><?php echo ctranslate("Şifre")?></option>
													<option value="color" <?php if($_SESSION["sn5"]=="color"){echo "selected";}?>><?php echo ctranslate("Renk")?></option>
													<option value="range" <?php if($_SESSION["sn5"]=="range"){echo "selected";}?>><?php echo ctranslate("Aralık")?></option>
													<option value="date" <?php if($_SESSION["sn5"]=="date"){echo "selected";}?>><?php echo ctranslate("Tarih")?></option>
													<option value="month" <?php if($_SESSION["sn5"]=="month"){echo "selected";}?>><?php echo ctranslate("Ay")?></option>
													<option value="time" <?php if($_SESSION["sn5"]=="time"){echo "selected";}?>><?php echo ctranslate("Tarih")?></option>
													<option value="datetime-local" <?php if($_SESSION["sn5"]=="datetime-local"){echo "selected";}?>><?php echo ctranslate("Tarih/Saat")?></option>
												</select>
											</td>
											<td class="w7 mw7">
												<select name="n6" class="form-control">
													<option value="">...</option>
													<option value="required"><?php echo ctranslate("Zorunlu")?></option>
												</select>
											</td>
											<td class="w7 mw7">
												<select name="n7" id="n7" class="form-control" style="display:block !important">
													<option value="0" <?php if($_SESSION["sn7"]=="0"){echo "selected";}?>>CrmPlus+</option>
													<option value="1" <?php if($_SESSION["sn7"]=="1"){echo "selected";}?> title="<?php echo ctranslate("Register")?>"><?php echo ctranslate("Register")?></option>
													<option value="2" <?php if($_SESSION["sn7"]=="2"){echo "selected";}?> title="<?php echo ctranslate("User Panel")?>"><?php echo ctranslate("User Panel")?></option>
													<option value="3" <?php if($_SESSION["sn7"]=="3"){echo "selected";}?> title="<?php echo ctranslate("Front")?>"><?php echo ctranslate("Front")?></option>
												</select>
											</td>
											<td class="w7 mw7">
												<select name="t2" id="t2" class="form-control">
													<option value="All">[0] <?php echo $sdil[132] //Tüm?></option>
													<?php $i = 0;$diller = explode(',',$m1); foreach($diller as $dil) {$i++; if($i > 99) {$i = 1;}?>
													<option value="lang<?php echo $i?>" <?php if ($_SESSION["lang"]=="lang".$i.""){?>Selected<?php }?>>[<?php echo $i;?>] <?php echo $dil;?></option>
													<?php }?>
												</select>
										</td>
										<td class="w7 mw7">
											<select name="s9" style=""  class="form-control">
												<option value="0" style="">Grup</option>
												<?php $a=0; foreach($grups as $grup) {$a++;?>
													<option value="<?php echo $a;?>" <?php if($rs["s9"]==$a){?>Selected<?php }?>><?php echo $grup;?></option>
												<?php }?>
											</select>
										</td>
										<td class="w5 mw5"><input type="text" name="s10" id="s10" class="form-control" placeholder="sıra" value="0" style="padding: 7px 3px; text-align: center;"></td>
										<td class="w6 mw6">
											<div class="input-group-btn">
												<button tabindex="-1" class="btn btn-warning mbtn demo" type="submit"><i class="fa fa-plus"></i></button>
											</div>
										</td>
									</tr>
									<tr style="display:none" id="trn8">
										<td colspan="1"><input type="text" name="n9" id="n9" class="form-control" placeholder="Açıklama"></td>
										<td colspan="1"><input type="text" name="n11" id="n11" class="form-control" placeholder="Placeholder"></td>
										<td colspan="1"><input type="text" name="t3" id="t3" class="form-control" placeholder="Name"></td>
										<td colspan="1"><input type="text" name="n12" id="n12" class="form-control" placeholder="Value"></td>
										<td colspan="1"><input type="text" name="n13" id="n13" class="form-control" placeholder="Class" title="autocomplate loc"></td>
										<td colspan="1"><input type="text" name="n14" id="n14" class="form-control" placeholder="fa fa-" title="fa fa-"></td>
										<td colspan="4"><input type="text" name="n8" id="n8" class="form-control" placeholder="Attribute"></td>
										<td colspan="1"><input type="text" name="n15" id="n15" class="form-control" placeholder="Div Class"></td>
									</tr>
								</form>
								<?php $sql=mysqli_query($conn, "select * from genel where ne='inputs' and s1=0 and (t2='' or t2='All' or t2='".$_SESSION["lang"]."') ".$sorgu." order by s10 asc, id desc"); while($rs=mysqli_fetch_assoc($sql)){ $jsop = json_decode($rs["n17"],true);?>
									<form method="POST" action="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&nedir=<?php echo $_GET["nedir"];?>&kid=<?php echo $_GET["kid"];?>&durum=edit&id=<?php echo $rs["id"];?>" id="xf<?php echo $rs["id"];?>" class="xf<?php echo $rs["id"];?>" name="xf<?php echo $rs["id"];?>" style="display:block;">
										<tr class="alert-info btr" style="">
											<td onclick="vtr('attr<?php echo $rs["id"];?>'); toggle('.otr<?php echo $rs["id"];?>')"><input type="text" name="n1" id="en1<?php echo $rs["id"]?>" class="form-control" placeholder="Input Name" value="<?php echo $rs["n1"];?>"><span class="dn"><?php echo $rs["n1"];?></span></td>
											<td class="w10 mw10">
												<?php $n2S = explode(',',$rs["n2"]);?>
												<select size="1" name="n2[]" id="en2<?php echo $rs["id"]?>" class="form-control">
													<option value="0" <?php if($rs["n2"]=="0"){echo "Selected";}?>>Tüm</option>
													<?php if($m14<>0){ ?>
														<optgroup label="<?php echo $t24s[0];?>">
															<option value="kSide" title="kSide" alt="kSide" class="v3-bg-success" <?php if($rs["n2"]=="kSide"){echo "Selected";}?>><?php echo $t24s[0];?> [Side]</option>
															<?php if($a4>0){?>
																<?php foreach($ucats as $key=>$value){?>
																	<?php if(($value["ne"]=="ukategori" or ($value["t1"]=="kayit" and $value["s1"]=="0"))){?>
																		<option value="<?php echo $value["id"];?>" class="v3-bg-danger" <?php foreach($n2S as $n2){if($n2==$value["id"]){echo "selected";}}?>>+ <?php echo $value["item"];?> [<?php echo $value["id"];?>]</option>
																	<?php }elseif(($value["ne"]=="ualt_kategori" or ($value["t1"]=="kayit" and $value["s1"]<>"0" and $value["s2"]=="0"))){?>
																		<option value="<?php echo $value["id"];?>" class="v3-bg-danger" <?php foreach($n2S as $n2){if($n2==$value["id"]){echo "selected";}}?>>- <?php echo $value["item"];?> [<?php echo $value["id"];?>]</option>
																	<?php }elseif(($value["ne"]=="ualt_kategori2" or ($value["t1"]=="kayit" and $value["s2"]<>"0" and $value["s3"]=="0"))){?>
																		<option value="<?php echo $value["id"];?>" class="v3-bg-danger" <?php foreach($n2S as $n2){if($n2==$value["id"]){echo "selected";}}?>>. <?php echo $value["item"];?> [<?php echo $value["id"];?>]</option>
																	<?php }?>
																<?php }?>
															<?php }?>
															<?php foreach($uitems as $key=>$value){?>
																<option value="<?php echo $value["id"];?>" class="v3-bg-info" <?php foreach($n2S as $n2){if($n2==$value["id"]){echo "selected";}}?>># <?php echo $value["item"];?> [<?php echo $value["id"];?>]</option>
															<?php }?>
														</optgroup>
													<?php }?>
													<?php if($m13<>0){ ?>
														<optgroup label="<?php echo $t21;?>">
															<option value="sSide" title="sSide" alt="sSide" class="v3-bg-success" <?php if($rs["n2"]=="sSide"){echo "Selected";}?>><?php echo $t21s[0];?> [Side]</option>
															<?php if($d10>0){?>
																<?php foreach($scats as $key=>$value){?>
																	<option value="<?php echo $value["id"];?>" class="v3-bg-danger" <?php foreach($n2S as $n2){if($n2==$value["id"]){echo "selected";}}?>>+ <?php echo $value["item"];?> [<?php echo $value["id"];?>]</option>
																<?php }?>
															<?php }?>
															<?php foreach($sitems as $key=>$value){?>
																<option value="<?php echo $value["id"];?>" class="v3-bg-info" <?php foreach($n2S as $n2){if($n2==$value["id"]){echo "selected";}}?>># <?php echo $value["item"];?> [<?php echo $value["id"];?>]</option>
															<?php }?>
														</optgroup>
													<?php }?>
													<?php if($m11<>0){ ?>
														<optgroup label="<?php echo $t22;?>">
															<option value="hSide" title="hSide" alt="hSide" class="v3-bg-success" <?php if($rs["n2"]=="hSide"){echo "Selected";}?>><?php echo $t22s[0];?> [Side]</option>
															<?php if($b1<>0){ ?>
																<?php foreach($hcats as $key=>$value){?>
																	<option value="<?php echo $value["id"];?>" class="v3-bg-danger" <?php foreach($n2S as $n2){if($n2==$value["id"]){echo "selected";}}?>>+ <?php echo $value["item"];?> [<?php echo $value["id"];?>]</option>
																<?php }?>
															<?php }?>
														</optgroup>
													<?php }?>
													<?php if($m15>0){?>
														<optgroup label="<?php echo $t25;?>">
															<option value="uSide" title="uSide" alt="uSide" class="v3-bg-success" <?php if($rs["n2"]=="uSide"){echo "Selected";}?>><?php echo $t25s[0];?> [Side]</option>
															<?php if($h4>0){?>
																<?php foreach($ccats as $key=>$value){?>
																	<option value="<?php echo $value["id"];?>" class="v3-bg-danger" <?php foreach($n2S as $n2){if($n2==$value["id"]){echo "selected";}}?>>+ <?php echo $value["item"];?> [<?php echo $value["id"];?>]</option>
																<?php }?>
															<?php }?>
														</optgroup>
													<?php }?>
													<?php if($c1<>0){?>
														<optgroup label="<?php echo $n8;?>">
															<option value="mSide" title="mSide" alt="mSide" class="v3-bg-success" <?php if($rs["n2"]=="mSide"){echo "Selected";}?>><?php echo $n8s[0];?> [Side]</option>
															<?php if($g7>0){ ?>
																<?php foreach($mcats as $key=>$value){?>
																	<option value="<?php echo $value["id"];?>" class="v3-bg-danger" <?php foreach($n2S as $n2){if($n2==$value["id"]){echo "selected";}}?>>+ <?php echo $value["item"];?> [<?php echo $value["id"];?>]</option>
																<?php }?>
															<?php }?>
															<?php foreach($mitems as $key=>$value){?>
																<option value="<?php echo $value["id"];?>" class="v3-bg-info" <?php foreach($n2S as $n2){if($n2==$value["id"]){echo "selected";}}?>># <?php echo $value["item"];?> [<?php echo $value["id"];?>]</option>
															<?php }?>
														</optgroup>
													<?php }?>
												</select>
											</td>
											<td class="w7 mw7">
												<select name="n3" class="form-control" id="en3<?php echo $rs["id"]?>" onchange="change<?php echo $rs["id"]?>()">
													<option value="">Modul</option>
													<?php if($m11<>0){?>
														<optgroup label="<?php echo $t22;?>">
															<option value="haber" <?php if($rs["n3"]=="haber"){echo "selected";}?>><?php echo $t22s[0];?></option>
															<?php if($module["g1_haber"]==1){?>
																<option value="haber_isayfa" <?php if($rs["n3"]=="haber_isayfa"){echo "selected";}?>><?php echo $t22s[0];?> Alt</option>
															<?php }?>
															<?php if($module["d6_haber"]==1){?>
																<option value="haber_extra" <?php if($rs["n3"]=="haber_extra"){echo "selected";}?>><?php echo $t22s[0];?> Ext</option>
															<?php }?>
														</optgroup>
													<?php }?>
													<?php $sqlx=mysqli_query($conn, "select id,n1,n2 from genel where ne='xmodules' order by s10 asc,id desc"); while($rsx=mysqli_fetch_assoc($sqlx)){?>
														<optgroup label="<?php echo str_replace("-","",$rsx["n1"]);?>">
															<option value="<?php echo $rsx["n2"]?>" <?php if($rs["n3"]==$rsx["n2"]){echo "selected";}?>><?php echo str_replace("-","",$rsx["n1"]);?></option>
															<?php if($module["g1_".$rsx["n2"].""]==1){?>
																<option value="<?php echo $rsx["n2"]?>_isayfa" <?php if($rs["n3"]=="".$rsx["n2"]."_isayfa"){echo "selected";}?>><?php echo str_replace("-","",$rsx["n1"]);?> Alt</option>
															<?php }?>
															<?php if($module["d6_".$rsx["n2"].""]==1){?>
																<option value="<?php echo $rsx["n2"];?>_extra" <?php if($rs["n3"]=="".$rsx["n2"]."_extra"){echo "selected";}?>><?php echo str_replace("-","",$rsx["n1"]);?> Ext</option>
															<?php }?>
														</optgroup>
													<?php }?>
													<?php if($m13<>0){?>
														<optgroup label="<?php echo $t21;?>">
															<option value="sayfa" <?php if($rs["n3"]=="sayfa"){echo "selected";}?>><?php echo $t21s[0];?></option>
															<?php if($module["g1_sayfa"]==1){?>
																<option value="sayfa_isayfa" <?php if($rs["n3"]=="sayfa_isayfa"){echo "selected";}?>><?php echo $t21s[0];?> Alt</option>
															<?php }?>
															<?php if($module["d6_sayfa"]==1){?>
																<option value="sayfa_extra" <?php if($rs["n3"]=="sayfa_extra"){echo "selected";}?>><?php echo $t21s[0];?> Ext</option>
															<?php }?>
														</optgroup>
													<?php }?>
													<?php if($c1<>0){?>
														<optgroup label="<?php echo $n8;?>">
															<option value="msayfa" <?php if($rs["n3"]=="msayfa"){echo "selected";}?>><?php echo $n8s[0];?></option>
															<?php if($module["g1_msayfa"]==1){?>
																<option value="msayfa_isayfa" <?php if($rs["n3"]=="msayfa_isayfa"){echo "selected";}?>><?php echo $n8s[0];?> Alt</option>
															<?php }?>
															<?php if($module["d6_msayfa"]==1){?>
																<option value="msayfa_extra" <?php if($rs["n3"]=="msayfa_extra"){echo "selected";}?>><?php echo $n8s[0];?> Ext</option>
															<?php }?>
														</optgroup>
													<?php }?>
													<?php if($m15<>0){?>
														<optgroup label="<?php echo $t25;?>">
															<option value="uye" <?php if($rs["n3"]=="uye"){echo "selected";}?>><?php echo $t25s[0];?></option>
															<option value="relations" <?php if($rs["n3"]=="relations"){echo "selected";}?>><?php echo $t25s[0];?> <?php echo ctranslate("İlişkileri");?></option>
															<?php if($module["h7"]==1){?>
																<option value="uye_extra" <?php if($rs["n3"]=="uye_extra"){echo "selected";}?>><?php echo $t25s[0];?> Ext</option>
															<?php }?>
														</optgroup>
													<?php }?>
													<?php if($m14<>0){?>
														<optgroup label="<?php echo $t24;?>">
															<option value="kayit" <?php if($rs["n3"]=="kayit"){echo "selected";}?>><?php echo $t24s[0];?></option>
															<?php if($module["a11"]==1){?>
																<option value="kayit_isayfa" <?php if($rs["n3"]=="kayit_isayfa"){echo "selected";}?>><?php echo $t24s[0];?> Alt</option>
															<?php }?>
															<?php if($module["a6"]==1){?>
																<option value="kayit_extra" <?php if($rs["n3"]=="kayit_extra"){echo "selected";}?>><?php echo $t24s[0];?> Ext</option>
															<?php }?>
														</optgroup>
													<?php }?>
													<?php if($g9<>0){?>
														<option value="service" <?php if($rs["n3"]=="service"){echo "selected";}?>><?php echo $t36s[0];?></option>
													<?php }?>
													<?php if($s20<>0){?>
														<option value="gorev" <?php if($rs["n3"]=="gorev"){echo "selected";}?>><?php echo $tasks[0];?></option>
													<?php }?>
													<?php if($b6<>"0"){?>
														<option value="slide" <?php if($rs["n3"]=="slide"){echo "selected";}?>>Slide</option>
													<?php }?>
													<?php //if($_GET["nedir"]=="notlar"){?>
														<option value="notlar" <?php if($rs["n3"]=="notlar"){echo "selected";}?>>Notlar</option>
														<?php //}?>
														<?php if($m9==1){?>
															<option value="reklam" <?php if($rs["n3"]=="reklam"){echo "selected";}?>><?php echo $reklamlar; //Reklam Yönetimi?></option>
														<?php }?>
														<?php //if($a6<>0 or $d6<>0){?>
															<option value="kategori" <?php if($rs["n3"]=="kategori"){echo "selected";}?>>Kategori</option>
															<?php //}?>
															<?php if($c2<>0){?>
																<option value="form" <?php if($rs["n3"]=="form"){echo "selected";}?>>Form</option>
															<?php }?>
															<?php if($m16<>0){?>
																<option value="sepet" <?php if($rs["n3"]=="sepet"){echo "selected";}?>>Sepet</option>
																<option value="siparis" <?php if($rs["n3"]=="siparis"){echo "selected";}?>>Sipariş</option>
															<?php }?>
															<option value="ayarlar" <?php if($rs["n3"]=="ayarlar"){echo "selected";}?>>Ayarlar</option>
															<option value="uniq" <?php if($rs["n3"]=="uniq"){echo "selected";}?>>UniqCode</option>
														</select>
													</td>
													<td class="w7 mw7">
														<select name="n4" id="en4<?php echo $rs["id"]?>" class="form-control" onchange="change<?php echo $rs["id"];?>()">
															<option value=""><?php echo ctranslate("Tip")?></option>
															<option value="input" <?php if($rs["n4"]=="input"){echo "Selected";}?>>Input</option>
															<option value="select" <?php if($rs["n4"]=="select"){echo "Selected";}?>>Select</option>
															<option value="radio" <?php if($rs["n4"]=="radio"){echo "Selected";}?>>Radio</option>
															<option value="checkbox" <?php if($rs["n4"]=="checkbox"){echo "Selected";}?>>Checkbox</option>
															<option value="textarea" <?php if($rs["n4"]=="textarea"){echo "Selected";}?>>Textarea</option>
															<option value="switch" <?php if($rs["n4"]=="switch"){echo "Selected";}?>>Switch</option>
														</select>
													</td>
													<td class="w7 mw7">
														<select name="n5" id="en5<?php echo $rs["id"]?>" class="form-control" style="<?php if($rs["n4"]<>"input"){?>display:none;<?php }?>">
															<option value="">Model</option>
															<option value="text" <?php if($rs["n5"]=="text"){echo "Selected";}?>><?php echo ctranslate("Yazı")?></option>
															<option value="number" <?php if($rs["n5"]=="number"){echo "Selected";}?>><?php echo ctranslate("Sayı")?></option>
															<option value="email" <?php if($rs["n5"]=="email"){echo "Selected";}?>>Email</option>
															<option value="password" <?php if($rs["n5"]=="password"){echo "Selected";}?>><?php echo ctranslate("Şifre")?></option>
															<option value="color" <?php if($rs["n5"]=="color"){echo "Selected";}?>><?php echo ctranslate("Renk")?></option>
															<option value="range" <?php if($rs["n5"]=="range"){echo "Selected";}?>><?php echo ctranslate("Aralık")?></option>
															<option value="date" <?php if($rs["n5"]=="date"){echo "Selected";}?>><?php echo ctranslate("Tarih")?></option>
															<option value="time" <?php if($rs["n5"]=="time"){echo "Selected";}?>><?php echo ctranslate("Saat")?></option>
															<option value="month" <?php if($rs["n5"]=="month"){echo "Selected";}?>><?php echo ctranslate("Ay")?></option>
															<option value="datetime-local" <?php if($rs["n5"]=="datetime-local"){echo "Selected";}?>><?php echo ctranslate("Tarih/Saat")?></option>
														</select>
													</td>
													<td class="w7 mw7">
														<select name="n6" id="en6<?php echo $rs["id"]?>" class="form-control">
															<option value="">...</option>
															<option value="required" <?php if($rs["n6"]=="required"){echo "Selected";}?>><?php echo ctranslate("Zorunlu")?></option>
														</select>
													</td>
													<td class="w7 mw7">
														<select name="n7" id="en7<?php echo $rs["id"]?>" class="form-control" style="">
															<option value="0" <?php if($rs["n7"]=="0"){echo "Selected";}?>>Crm+Plus</option>
															<option value="1" <?php if($rs["n7"]=="1"){echo "Selected";}?>><?php echo ctranslate("Register")?></option>
															<option value="2" <?php if($rs["n7"]=="2"){echo "Selected";}?>><?php echo ctranslate("User Panel")?></option>
															<option value="3" <?php if($rs["n7"]=="3"){echo "Selected";}?>><?php echo ctranslate("Front")?></option>
														</select>
													</td>
													<td class="w7 mw7">
														<select name="t2" id="t2" class="form-control">
															<option value="All" <?php if ($rs["t2"]=="" or $rs["t2"]=="All"){?>Selected<?php }?>>[0] <?php echo $sdil[132] //Tüm?></option>
															<?php $i = 0;$diller = explode(',',$m1); foreach($diller as $dil) {$i++; if($i > 99) {$i = 1;}?>
															<option value="lang<?php echo $i?>" <?php if ($rs["t2"]=="lang".$i."" or ($rs["t2"]=="" and $_SESSION["lang"]=="lang".$i."")){?>Selected<?php }?>>[<?php echo $i;?>] <?php echo $dil;?></option>
														<?php }?>
													</select>
												</td>
												<td class="w7 mw7">
													<select name="s9" style=""  class="form-control">
														<option value="0" style="">Grup</option>
														<?php $a=0; foreach($grups as $grup) {$a++;?>
															<option value="<?php echo $a;?>" <?php if($rs["s9"]==$a){?>Selected<?php }?>><?php echo $grup;?></option>
														<?php }?>
													</select>
												</td>
												<td class="w5 mw5"><input type="text" name="s10" id="es10<?php echo $rs["id"]?>" class="form-control" placeholder="sıra" value="<?php echo $rs["s10"];?>" style="padding: 7px 3px; text-align: center;"></td>
												<td class="w6 mw6">
													<div class="input-group-btn">
														<button tabindex="-1" class="btn btn-warning" type="button" id="b<?php echo $rs["id"];?>" onclick="Ajaxs('<?php echo $rs["id"];?>','#result','AjaxPost');"><i class="fa fa-refresh"></i></button>
														<button type="button" style="margin-left: 1px" tabindex="-1" class="btn btn-danger btn-delete-row" onclick="hide('attr<?php echo $rs["id"];?>'); hide('opt<?php echo $rs["id"];?>')" data-href="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&nedir=<?php echo $_GET["nedir"];?>&kid=<?php echo $_GET["kid"];?>&durum=del&id=<?php echo $rs["id"];?>"><i class="fas fa-times"></i></button>
													</div>
												</td>
											</tr>
											<tr style="display:none;" id="attr<?php echo $rs["id"];?>">
												<td colspan="1"><input type="text" name="n9" id="n9" class="form-control" placeholder="Açıklama" value="<?php echo $rs["n9"];?>"></td>
												<td colspan="1"><input type="text" name="n11" id="n11" class="form-control" placeholder="Placeholder" value="<?php echo $rs["n11"];?>"></td>
												<td colspan="1"><input type="text" name="t3" id="t3" class="form-control" placeholder="Name" value="<?php echo $rs["t3"];?>"></td>
												<td colspan="1"><input type="text" name="n12" id="n12" class="form-control" placeholder="Value" value="<?php echo $rs["n12"];?>"></td>
												<td colspan="1"><input type="text" name="n13" id="n13" class="form-control" placeholder="Class" value="<?php echo $rs["n13"];?>"></td>
												<td colspan="1"><input type="text" name="n14" id="n14" class="form-control" placeholder="fa fa-" value="<?php echo $rs["n14"];?>"></td>
												<td colspan="4"><input type="text" name="n8" id="n8" class="form-control" placeholder="Attribute" value="<?php echo $rs["n8"];?>"></td>
												<td colspan="1"><input type="text" name="n15" id="n15" class="form-control" value="<?php echo $rs["n15"];?>" placeholder="Div Class"></td>
											</tr>
										</form>
										<script type='text/javascript'>
											function change<?php echo $rs["id"]?>(){
												var en4<?php echo $rs["id"]?> = document.iform<?php echo $rs["id"]?>.en4<?php echo $rs["id"]?>.options[document.iform<?php echo $rs["id"]?>.en4<?php echo $rs["id"]?>.selectedIndex].value;
												var en3<?php echo $rs["id"]?> = document.iform<?php echo $rs["id"]?>.en3<?php echo $rs["id"]?>.options[document.iform<?php echo $rs["id"]?>.en3<?php echo $rs["id"]?>.selectedIndex].value;
												if (en3<?php echo $rs["id"]?> == "uye" || en3<?php echo $rs["id"]?> == "kayit"){
													jQuery('#en7<?php echo $rs["id"]?>').show();
												} else {
														//jQuery('#en7<?php echo $rs["id"]?>').hide();
												}
												if (en4<?php echo $rs["id"]?> == "input") {
													jQuery('#en5<?php echo $rs["id"]?>').show();
												} else {
													jQuery('#en5<?php echo $rs["id"]?>').hide();
												}
											}
										</script>
										
										<?php if($rs["n4"]=="select" or $rs["n4"]=="radio" or $rs["n4"]=="checkbox"){?>
											<div id="opt<?php echo $rs["id"];?>" style="display:block;">
												<form method="POST" action="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&nedir=<?php echo $_GET["nedir"];?>&kid=<?php echo $_GET["kid"];?>&durum=add_option&id=<?php echo $rs["id"];?>" style=" display:block;">
													<input name="id" type="hidden" value="<?php echo date(YmdHis);?>">
													<input name="s1" type="hidden" value="<?php echo $rs["id"];?>">
													<tr class="alert-warning otr<?php echo $rs["id"];?>" style=" display:none;">
														<td colspan="2"><input type="text" name="n1" id="opn1" class="form-control o<?php echo $rs["id"]?>" placeholder="Option" value=""></td>
														<td colspan="1"><input type="text" name="n4" id="opn4" class="form-control" placeholder="Extra" value=""></td>
														<td colspan="3"><input type="text" name="n2" id="opn1" class="form-control v<?php echo $rs["id"]?>" placeholder="Value" value=""></td>
														<td colspan="1">
															<select name="n3" class="form-control">
																<option value="0">...</option>
																<option value="1">Selected</option>
															</select>
														</td>
														<td></td>
														<td></td>
														<td class="w5 mw5"><input type="text" name="s10" id="s10" class="form-control" placeholder="sıra" value="0" style="padding: 7px 3px; text-align: center;"></td>
														<td class="w6 mw6">
															<div class="input-group-btn">
																<button tabindex="-1" class="btn btn-warning mbtn" type="submit"><i class="fa fa-plus"></i></button>
																<button type="button" onclick="location.href='?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&nedir=<?php echo $_GET["nedir"];?>&kid=<?php echo $_GET["kid"];?>&durum=restore_option&id=<?php echo $rs["id"];?>'" tabindex="-1" class="btn btn-danger mbtn msa" style="margin-left: 1px"><i class="fas fa-trash-restore"></i></button>
															</div>
														</td>											
													</tr>
												</form>
												<script>
													jQuery('.o<?php echo $rs["id"]?>').bind('change keydown keyup',function (){
														var o<?php echo $rs["id"]?> = jQuery(this).val();
														jQuery(".v<?php echo $rs["id"]?>").val(o<?php echo $rs["id"]?>);
													});
												</script>
												<?php usort($jsop, fn($a, $b) => $a['s10'] <=> $b['s10']); foreach($jsop as $k=>$v){?>
													<form method="POST" action="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&nedir=<?php echo $_GET["nedir"];?>&kid=<?php echo $_GET["kid"];?>&durum=edit_option&id=<?php echo $v["id"];?>" id="xf<?php echo $v["id"];?>" class="xf<?php echo $v["id"];?>" name="xf<?php echo $v["id"];?>">
														<input name="id" type="hidden" value="<?php echo $v["id"]?>">
														<input name="s1" type="hidden" value="<?php echo $rs["id"];?>">
														<tr class="alert-danger otr<?php echo $rs["id"];?>" style=" display:none;">
															<td colspan="2"><input type="text" name="n1" id="opn1" class="form-control o<?php echo $v["id"]?>" placeholder="Option" value="<?php echo $v["n1"];?>"></td>
															<td colspan="1"><input type="text" name="n4" id="opn4" class="form-control" placeholder="Extra" value="<?php echo $v["n4"];?>"></td>
															<td colspan="3"><input type="text" name="n2" id="opn1" class="form-control v<?php echo $v["id"]?>" placeholder="Value" value="<?php echo $v["n2"];?>"></td>
															<td colspan="1">
																<select name="n3" class="form-control">
																	<option value="0" <?php if($v["n3"]==0){echo "Selected";}?>>...</option>
																	<option value="1" <?php if($v["n3"]==1){echo "Selected";}?>>Selected</option>
																</select>
															</td>
															<td></td>
															<td></td>
															<td><input type="text" name="s10" id="s10" style=" text-align: center;" class="form-control" placeholder="sıra" value="<?php echo $v["s10"];?>"></td>
															<td>
																<div class="input-group-btn">
																	<button tabindex="-1" class="btn btn-warning demo" type="button" id="b<?php echo $rso["id"];?>" onclick="Ajaxs('<?php echo $v["id"];?>','#result','AjaxPost');"><i class="fa fa-refresh"></i></button>
																	<button type="button" style="margin-left: 1px" tabindex="-1" class="btn btn-danger btn-delete-row demo" data-href="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&durum=del_option&s1=<?php echo $v["s1"];?>&id=<?php echo $v["id"];?>"><i class="fas fa-trash"></i></button>
																</div>
															</td>											
														</tr>
													</form>
												<?php }?>
											</div>
										<?php }?>
									<?php }?>
								</table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
<script type='text/javascript'>
	function change(){
		var n4 = document.iform.n4.options[document.iform.n4.selectedIndex].value;
		var n3 = document.iform.n3.options[document.iform.n3.selectedIndex].value;
		if (n3 == "uye" || n3 == "kayit"){
			jQuery('#n7').show();
		} else {
			//jQuery('#n7').hide();
		}
		if (n4 == "input") {
			jQuery('#n5').show();
		} else {
			jQuery('#n5').hide();
		}
	}
</script>
<?php
	if($_POST["s9"]<>""){$s9=$_POST["s9"];}else{$s9=0;}
	if($_POST["s10"]<>""){$s10=$_POST["s10"];}else{$s10=0;}
	if($_POST["s1"]<>""){$s1=$_POST["s1"];}else{$s1=0;}
	if(!empty($_POST["n2"])){$n2 = implode(',',$_POST["n2"]);}else{$n2="0";}
	if($_GET["durum"]=="add"){
		$sql = $conn->query("insert into genel(ne,t2,t3,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,s9,s10,s1,s19) VALUES ('inputs', '".$_POST["t2"]."', '".$_POST["t3"]."', '".addslashes(stripslashes($_POST["n1"]))."', '".$n2."', '".$_POST["n3"]."', '".$_POST["n4"]."', '".$_POST["n5"]."', '".$_POST["n6"]."', '".$_POST["n7"]."', '".addslashes(stripslashes($_POST["n8"]))."', '".$_POST["n9"]."', '".$_POST["n10"]."', '".$_POST["n11"]."', '".$_POST["n12"]."', '".$_POST["n13"]."', '".$_POST["n14"]."', '".$_POST["n15"]."', '".$s9."', '".$s10."', '".$s1."', '".$_SESSION["user_id"]."')");
		$_SESSION["sn2"]=$_POST["n2"]; $_SESSION["sn3"]=$_POST["n3"]; $_SESSION["sn4"]=$_POST["n4"]; $_SESSION["sn7"]=$_POST["n7"];
		echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&nedir=".$_GET["nedir"]."&kid=".$_GET["kid"]."&durum=ok",self,500,1);
	}elseif($_GET["durum"]=="restore_option"){
			$jsons = [];
		$sqlop=mysqli_query($conn, "select * from genel where s1=".$_GET["id"].""); while($rsop=mysqli_fetch_assoc($sqlop)){
			$jsons[] = [
				"id"  => date("YmdHis"), // Zaman damgası ID olarak
				"s1"  => (int) $rsop ['s1'],
				"n1"  => $rsop ['n1'],
				"n4"  => $rsop ['n4'] ?? "", // Boşsa string olarak ekler
				"n2"  => $rsop ['n2'],
				"n3"  => (int) $rsop ['n3'],
				"s10" => (int) $rsop ['s10']
			];
		}
		$rjsop = json_encode($jsons, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
		$Rs = mysqli_query($conn, "update genel set n17='".addslashes(stripslashes($rjsop))."' Where id=".$_GET["id"]."");
		echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&nedir=".$_GET["nedir"]."&kid=".$_GET["kid"]."&durum=ok",self,500,1);
	}elseif($_GET["durum"]=="add_option"){
		$sqlop=mysqli_query($conn, "select * from genel where id=".$_POST["s1"].""); $rsop=mysqli_fetch_assoc($sqlop); $jsons = json_decode($rsop["n17"],true);
		if(!is_array($jsons)){$jsons = array();}
		$options = array();
		foreach ($_POST as $key => $value){
			$options = $options + array($key => $value);
		}
		array_push($jsons,$options);
		$rjsop = json_encode($jsons, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
		$Rs = mysqli_query($conn, "update genel set n17='".addslashes(stripslashes($rjsop))."' Where id=".$_POST["s1"]."");
		echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&nedir=".$_GET["nedir"]."&kid=".$_GET["kid"]."&durum=ok",self,500,1);
	}elseif($_GET["durum"]=="edit"){
		$Rs = mysqli_query($conn, "update genel set t2='".$_POST["t2"]."', t3='".$_POST["t3"]."', n1='".addslashes(stripslashes($_POST["n1"]))."', n2='".$n2."', n3='".$_POST["n3"]."', n4='".$_POST["n4"]."', n5='".$_POST["n5"]."', n6='".$_POST["n6"]."', n7='".$_POST["n7"]."', n8='".addslashes(stripslashes($_POST["n8"]))."', n9='".$_POST["n9"]."', n10='".$_POST["n10"]."', n11='".$_POST["n11"]."', n12='".$_POST["n12"]."', n13='".$_POST["n13"]."', n14='".$_POST["n14"]."', n15='".$_POST["n15"]."', s10='".$s10."', s9='".$s9."' Where id=".$_GET["id"]."");
	}elseif($_GET["durum"]=="edit_option"){
		$sqlop=mysqli_query($conn, "select * from genel where id=".$_POST["s1"].""); $rsop=mysqli_fetch_assoc($sqlop); $jsons = json_decode($rsop["n17"],true);
		
		$options = array();
		$poption = array();
		foreach($jsons as $key=>$value){
			if($value["id"]==$_POST["id"]){	//update
				foreach ($_POST as $pkey => $pval){
					$poption = $poption + array($pkey => $pval);
				}
			}else{
				$options = $options + array( $key => $value);
			}
		}
		array_push($options,$poption);
		$rjsop = json_encode($options, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
		$Rs = mysqli_query($conn, "update genel set n17='".addslashes(stripslashes($rjsop))."' Where id=".$_POST["s1"]."");
	}elseif($_GET["durum"]=="del"){
		$Rs = mysqli_query($conn, "delete from genel where id=".$_GET["id"]." or s1=".$_GET["id"]."");
	}elseif($_GET["durum"]=="del_option"){
		$sqlop=mysqli_query($conn, "select * from genel where id=".$_GET["s1"].""); $rsop=mysqli_fetch_assoc($sqlop); $jsons = json_decode($rsop["n17"],true);
		
		$options = array();
		foreach($jsons as $key=>$value){
			if($value["id"]<>$_GET["id"]){	//update
				$options = $options + array( $key => $value);
			}
		}
		$rjsop = json_encode($options, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
		$Rs = mysqli_query($conn, "update genel set n17='".addslashes(stripslashes($rjsop))."' Where id=".$_GET["s1"]."");
	}
?>
</body>
</html>