C 1
chengdu
xranzei 1
xranzei
zendor2 1
zendor2
Bvural41 1
Bvural41
noisiv 1
noisiv
Manwe Work 1
Manwe Work
Almira2 1
Almira2
romegames 1
romegames
D 1
delimuratt
melankolıa18 1
melankolıa18
shrpnl 1
shrpnl
Hikaye Ekle
Reklam vermek için turkmmo@gmail.com

Sitenize E-Pin sistemi ekleyin

Shorty

Teknik Sorumlu
Telefon Numarası Onaylanmış Üye TC Kimlik Numarası Doğrulanmış Üye
Teknik
VIP Üye
Katılım
31 May 2009
Konular
772
Mesajlar
4,174
Online süresi
4d 8h
Reaksiyon Skoru
3,477
Altın Konu
1
Başarım Puanı
337
Yaş
33
MmoLira
1,221
DevLira
3
Ticaret - 0%
0   0   0

ROHAN2 WORLD 1-120 TR TİPİ OFFICIAL YOHARA, BALATHOR VE AMON! 80. GÜNÜNDE! +10.000 ONLİNE! HİLE VE BOT %100 ENGELLİ 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:

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

şorti bu işte bir numara.
 
Teşekkürler. Bunu arıyordum. Fakat güvenlik açığı var sanırım :target:
 

Şu an konuyu görüntüleyenler (Toplam : 0, Üye: 0, Misafir: 0)

Geri
Üst