MEGAFILES
Invité n'ayant pas de compte PHPfrance
07 mars 2012, 22:56
Voilà les codes premium
<?php
require_once "global.php";
define('NAV_ID', 2);
if (!LOGGED_IN)
{
@header('Location: login.html?redir=' . $_SERVER['REQUEST_URI']);
exit;
}
if (isset($_GET['verif']) && isset($_POST['code1']))
{
$ident = $idp = $ids = $idd = $codes = $code1 = $code2 = $code3 = $code4 = $code5 = $datas = '';
$idp = 20697;
$idd = 72516;
$ident=$idp.";".$ids.";".$idd;
if(isset($_POST['code1'])) $code1 = filter($_POST['code1']);
if(isset($_POST['code2'])) $code2 = ";" . $_POST['code2'];
if(isset($_POST['code3'])) $code3 = ";" . $_POST['code3'];
if(isset($_POST['code4'])) $code4 = ";" . $_POST['code4'];
if(isset($_POST['code5'])) $code5 = ";" . $_POST['code5'];
$codes = $code1 . $code2 . $code3 . $code4 . $code5;
if(isset($_POST['DATAS'])) $datas = $_POST['DATAS'];
$ident = urlencode($ident);
$codes = urlencode($codes);
$datas = urlencode($datas);
$get_f = @file("http://script.starpass.fr/check_php.php?ident=$ident&codes=$codes&DATAS=$datas");
if(!$get_f)
{
exit("Votre serveur n'a pas accès au serveur de Starpass, merci de contacter votre hébergeur.");
}
$tab = explode("|",$get_f[0]);
if(!$tab[1]) { $url = "http://script.starpass.fr/erreur.php"; } else { $url = $tab[1]; }
$pays = $tab[2];
$palier = urldecode($tab[3]);
$id_palier = urldecode($tab[4]);
$type = urldecode($tab[5]);
if(substr($tab[0],0,3) != "OUI")
{
@header("Location: $url");
exit;
}
else
{
setCookie("CODE_BON", "1", 0);
if ($users->IsAdmin(USER_NAME)) { $rank = USER_RANK; } else { $rank = 2; }
dbquery("UPDATE users SET rank = '" . $rank . "' WHERE username = '" . USER_NAME ."' LIMIT 1");
$exist = dbquery("SELECT null FROM user_premium WHERE user_id = '" . USER_ID . "' LIMIT 1");
if ($db->Result($exist) == true)
{
$length = $db->Evaluate(dbquery("SELECT timeout FROM user_premium WHERE user_id = '" . USER_ID . "'"), 0) + 2592000; // On rajoute du temps
dbquery("UPDATE user_premium SET timestart = '" . time() . "', timeout = '" . $length . "' WHERE user_id = '" . USER_ID . "' LIMIT 1");
}
else
{
dbquery("INSERT INTO user_premium (user_id,timestart,timeout) VALUES ('" . USER_ID . "','" . time() . "','" . 2592000 . "')");
}
}
}
$tpl->Init();
$tpl->SetParam('page_title', 'Devenir membre premium');
$tpl->AddGeneric('page-head');
$tpl->AddIncludeSet('default');
$tpl->WriteIncludeFiles();
$tpl->Write('<style type="text/css">
div#starpass_72516 #sk-kit { border-radius: 5px !important; -moz-border-radius: 5px !important; -webkit-border-radius: 5px; box-shadow: 0px 0px 10px #000 !important; }
div#starpass_72516 #sk-kit input, span { border-radius: 5px !important; -moz-border-radius: 5px !important; -webkit-border-radius: 5px !important; }
</style>');
$tpl->Write('</head>');
$tpl->AddGeneric('menu');
$tpl->AddGeneric('comp-premium');
$tpl->AddGeneric('comp-footer');
$tpl->Output();
?>
et le script cron
<?php
$query = dbquery("SELECT * FROM user_premium");
if (mysql_num_rows($query) >= 1)
{
while ($Data = mysql_fetch_assoc($query))
{
$user_id = intval($Data['user_id']);
$timeout = $Data['timeout'];
$timestart = $Data['timestart'];
}
if ((time() - $timestart) >= $timeout)
{
dbquery("DELETE FROM user_premium WHERE user_id = '" . $user_id . "'");
}
else
{
dbquery("UPDATE user_premium SET timestart = '" . time() . "' WHERE user_id = '" . $user_id . "'");
}
}
?>
J'utilise la class.cron.php de UBERCMS [Rétro Habbo] et cela fonctionne, enfin, je crois ^^