<?php
	header('Content-Type: text/html; charset=utf-8');
	error_reporting(0);
	$path="../../";
	include("../../map.php");
	include("../../scripts.php");
	include("../../secure.php");
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo translate("Puan"); //Puan?></title>
</head>
<body>
    <div class="qmodal">
        <div class="qmodal-content">
            <!-- Header with Action Buttons -->
            <div class="qmodal-header">
                <button type="button" class="btn btn-warning mfrm" data-toggle="modal" data-width="50%" data-target="#myModal2" data-url="../../fonksiyon.php?islem=search_point" data-title="<?php echo ctranslate("Puan Sorgula");?>"><i class="fas fa-search"></i></button>
            </div>
            <!-- Left Tab Menu -->
            <div class="v8-columns">
                <!-- Content Area -->
                <div class="" ts1="<?php echo dtarih($rs["ts1"],"gg ka yy time");?>" ts2="<?php echo dtarih($rs["ts2"],"gg ka yy time");?>" ts3="<?php echo dtarih($rs["ts3"],"gg ka yy time");?>">
<table class="table table-no-more table-bordered table-striped mb-0">
								<form method="POST" action="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&durum=ekle" autocomplete="off" id="tform" name="tform">
									<tr class="addtr">
										<td class="w10"><input type="text" name="t1" id="" title="" class="form-control" placeholder="<?php echo translate("Puan"); //Puan?>"></td>
										<td class="w10"><input type="text" name="pb1" id="" class="form-control" title="<?php echo translate("Tutar/dk")?>" placeholder=">="></td>
										<td class="w10"><input type="text" name="pb2" id="" class="form-control" title="<?php echo translate("Tutar/dk")?>" placeholder="<="></td>
										<td class="w10"><input type="text" name="t3" class="form-control" value="" placeholder="<?php echo translate("Günlük Limit")?>"></td>
										<td class="w6"><input list="lt2" type="text" name="t2" class="form-control" value="" placeholder="<?php echo translate("İşlem")?>">
											<datalist id="lt2">
												<option value="siparis">Sipariş</option>
												<option value="giris">Üye Giriş</option>
												<option value="kayit">Üye Kayıt</option>
												<option value="yorum">Yorum</option>
												<option value="tavsiye">Tavsiye</option>
											</datalist>
										</td>
										<td class=""><textarea name="n1" id="" title="" class="form-control" placeholder="Açıklama"></textarea></td>
										<td class="w10">
											<select name="s3" class="v3-form-control">
												<option value="1" <?php if($rs["s3"]==1){echo "Selected";}?>><?php echo translate("Tek Puan")?></option>
												<option value="2" <?php if($rs["s3"]==2){echo "Selected";}?>><?php echo translate("Dakika Limitli %")?></option>
											</select>
										</td>
										<td class="w10">
											<select name="s2" class="v3-form-control">
												<option value="0" <?php if($rs["s2"]==0){echo "Selected";}?>><?php echo translate("Tek Sefer")?></option>
												<option value="1" <?php if($rs["s2"]==1){echo "Selected";}?>><?php echo translate("Günlük")?></option>
												<option value="2" <?php if($rs["s2"]==2){echo "Selected";}?>><?php echo translate("Sınırsız")?></option>
											</select>
										</td>
										<td class="w8">
											<div class="input-group-btn">
												<button tabindex="-1" class="btn btn-warning mbtn" type="submit" <?php if ($authority==0){?>disabled<?php }?>><i class="fa fa-plus"></i><span class="ddn tdn"> <?php echo $sdil[201]; //ekle?></span></button>
											</div>
										</td>
										<tr>
										</form>
										<?php $sql=mysqli_query($conn, "select * from genel where ne='point' order by id asc"); while($rs=mysqli_fetch_assoc($sql)){?>
											<form method="POST" action="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&durum=duzenle&id=<?php echo $rs["id"];?>" autocomplete="off">
												<tr style="">
													<td><input type="text" name="t1" class="form-control" value="<?php echo $rs["t1"];?>"></td>
													<td><input type="text" name="pb1" class="form-control" title="<?php echo translate("Tutar/dk")?>" value="<?php echo $rs["pb1"];?>"></td>
													<td><input type="text" name="pb2" class="form-control" title="<?php echo translate("Tutar/dk")?>" value="<?php echo $rs["pb2"];?>"></td>
													<td class=""><input type="text" name="t3" class="form-control" value="<?php echo $rs["t3"];?>" placeholder="<?php echo translate("Günlük Limit")?>"></td>
													<td><input list="lt2" type="text" name="t2" class="form-control" value="<?php echo $rs["t2"];?>">
														<datalist id="lt2">
															<option value="siparis">Sipariş</option>
															<option value="giris">Üye Giriş</option>
															<option value="kayit">Üye Kayıt</option>
															<option value="yorum">Yorum</option>
															<option value="tavsiye">Tavsiye</option>
														</datalist>
													</td>
													<td class=""><textarea name="n1" id="" title="" class="form-control"><?php echo $rs["n1"];?></textarea></td>
													<td class="">
														<select name="s3" class="v3-form-control">
															<option value="1" <?php if($rs["s3"]==1){echo "Selected";}?>><?php echo translate("Tek Puan")?></option>
															<option value="2" <?php if($rs["s3"]==2){echo "Selected";}?>><?php echo translate("Dakika Limitli %")?></option>
														</select>
													</td>
													<td>
														<select name="s2" class="v3-form-control">
															<option value="0" <?php if($rs["s2"]==0){echo "Selected";}?>><?php echo translate("Tek Sefer")?></option>
															<option value="1" <?php if($rs["s2"]==1){echo "Selected";}?>><?php echo translate("Günlük")?></option>
															<option value="2" <?php if($rs["s2"]==2){echo "Selected";}?>><?php echo translate("Sınırsız")?></option>
														</select>
													</td>
													<td>
														<div class="input-group-btn">
															<button tabindex="-1" class="btn btn-warning mbtn" type="submit" <?php if ($authority==0){?>disabled<?php }?>><i class="fa fa-refresh"></i><span class="ddn tdn"> <?php echo $sdil[203]; //Güncelle?></span></button>
															<button type="button" style="margin-left: 1px" tabindex="-1" class="btn btn-danger mbtn" href="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&durum=sil&id=<?php echo $rs["id"];?>" OnClick="return confirm(' Bu Kayıt Silinecektir ! Onaylıyor musunuz ?');"><i class="fa fa-times"></i><span class="ddn tdn"> <?php echo $sdil[204]; //Kaldır?></span></button>
														</div>
													</td>
												</tr>
											</form>
										<?php }?>
									</table>
                 </div>
            </div>
</body>
<?php echo $footer?>
</html>
<?php
if($_GET["durum"]=="ekle"){
	$sql = $conn->query("insert into genel(t1,t2,t3,n1,ne,pb1,pb2,s1,s2) VALUES ('".$_POST["t1"]."', '".$_POST["t2"]."', '".$_POST["t3"]."', '".$_POST["n1"]."', 'point', '".$_POST["pb1"]."', '".$_POST["pb2"]."', '".$_POST["s1"]."', '".$_POST["s2"]."')");
	echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&durum=ok",self,500,1);
	
}elseif($_GET["durum"]=="duzenle"){
	$Rs = mysqli_query($conn, "update genel set t1='".$_POST["t1"]."', t2='".$_POST["t2"]."', t3='".$_POST["t3"]."', n1='".$_POST["n1"]."', pb1='".$_POST["pb1"]."', pb2='".$_POST["pb2"]."', s1='".$_POST["s1"]."', s2='".$_POST["s2"]."' Where id=".$_GET["id"]."");
	echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&durum=ok",self,500,1);
	
}elseif($_GET["durum"]=="sil"){
	$Rs = mysqli_query($conn, "delete from genel where id=".$_GET["id"]);
	echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&durum=ok",self,500,1);	
}
?>