require("entete.php");
getlangage("jackpot");
$tpl->box['boxconnected'] = NULLSTR;
if($_USER['userstatus'] > 1)
{
$_POST['action'] = isset($_POST['action']) ? $_POST['action'] : 'defaut';
if ($_POST['action']=='defaut')
{
$_USER['credits'] = getCredits();
$_USER['credits'] = $_USER['credits']>0 ? $_USER['credits'] : '0';
$tpl->box[play_bt] = $_USER['credits']>0 ? $tpl->gettemplate("jackpot","PlayBtOk") : $tpl->gettemplate("jackpot","PlayBtNok");
$tpl->box['jackpot'] = $tpl->gettemplate("jackpot","welcome");
}
if ($_POST['action']=='read')
{
$tpl->box['jackpot'] = $tpl->gettemplate("jackpot","Regles");
}
if ($_POST['action']=='play')
{
$tpl->box['gameresult'] = $tpl->attlang("start");
$tpl->box['img1'] = $tpl->gettemplate("jackpot","image01");
$tpl->box['img2'] = $tpl->gettemplate("jackpot","image02");
$tpl->box['img3'] = $tpl->gettemplate("jackpot","image03");
$tpl->box['jackpot'] = $tpl->gettemplate("jackpot","PlanJeu");
}
if ($_POST['action']=='getresult')
{
$_USER['credits'] = getCredits();
if ($_USER['credits']>0)
{
$query = $sql->query('UPDATE '.$_PRE.'jackpot SET credits=credits-1, lastaction="'.time().'" WHERE userid="'.$_USER['userid'].'" ');
$_USER['credits'] = $_USER['credits']-1;
$img1 = getImgJackpot();
$img2 = getImgJackpot();
$img3 = getImgJackpot();
$result = $img1.$img2.$img3;
if (strcmp($result,'123')==0)
{
$query = $sql->query('UPDATE '.$_PRE.'jackpot SET credits=credits+10 WHERE userid="'.$_USER['userid'].'" ');
$_USER['credits'] = $_USER['credits']+10;
$tpl->box['gameresult'] = $tpl->attlang("jackpot");
}
if (strcmp($result,'023')==0 || strcmp($result,'103')==0 || strcmp($result,'120')==0)
{
$query = $sql->query('UPDATE '.$_PRE.'jackpot SET credits=credits+5 WHERE userid="'.$_USER['userid'].'" ');
$_USER['credits'] = $_USER['credits']+5;
$tpl->box['gameresult'] = $tpl->attlang("bonus");
}
$tpl->box['img1'] = affImageJackpot($img1);
$tpl->box['img2'] = affImageJackpot($img2);
$tpl->box['img3'] = affImageJackpot($img3);
$tpl->box['jackpot'] = $tpl->gettemplate("jackpot","PlanJeu");
}
else
{
$tpl->box[play_bt] = $_USER['credits']>0 ? $tpl->gettemplate("jackpot","PlayBtOk") : $tpl->gettemplate("jackpot","PlayBtNok");
$tpl->box['jackpot'] = $tpl->gettemplate("jackpot","welcome");
}
}
}
else
$tpl->box['jackpot']=$tpl->gettemplate("jackpot","idrequired");
$cache .= $tpl->gettemplate("jackpot","JackpotAccueil");
$tps = number_format(get_microtime() - $tps_start,4);
$cache .= $tpl->gettemplate("baspage","endhtml");
$tpl->output($cache);
?>