Created
January 13, 2019 20:13
-
-
Save spinningcat/2e760429348edfd599d349d0726c06e3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ob_start(); | |
error_reporting(-1); ini_set('display_errors', '1'); | |
session_start(); | |
$dbname = "..."; | |
$dbhost = "localhost"; | |
$dbuser = "..."; | |
$dbpass = "..."; | |
$baglanti = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname); | |
//mysql_query("SET NAMES 'utf8'"); | |
mysqli_set_charset($baglanti,"utf8mb4"); | |
//$vtad = mysqli_select_db($baglanti, $dbname); | |
if (isset($_POST["giris"])) { | |
$sorgu = "select * from admin"; | |
$sql = mysqli_query($baglanti,$sorgu); | |
while($kayit = mysqli_fetch_assoc($sql)) { | |
$user = $kayit["admin"]; | |
$pass = $kayit["sifre"]; | |
@$_POST = array_map('htmlspecialchars', $_POST); | |
if ((@$_POST["username"] === $user) and @$_POST["password"] === $pass) { | |
$_SESSION["login"] = "true"; | |
$_SESSION["gkayitih"] = date("H:i:s"); | |
$_SESSION["username"] = $user; | |
$_SESSION["password"] = $pass; | |
//header("Location:motoadmin.php"); | |
$devam = "TRUE"; | |
} | |
else{ | |
echo "failed"; | |
} | |
} | |
} | |
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf8" /> | |
<title>Motokurye Admin</title> | |
</head> | |
<body> <form id="form1" name="form1" method="post" action=""><?php | |
if (empty($_SESSION["login"])) { | |
?> | |
<table width="429" border="1"> | |
<tr> | |
<td colspan="2">ADMİN GİRİŞ</td> | |
</tr> | |
<tr> | |
<td><strong>Kullanıcı adı</strong></td> | |
<td width="229"><input name="username" size="28" type="text" value="" /></td> | |
</tr> | |
<tr> | |
<td><strong>Şifre</strong></td> | |
<td><input name="password" type="password" value="" size="28" /></td> | |
</tr> | |
<tr> | |
<td> </td> | |
<td><input type="submit" name="giris" id="giris" value="Giriş" /></td> | |
</tr> | |
</table> | |
<?php | |
} else if (isset($_SESSION["login"])) { | |
echo "login"; | |
?> <table width="430" border="1"> | |
<tr> | |
<td colspan="2">ŞEHİR EKLE</td> | |
</tr> | |
<tr> | |
<td width="103">Şehir </td> | |
<td> | |
<input type="text" name="sehir" id="sehir" /> </td> | |
</tr> | |
<tr> | |
<td>Hangi Bölge </td> | |
<td><select name="bolge" id="bolge"> | |
<?php | |
for ($i = 1; $i <= 60; $i++) { | |
echo ' <option id="bolge' . $i . '">' . $i . '. Bölge</option>'; | |
} | |
?> | |
</select></td> | |
</tr> | |
<tr> | |
<td> </td> | |
<td><input type="submit" name="gonder" id="gonder" value="Gönder" /></td> | |
</tr> | |
<tr> | |
<td> </td> | |
<td> | |
<?php | |
if (isset($_POST['gonder'])) { | |
$sehir = $_POST["sehir"]; | |
$bolge = $_POST["bolge"]; | |
mysqli_query($baglanti,"insert into bolge_adi(adi,bolge_id') VALUES('$sehir','$bolge')"); | |
echo "Eklendi."; | |
echo '<meta http-equiv="refresh" content="2;URL=" />'; | |
} | |
?></td> | |
</tr> | |
</table> | |
<table width="431" border="1"> | |
<tr> | |
<td colspan="2">BÖLGE İLİŞKİLENDİR</td> | |
</tr> | |
<tr> | |
<td width="103">İlk Bölge </td> | |
<td> | |
<select name="bolge2" id="bolge2"> | |
<?php | |
for ($i = 1; $i <= 60; $i++) { | |
echo '<option id="bolge2' . $i . '">' . $i . '. Bölge</option>'; | |
} | |
?> | |
</select> | |
</td> | |
</tr> | |
<tr> | |
<td>İkinci Bölge</td> | |
<td><select name="bolge3" id="bolge3"> | |
<?php | |
for ($i = 1; $i <= 60; $i++) { | |
echo '<option id="bolge3' . $i . '">' . $i . '. Bölge</option>'; | |
} | |
?> | |
</select></td> | |
</tr> | |
<tr> | |
<td>Normal Fiyat</td> | |
<td colspan="2"><input name="fiyat" type="text" id="fiyat" size="11" /> | |
TL </td> | |
</tr> | |
<tr> | |
<td>Abone Fiyat</td> | |
<td colspan="2"><input name="fiyat2" type="text" id="fiyat2" size="11" /> | |
TL </td> | |
</tr> | |
<tr> | |
<td> </td> | |
<td><input type="submit" name="gonder2" id="gonder2" value="Gönder" /></td> | |
</tr> | |
<tr> | |
<td> </td> | |
<td><?php | |
if (isset($_POST["gonder2"])) { | |
$bolge2 = $_POST["bolge2"]; | |
$bolge3 = $_POST["bolge3"]; | |
$fiyat = $_POST["fiyat"]; | |
$fiyat2 = $_POST["fiyat2"]; | |
mysqli_query($baglanti,"INSERT INTO bolge(bolge_1,bolge_2,pesin,abone) VALUES('$bolge2','$bolge3',$fiyat,$fiyat2)"); | |
echo "Eklendi."; | |
echo '<meta http-equiv="refresh" content="2;URL=" />'; | |
} | |
if (@is_numeric($_GET["id"])) { | |
$sid = $_GET["id"]; | |
echo($sid); | |
mysqli_query($baglanti,"DELETE from bolge_adi where id=$sid "); | |
echo '<meta http-equiv="refresh" content="0;URL=motoadmin.php" />'; | |
} | |
if (@is_numeric($_GET["id"])) { | |
$silbuid = $_GET["id"]; | |
mysqli_query($baglanti,"DELETE from bolge where id=$silbuid "); | |
echo '<meta http-equiv="refresh" content="0;URL=motoadmin.php" />'; | |
} | |
?></td> | |
</tr> | |
</table> | |
<table width="431" border="1"> | |
<tr> | |
<td colspan="3">ŞEHİRLER</td> | |
</tr> | |
<tr> | |
<th>ADI</th> | |
<th>BÖLGE NO</th></tr> | |
<?php | |
$sor = mysqli_query($baglanti,"SELECT * FROM bolge_adi"); | |
while ($kayit = mysqli_fetch_array($sor)) { | |
?> | |
<tr> | |
<td width="180"><?php | |
echo $kayit["adi"]; | |
?></td> | |
<td width="196"><?php | |
echo $kayit["bolge_id"]; | |
?></td> | |
<td width="33"><a href="motoadmin.php?id=<?php | |
echo $kayit["id"]; | |
?>">Sil</a></td> | |
</tr> | |
<?php | |
} | |
?> | |
</table> | |
<table width="431" border="1"> | |
<tr> | |
<td width="161">İLİŞKİLİ BÖLGELER</td> | |
<td width="130">Normal Fiyat</td> | |
<td width="80">Abone Fiyatı</td> | |
<td width="32"> </td> | |
</tr> | |
<?php | |
$sor = mysqli_query($baglanti,"SELECT * FROM bolge"); | |
while ($kayit = mysqli_fetch_assoc($sor)) { | |
?> | |
<tr> | |
<td width="161"><?php | |
echo $kayit["bolge_1"] . " - "; | |
echo $kayit["bolge_2"] . " arası"; | |
?></td> | |
<td width="130"><?php | |
echo $kayit["pesin"]; | |
?> TL</td> | |
<td width="80"><?php | |
echo $kayit["abone"]; | |
?> TL</td> | |
<td width="32"><a href="motoadmin.php?id=<?php | |
echo $kayit["id"]; | |
?>">Sil</a></td> | |
</tr><?php | |
} | |
?> | |
<tr> | |
<td colspan="4" align="center"><a href="motoadmin.php?cik=1">ÇIKIŞ YAP</a></td> | |
</tr> | |
</table> | |
<?php | |
if (isset($_GET["cik"])) { | |
session_destroy(); | |
echo '<meta http-equiv="refresh" content="0;URL=" />'; | |
} | |
} | |
?> | |
<p> </p> | |
<p> </p> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment