Ayyıldız2 | 2008 TR Yapısı • 1-99 Orta Emek Destan • Oto Avsız • 10 Temmuz 21:00 HEMEN TIKLA!
Merhaba
Örnek kodlar aşağıdaki gibidir kendi sisteminize göre panelinize entegre edebilirsiniz.
!! Uyarı !! Kendi sisteminize göre güvenlik konusunda düzenlemeler yapmanız gerekebilir aşağıdaki kodlar E-Pin sisteminin mantığını anlamanız için örnek olarak yazılmıştır.
E-Pin Bozdur:
E-Pin Oluştur:
SQL:
Örnek kodlar aşağıdaki gibidir kendi sisteminize göre panelinize entegre edebilirsiniz.
!! Uyarı !! Kendi sisteminize göre güvenlik konusunda düzenlemeler yapmanız gerekebilir aşağıdaki kodlar E-Pin sisteminin mantığını anlamanız için örnek olarak yazılmıştır.
E-Pin Bozdur:
PHP:
<?php
/**
*
* @Author Shorty
* @Web www.oyunalisveris.com
*
*/
$mysqli = new mysqli('localhost', 'root', 'şifre', 'epin');
if ($mysqli->connect_errno)
{
echo "Sorry, this website is experiencing problems.";
echo "Error: Failed to make a MySQL connection, here is why: \n";
echo "Errno: " . $mysqli->connect_errno . "\n";
echo "Error: " . $mysqli->connect_error . "\n";
exit;
}
if (isset($_POST["submit"]))
{
$stmt = $mysqli->prepare("SELECT epin, expiretime, amount FROM epin WHERE BINARY epin=? AND status=1 LIMIT 1");
$stmt->bind_param("s", $_POST["pin"]);
$stmt->execute();
$stmt->bind_result($epin, $expiretime, $amount);
$stmt->store_result();
$stmt->fetch();
if($stmt->num_rows > 0)
{
if($expiretime > time())
{
/**
*
* Hesabın bakiyesi burada güncellenecek.
* E-Pin Bakiye Miktarı $amount değişkeni ile gelmektedir.
*
*/
echo 'Hesaba Yüklenen Bakiye: '.$amount;
$accountId = 1;
$mysqli->query("UPDATE epin SET status='2', accountid='".$accountId."', usetime='".time()."' WHERE epin='".$epin."'");
}
else
{
echo "E-Pin kullanım süresi doldu.";
}
}
else
{
echo "Hatalı bir E-Pin bilgili girildi";
}
$stmt->close();
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>E-Pin Girişi</title>
</head>
<body>
<form method="post">
E-Pin: <input type="text" name="pin" value="">
<input type="submit" name="submit">
</form>
</body>
</html>
E-Pin Oluştur:
PHP:
<?php
/**
*
* @Author Shorty
* @Web www.oyunalisveris.com
*
*/
$mysqli = new mysqli('localhost', 'root', 'şifre', 'epin');
if ($mysqli->connect_errno)
{
echo "Sorry, this website is experiencing problems.";
echo "Error: Failed to make a MySQL connection, here is why: \n";
echo "Errno: " . $mysqli->connect_errno . "\n";
echo "Error: " . $mysqli->connect_error . "\n";
exit;
}
$Bakiye = 5; //Ep
$Miktar = 100; //Adet
$SonKullanmaTarihi = time() + 30 * 24 * 60 * 60; // 30 Gün sonra E-Pin kullanılamaz duruma gelir süreyi istediğiniz gibi değiştirebilirsiniz.
for ($x = 0; $x <= $Miktar; $x++)
{
$pin = Pin(16, $Bakiye);
$mysqli->query("INSERT INTO epin (epin, amount, createtime, expiretime, status) VALUES ('".$pin."', '".$Bakiye."', '".time()."', '".$SonKullanmaTarihi."', '1')");
echo $pin."<br>";
}
function Pin($lenght = 16, $amount)
{
if (function_exists("random_bytes"))
{
$bytes = random_bytes(ceil($lenght / 2) * $amount);
}
elseif (function_exists("openssl_random_pseudo_bytes"))
{
$bytes = openssl_random_pseudo_bytes(ceil($lenght / 2) * $amount);
}
else
{
die("no cryptographically secure random function available");
}
return substr(bin2hex($bytes), 0, $lenght);
}
SQL:
Kod:
CREATE TABLE `epin` (
`epin` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`amount` int(11) NULL DEFAULT 0 ,
`createtime` int(11) NULL DEFAULT NULL ,
`expiretime` int(11) NULL DEFAULT NULL ,
`usetime` int(11) NULL DEFAULT 0 ,
`accountid` int(11) NULL DEFAULT 0 ,
`status` int(1) NULL DEFAULT 0 COMMENT '0 : Pasif\r\n1: Kullanılabilir\r\n2: Kullanıldı' ,
UNIQUE INDEX `epin` (`epin`) USING BTREE
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
ROW_FORMAT=DYNAMIC
;
Son düzenleme:
En Çok Reaksiyon Alan Mesajlar
Oyunalisveris.com için epin sistemini nasıl yapabilirim diye soran arkadaşlar faydalanabilirler
Oyunalisveris.com için epin sistemini nasıl yapabilirim diye soran arkadaşlar faydalanabilirler 

Şu an konuyu görüntüleyenler (Toplam : 0, Üye: 0, Misafir: 0)
Benzer konular
Altın Konu
Hesap Satış Sistemi
- Cevaplar
- 22
- Görüntüleme
- 2K
- Cevaplar
- 37
- Görüntüleme
- 2K
