Databasemize aşağıdaki tabloları oluşturmuş oluyoruz.
ID:(otomatik atanır web SQL için)
Web Panel Giriş için Kullanıcı Adı:
Web Panel Giriş için Şifre:
E-mail adresi:
Adı Soyadı:
Telefon Numarası:
job (Oyuncu Karakter mesleği yazılabilir)
-Örnek: Warrior - Priest - Rogue - Mage gibi.
Web Panel de Yazılı Oyuncu İsmi: Oyun içindeki Karakter ismi yazılır.
Örnek: KingOfJestLog
Web Panelde Yazılı Puan: Oynucunun Puanı
( Clan Başkanı veya Başkanın atadığı aktivitileri takip eden. oyuncuyu puanlayan kişi tarafından değiştirilebilir.)
Öncelikle Database Verilerimizi Oluşturalım.
CREATE DATABASE jestlog;
USE jestlog;
CREATE TABLE `jestlog` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`kullaniciadi` varchar(50) NOT NULL,
`sifre` varchar(20) NOT NULL,
`eposta` varchar(50) NOT NULL,
`adsoyad` varchar(50) NOT NULL,
`telefon` varchar(50) NOT NULL,
`job` varchar(50) NOT NULL,
`oyuncuismi` varchar(50) NOT NULL,
`puan` varchar(50) NOT NULL,
PRIMARY KEY (`id`))
---------------
Veritabani ile bağlantı sayfamızı jestlog.php oluşturalım.
( Bağlantı MYSQL değişkeni ile PDO olarak bağlanır.
Tüm php versionları uyumludur.
Güvenlik SQL açığı 0.
<?php
error_reporting(0); // hataları bastırıyoruz hataları görmek için satırı silmeniz yeterli
session_start(); // oturum başlatıyoruz
## Bağlantı Değişkenleri ##
$hostname = "localhost";
$username = "root";
$pass = "jestlog123456";
$database = "jestlog";
## Mysql Bağlantı ##
try {
$db = new PDO("mysql:host=" . $hostname . "; dbname=" . $database . "; charset=utf8", "$username", "$pass");
} catch (PDOException $error) {
print $error->getMessage();
exit();
}
?>
--------------
index.php Oluşturalım.
<?php
include "jestlog.php";
if (!$_SESSION['login']) {
header('Location:giris.php');
}
$kullanici_getir = $db->prepare("SELECT * FROM jestlog WHERE id = ?");
$kullanici_getir->execute(array($_SESSION['kullanici_id']));
if ($kullanici_getir->rowCount() > 0) {
$row = $kullanici_getir->fetch(PDO::FETCH_OBJ);
}
echo 'Kullanıcı adınız : '. $row->kullaniciadi . '<br/>';
echo 'Ad Soyad : '. $row->adsoyad. '<br/>';
echo 'E-Posta: '. $row->eposta. '<br/>';
echo 'Telefon No: '. $row->telefon. '<br/>';
echo 'Oyuncu İsmi: '. $row->oyuncuismi. '<br/>';
echo 'Oyuncu Mesleği: '. $row->job. '<br/>';
echo 'Toplam Puan: '. $row->puan. '<br/>';
echo 'Mevcut Şifreniz: '. $row->sifre;
?>
<title>JESTLOG Birliği | Oyunucu Bilgileri</title>
<br/><br/>
<b><a href="https:wa.me/905xxxxxxxxx?text=Yardım Lütfen">Şifre Değişiklik Talebi Yap</a></B> //xxx'lerin yerine kendi watsap numaranızı yazın. Oyuncular sizinle iletişime geçebilmeleri için.//
<br/><br/><br/><a href="cikis.php">Çıkış Yap</a>
<br/><br/>
<meta http-equiv="refresh" content="10;url=""><font color=red><b>DİKKAT!! </font><font color=blue>Bu Sayfa Kendini 10 Saniyede Bir Yeniler <!--content="10;><B></font>
-------------
Giriş sayfamızı oluşturalım.
giris.php
<?php
include 'jestlog.php';
if ($_SESSION['login']){
header('Location:index.php');
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$kullanici_adi = trim($_POST['kullaniciadi']);
$sifre = trim($_POST['sifre']);
if (empty($kullanici_adi) || empty($sifre)) {
$msg = 'Kullanıcı adı veya şifre boş bırakılamaz!';
$status = 'alert-danger';
} else {
$kullanici_kontrol = $db->prepare("SELECT id,kullaniciadi, sifre FROM jestlog WHERE kullaniciadi = ? AND sifre = ?");
$kullanici_kontrol->execute(array($kullanici_adi, $sifre));
if ($kullanici_kontrol->rowCount() > 0) {
$row = $kullanici_kontrol->fetch(PDO::FETCH_OBJ);
$_SESSION['login'] = true;
$_SESSION['kullanici_id'] = $row->id;
header("Location:index.php");
} else {
$msg = 'Sisteme kayıtlı kullanıcı bulunmadı!';
$status = 'alert-danger';
}
}
}
?>
<!doctype html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>JESTLOG Birliği | Oyuncu Girişi</title>
<link rel="stylesheet" href="boot/css/bootstrap.min.css">
</head>
<body>
<div class="container-fluid">
<div class="row m-5">
<div class="col-3">
<form action="" method="post">
<legend>Giriş</legend>
<div class="mb-3">
<label for="" class="form-label">Kullanıcı Adı:</label>
<input type="text" class="form-control" id="" name="kullaniciadi" required>
</div>
<div class="mb-3">
<label for="" class="form-label">Şifre:</label>
<input type="password" class="form-control" id="" name="sifre" required>
</div>
<?php
if (isset($msg)) { ?>
<div class="alert <?php echo $status; ?>" role="alert">
<?php echo $msg; ?>
</div>
<?php } ?>
<button class="btn btn-success" type="submit">Giriş Yap</button>
</form>
</div>
</div>
</div>
</body>
</html>
-------
Sayfadan Çıkış Sayfamızı yapalım.
cikis.php
<?php
session_start();
session_destroy();
header('Location:giris.php');
?>
------------
Oyuncu Kayıt Sayfamızı Oluşturalım..
kayit.php
<?php
include "jestlog.php";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$kullaniciadi = trim($_POST["kullaniciadi"]);
$sifre = trim($_POST["sifre"]);
$sifre_tekrar = trim($_POST["sifre_tekrar"]);
$eposta = trim($_POST["eposta"]);
$adsoyad = trim($_POST["adsoyad"]);
$job = trim($_POST["job"]);
$telefon = trim($_POST["telefon"]);
$oyuncuismi = trim($_POST["oyuncuismi"]);
if (empty($kullaniciadi) || empty($sifre) || empty($eposta) || empty($adsoyad) || empty($job)|| empty($telefon)|| empty($oyuncuismi)) {
$msg = 'Yıldızlı alanlar boş bırakılamaz.';
$status = 'alert-danger';
} else {
$ayni_varmi = $db->prepare("SELECT * FROM jestlog WHERE kullaniciadi = ?");
$ayni_varmi->execute(array($kullaniciadi));
if ($ayni_varmi->rowCount()) {
$msg = 'Bu kullanıcı adı zaten kullanılıyor. Farklı bir kullanıcı adı deneyin.';
$status = 'alert-danger';
} else {
if ($sifre == $sifre_tekrar) {
$ekle = $db->prepare("INSERT INTO jestlog (kullaniciadi, sifre, eposta, adsoyad, job, telefon, oyuncuismi) VALUES (?,?,?,?,?,?,?)");
$ekle->execute(array($kullaniciadi, $sifre, $eposta, $adsoyad, $job, $telefon, $oyuncuismi));
if ($ekle) {
$msg = 'Oyuncu Kayıt işlemi tamamlandı.';
$status = 'alert-success';
} else {
$msg = 'Oyuncu kaydı başarısız. Bir sorun oluştu.';
$status = 'alert-danger';
}
} else {
$msg = 'Şifreler uyuşmuyor kontrol ediniz!';
$status = 'alert-danger';
}
}
}
}
?>
<!doctype html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>JESTLOG Birliği | Oyuncu Kayıt Formu</title>
<link rel="stylesheet" href="boot/css/bootstrap.min.css">
</head>
<body>
<div class="container-fluid">
<div class="row m-5">
<div class="col-3">
<form action="" method="post">
<legend>Kayıt Formu</legend>
<div class="mb-3">
<label for="" class="form-label">Kullanıcı Adı:</label>
<input type="text" class="form-control" id="" name="kullaniciadi" required>
</div>
<div class="mb-3">
<label for="" class="form-label">E-posta:</label>
<input type="email" class="form-control" id="" name="eposta" required>
</div>
<div class="mb-3">
<label for="" class="form-label">Adı Soyadı:</label>
<input type="text" class="form-control" id="" name="adsoyad" required>
</div>
<div class="mb-3">
<label for="" class="form-label">Oyuncu İsmi(örn:KingOfJestlog):</label>
<input type="text" class="form-control" id="" name="oyuncuismi" required>
</div>
<div class="mb-3">
<label for="" class="form-label">Oyuncu Meslek(örn: Warrior):</label>
<input type="text" class="form-control" id="" name="job" required>
</div>
<div class="mb-3">
<label for="" class="form-label">Telefon No:</label>
<input type="text" class="form-control" id="" name="telefon" required>
</div>
<div class="mb-3">
<label for="" class="form-label">Şifre:</label>
<input type="password" class="form-control" id="" name="sifre" required>
</div>
<div class="mb-3">
<label for="" class="form-label">Şifre Tekrar:</label>
<input type="password" class="form-control" id="" name="sifre_tekrar" required>
</div>
<?php
if (isset($msg)) { ?>
<div class="alert <?php echo $status; ?>" role="alert">
<?php echo $msg; ?>
</div>
<?php } ?>
<button class="btn btn-primary" type="submit">Kayıt Ol</button>
</form>
</div>
</div>
</div>
</body>
</html>
--------------
Dosyaları Paylaşılacaktır.
Kaynak: Jestlog Yönetici
Yorum Gönder