-
DarkWorm
Mail: [email protected]
Kaynak kodlar!
UYARI: TEMA MEVCUT DEĞİL SADECE BÜLTEN BOTU, SCRİPT VE DB MEVCUT.
''ÇALINTI DEĞİL AÇIK KAYNAK KODLU OLARAK VERDİM ZATEN''
AYRICA LOGO VE TEMA KONUSUNDA DA ÇALIŞIYORUM BU FORUMUN ADINA BİR BAHİS SİTESİ OLACAK İLGİ DURUMUNA GÖRE GELİŞTİRMEYE DEVAM EDERİM.
UYARI: TEMA MEVCUT DEĞİL SADECE BÜLTEN BOTU, SCRİPT VE DB MEVCUT.
''ÇALINTI DEĞİL AÇIK KAYNAK KODLU OLARAK VERDİM ZATEN''
AYRICA LOGO VE TEMA KONUSUNDA DA ÇALIŞIYORUM BU FORUMUN ADINA BİR BAHİS SİTESİ OLACAK İLGİ DURUMUNA GÖRE GELİŞTİRMEYE DEVAM EDERİM.
<?php
// SpyBet Bahis Sistemi Backend
// Yapımcı: SpyHackerz - DarkWorm
// İletişim: https://spyhackerz.org/forum/members/darkworm.268764/
// Yapım Tarihi: 30/12/2024
// OddsAPI Anahtarınızı buraya ekleyin
$apiKey = 'YOUR_ODDSAPI_KEY';
$baseUrl = 'https://api.the-odds-api.com/v4/sports';
// Veritabanı bağlantı ayarları
$host = 'localhost';
$dbname = 'betting_system';
$username = 'root';
$password = '';
try {
$pdo = new PDO("mysql:host=$host;dbname=$dbname;charset=utf8", $username, $password);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
die("Veritabanına bağlanırken bir hata oluştu: " . $e->getMessage());
}
// OddsAPI'den veri çekme fonksiyonu
function fetchOddsApiData($endpoint, $apiKey)
{
$url = "$endpoint?apiKey=$apiKey";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl);
curl_close($curl);
return json_decode($response, true);
}
// Bahis bülteni API'den çekme
function updateBettingBulletin($pdo, $apiKey, $baseUrl)
{
$sport = 'soccer'; // Futbol veri çekiliyor
$regions = 'eu'; // Avrupa bölgesi
$markets = 'h2h'; // Head-to-head oranları
$endpoint = "$baseUrl/$sport/odds/?regions=$regions&markets=$markets";
$oddsData = fetchOddsApiData($endpoint, $apiKey);
if (!$oddsData || isset($oddsData['error'])) {
die("API'den veri çekerken bir hata oluştu: " . ($oddsData['error'] ?? 'Bilinmeyen bir hata'));
}
foreach ($oddsData as $match) {
$homeTeam = $match['home_team'] ?? 'Belirtilmemiş';
$awayTeam = $match['away_team'] ?? 'Belirtilmemiş';
$commenceTime = $match['commence_time'] ?? 'Belirtilmemiş';
$odds = json_encode($match['bookmakers'] ?? []);
$stmt = $pdo->prepare(
"INSERT INTO matches (home_team, away_team, commence_time, odds) VALUES (:home_team, :away_team, :commence_time, :odds)
ON DUPLICATE KEY UPDATE commence_time = :commence_time, odds = :odds"
);
$stmt->execute([
':home_team' => $homeTeam,
':away_team' => $awayTeam,
':commence_time' => $commenceTime,
':odds' => $odds
]);
}
echo "Bahis bülteni güncellendi.\n";
}
// Kullanıcı kayıt fonksiyonu
function registerUser($pdo, $username, $password)
{
$hashedPassword = password_hash($password, PASSWORD_BCRYPT);
$stmt = $pdo->prepare("INSERT INTO users (username, password) VALUES (:username, :password)");
return $stmt->execute([':username' => $username, ':password' => $hashedPassword]);
}
// Kullanıcı giriş fonksiyonu
function loginUser($pdo, $username, $password)
{
$stmt = $pdo->prepare("SELECT * FROM users WHERE username = :username");
$stmt->execute([':username' => $username]);
$user = $stmt->fetch(PDO::FETCH_ASSOC);
if ($user && password_verify($password, $user['password'])) {
session_start();
$_SESSION['user_id'] = $user['id'];
return true;
}
return false;
}
// Kullanıcı cüzdanı sistemi
function updateWallet($pdo, $userId, $amount, $transactionType)
{
$stmt = $pdo->prepare(
"INSERT INTO wallet_transactions (user_id, amount, transaction_type) VALUES (:user_id, :amount, :transaction_type)"
);
$stmt->execute([
':user_id' => $userId,
':amount' => $amount,
':transaction_type' => $transactionType
]);
$updateStmt = $pdo->prepare(
"UPDATE users SET wallet_balance = wallet_balance + :amount WHERE id = :user_id"
);
return $updateStmt->execute([
':amount' => $transactionType === 'deposit' ? $amount : -$amount,
':user_id' => $userId
]);
}
// Bonus yönetimi fonksiyonu
function addBonus($pdo, $userId, $bonusAmount, $bonusType)
{
$stmt = $pdo->prepare(
"INSERT INTO bonuses (user_id, amount, type, status) VALUES (:user_id, :amount, :type, 'active')"
);
return $stmt->execute([
':user_id' => $userId,
':amount' => $bonusAmount,
':type' => $bonusType
]);
}
// Kullanıcı işlem geçmişi
function getUserHistory($pdo, $userId)
{
$stmt = $pdo->prepare("SELECT * FROM bets WHERE user_id = :user_id");
$stmt->execute([':user_id' => $userId]);
$bets = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt = $pdo->prepare("SELECT * FROM wallet_transactions WHERE user_id = :user_id");
$stmt->execute([':user_id' => $userId]);
$transactions = $stmt->fetchAll(PDO::FETCH_ASSOC);
return [
'bets' => $bets,
'transactions' => $transactions
];
}
// Kombine bahis ekleme fonksiyonu
function placeCombinedBet($pdo, $userId, $bets, $amount)
{
$totalOdds = 1;
foreach ($bets as $bet) {
$totalOdds *= $bet['odds'];
}
$stmt = $pdo->prepare(
"INSERT INTO combined_bets (user_id, bet_details, amount, total_odds) VALUES (:user_id, :bet_details, :amount, :total_odds)"
);
$stmt->execute([
':user_id' => $userId,
':bet_details' => json_encode($bets),
':amount' => $amount,
':total_odds' => $totalOdds
]);
$walletUpdate = $pdo->prepare(
"UPDATE users SET wallet_balance = wallet_balance - :amount WHERE id = :user_id"
);
return $walletUpdate->execute([
':amount' => $amount,
':user_id' => $userId
]);
}
// Promosyon kodu ekleme fonksiyonu
function applyPromoCode($pdo, $userId, $promoCode)
{
$stmt = $pdo->prepare("SELECT * FROM promo_codes WHERE code = :promo_code AND status = 'active'");
$stmt->execute([':promo_code' => $promoCode]);
$promo = $stmt->fetch(PDO::FETCH_ASSOC);
if ($promo) {
$bonusAmount = $promo['amount'];
addBonus($pdo, $userId, $bonusAmount, 'promo');
$updateStmt = $pdo->prepare("UPDATE promo_codes SET status = 'used' WHERE code = :promo_code");
$updateStmt->execute([':promo_code' => $promoCode]);
return true;
}
return false;
}
// Maç ekleme fonksiyonu (Yönetici)
function addMatch($pdo, $homeTeam, $awayTeam, $date, $odds)
{
$stmt = $pdo->prepare(
"INSERT INTO matches (home_team, away_team, match_date, odds) VALUES (:home_team, :away_team, :match_date, :odds)"
);
return $stmt->execute([
':home_team' => $homeTeam,
':away_team' => $awayTeam,
':match_date' => $date,
':odds' => json_encode($odds)
]);
}
// Bahis yapma fonksiyonu
function placeBet($pdo, $userId, $matchId, $amount, $selectedTeam)
{
$stmt = $pdo->prepare(
"INSERT INTO bets (user_id, match_id, amount, selected_team) VALUES (:user_id, :match_id, :amount, :selected_team)"
);
$stmt->execute([
':user_id' => $userId,
':match_id' => $matchId,
':amount' => $amount,
':selected_team' => $selectedTeam
]);
$walletUpdate = $pdo->prepare(
"UPDATE users SET wallet_balance = wallet_balance - :amount WHERE id = :user_id"
);
return $walletUpdate->execute([
':amount' => $amount,
':user_id' => $userId
]);
}
// Maçları listeleme fonksiyonu
function listMatches($pdo)
{
$stmt = $pdo->query("SELECT * FROM matches");
return $stmt->fetchAll(PDO::FETCH_ASSOC);
}
// OddsAPI'den bahis bülteni güncelleme
updateBettingBulletin($pdo, $apiKey, $baseUrl);
?>
Ekli dosyalar
💬 SpyHackerz Telegram — Anlık tartışmalar ve duyurular için katıl