<?php
	header('Content-Type: text/html; charset=utf-8');
	error_reporting(0);
	$path="../../";
	include("../../map.php");
	include("../../secure.php");
?>
<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Seo Link</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">
	<?php include("../../scripts.php");?>
	<link rel="stylesheet" type="text/css" href="<?php echo $weburl."/".$crmpath?>/assets/css/inmodal.css" />
</head>
<body>
	<div class="alert alert-warning" id="result" style="display:none;"></div>
    <div class="" style="padding:15px;">
        <div class="row">
            <!-- Mobilde hamburger menü butonu -->
            <div class="col-12 d-block d-md-none">
                <button class="hamburger-btn" onclick="toggleMenu()">
                    <i class="fas fa-bars"></i>
                </button>
            </div>
            <!-- İç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 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>
										<input type="text" name="n1" id="n1" title="Kelime" class="form-control" placeholder="Kelime">
									</td>
									<td class="w18">
										<input type="text" name="n2" id="n2" title="Link" class="form-control" style="" placeholder="Link">
									</td>
									<td class="w18">
										<input type="text" name="n3" id="n3" title="Tanım-3 [n3]" class="form-control" style="">
									</td>
									<td class="w18">
										<input type="text" name="n4" id="n4" title="Tanım-4 [n4]" class="form-control" style="">
									</td>
									<td class="w10">
										<select class="form-control" name="t2" style="" title="Hedef">
											<option value="">Target</option>
											<option value="_blank">_blank</option>
											<option value="_self" selected>_self</option>
										</select>
									</td>
									<td class="w8">
										<button type=submit class="btn btn-warning mbtn"><i class="fa fa-plus"></i><span class="ddn"> <?php echo $sdil[201]; //Ekle?></span></button>
									</td>
								</tr>
							</form>
							<?php $sql=mysqli_query($conn, "select * from genel where ne='seo' order by s10 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>
										<td class="w18">
											<input type="text" name="n1" class="form-control" value="<?php echo $rs["n1"];?>" style="">
										</td>
										<td class="w18">
											<input type="text" name="n2" class="form-control" value="<?php echo $rs["n2"];?>" style="">
										</td>
										<td class="w18">
											<input type="text" name="n3" class="form-control" value="<?php echo $rs["n3"];?>" style="">
										</td>
										<td class="w18">
											<input type="text" name="n4" class="form-control" value="<?php echo $rs["n4"];?>" style="">
										</td>
										<td class="w10">
											<select class="form-control" name="t2" style="" title="Hedef">
												<option value="">Target</option>
												<option value="_blank" <?php if($rs["t2"]=="_blank"){echo "selected";}?>>_blank</option>
												<option value="_self" <?php if($rs["t2"]=="_self"){echo "selected";}?>>_self</option>
											</select>
										</td>
										<td>
											<button type=submit class="btn btn-warning mbtn"><i class="fa fa-refresh"></i><span class="ddn"> <?php echo $sdil[203]; //Güncelle?><span></button>
												<button type=button class="btn btn-danger mbtn" OnClick="location.href='?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&durum=sil&id=<?php echo $rs["id"];?>';return confirm(' Bu Kayıt Silinecektir ! Onaylıyor musunuz ?');"><i class="fa fa-times " aria-hidden="true"></i></i><span class="ddn"> <?php echo $sdil[204]; //Kaldir?><span></button>
												</td>
											</tr>
										</form>
									<?php }?>
								</table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- Bootstrap JS -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<?php
//----------------------------------------------------->Şifre Ekle
	if($_GET["durum"]=="ekle"){
		$sql = $conn->query("insert into genel(t2,ne,n1,n2,n3,n4) VALUES ('".$_POST["t2"]."', 'seo', '".$_POST["n1"]."', '".$_POST["n2"]."', '".$_POST["n3"]."', '".$_POST["n4"]."')");
		header('Location: ');
		echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&durum=ok",self,500,1);
//----------------------------------------------------->Şifre Güncelle
	}elseif($_GET["durum"]=="duzenle"){
		$Rs = mysqli_query($conn, "update genel set n1='".$_POST["n1"]."', n2='".$_POST["n2"]."', n3='".$_POST["n3"]."', n4='".$_POST["n4"]."', t2='".$_POST["t2"]."' Where id=".$_GET["id"]."");
		echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&durum=ok",self,500,1);
//----------------------------------------------------->Şifre Sil
	}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);	
	}?>    
</body>
</html>