Created
March 17, 2019 15:35
-
-
Save hakkbulutsereme/80afb463c0d1145ed2e1333a33836062 to your computer and use it in GitHub Desktop.
MYSQL PHP İle Sınırsız Kategori Yapımı
This file contains 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 | |
include 'baglan.php'; | |
function seo($s) { | |
$tr = array('ş','Ş','ı','I','İ','ğ','Ğ','ü','Ü','ö','Ö','Ç','ç','(',')','/',' ',',','?'); | |
$eng = array('s','s','i','i','i','g','g','u','u','o','o','c','c','','','-','-','',''); | |
$s = str_replace($tr,$eng,$s); | |
$s = strtolower($s); | |
$s = preg_replace('/&amp;amp;amp;amp;amp;amp;amp;amp;.+?;/', '', $s); | |
$s = preg_replace('/\s+/', '-', $s); | |
$s = preg_replace('|-+|', '-', $s); | |
$s = preg_replace('/#/', '', $s); | |
$s = str_replace('.', '', $s); | |
$s = trim($s, '-'); | |
return $s; | |
}; | |
if (isset($_POST["kategoriekle"])) { | |
$kategori = $_POST["kategori"]; | |
$kategori_link = seo($_POST["kategori"]); | |
$kategori_ust = $_POST["kategori_ust"]; | |
$sql = "INSERT INTO kategori SET | |
kategori=:kategori, | |
kategori_ust=:kategori_ust, | |
kategori_link=:kategori_link"; | |
$kaydet = $db->prepare($sql); | |
$kaydet->execute(array("kategori" => $kategori,"kategori_ust" => $kategori_ust,"kategori_link" => $kategori_link)); | |
if ($kaydet) { | |
header("Location:index.php?kategor=eklendi"); | |
}else{ | |
header("Location:index.php?kategor=eklenmedi"); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment