php pdo ile üye giris sistemi yapımı

06-07-2018

 
<?php 
error_reporting(0);
if (!isset($_SESSION['kadi_admin'])) {
header('Localtion:index.php');
}
?>
<center>
<?php 
echo '<br>';
if ($_GET['hata'] == 'yanlis') {
echo '<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<script type="text/javascript">
swal("Hata!", "Tanıyamadım Kimsiniz!", "error");
</script>';
}
?>
<form action="#" method="post">
<input type="mail" name="kadi_admin">
<input type="password" name="password">
<input type="submit" name="basla">
</form>
</center>
<?php 
try {
$db = new PDO("mysql:host=localhost;dbname=ders1;charset=utf8", "root", "" );
} catch ( PDOException $e ){
print $e->getMessage();
}
if (isset($_POST['basla'])) {
$kadi_admin = $_POST['kadi_admin'];
$password = md5($_POST['password']);
$query = $db->query("SELECT * FROM admin where kadi_admin='$kadi_admin' and password='$password'");
$query->execute();
$count = $query->FetchColumn();
if ($count>0) {
$_SESSION['kadi_admin'] = $kadi_admin;
echo '<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<script type="text/javascript">
swal("Basarılı Giriş!", "Patron Hoş geldin!", "success");
</script>';
header('Location:portal.php');
 
}else{
 
header('Location:index.php?hata=yanlis');
}
}
?>

Blog Reviews

{{totalComments}} Comment
{{comment.owner.name}}
{{comment.owner.name}}
{{comment.createdAt | date:"dd/MM/yyyy"}}
{{comment.commentData}}