<?php include "core/menu.php" ?>
							<br/><br/>
						</div>
					</div>
				</div>
				
				<div class="spacer"></div>				<div class="news">
				<div />
				<div>
				<center>
<p>Votez pour le serveur :</p> <br>
<?php
try
{
    $pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
    $bdd = new PDO('mysql:host=127.0.0.1;dbname=auth','root','', $pdo_options);
    $reponse = $bdd->query('SELECT date_vote, date_vote2 FROM account WHERE username = "'.$_SESSION['username'].'"');
	$donnees = $reponse->fetch();
    $date_vote = $donnees['date_vote'];
	$date_vote2 = $donnees['date_vote2'];
	$date = date("Y-m-d H:i:s");
    $reponse->closeCursor();
}
catch(Exception $e)
{
    die('Erreur : '.$e->getMessage());
}
if(isset($_POST['Gowonda']))
{
	if($date > $date_vote)
	{
	$pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
	$bdd = new PDO('mysql:host=127.0.0.1;dbname=auth','root','', $pdo_options);
	$bdd->exec('UPDATE account SET dp = dp + 2, date_vote = "'.date("Y-m-d H:i:s",time()+7260).'" WHERE username = "'.$_SESSION['username'].'"');
	echo "Vos points ont &eacutet&eacute ajout&eacute sur votre compte.";
	?><br />
    <a href="http://www.rpg-paradize.com/?page=vote&vote=36545" target="_blank">Votez !</a><br />
    <?php
	}
	}
elseif($date < $date_vote)
{
	echo "Vous avez d&eacuteja votez il y a moins de 2 heures pour Gowonda !<br />";
}
else
{
?>
<form action="vote.php" method="post">
<input type="image" src="img/vote.gif" alt="submit" />
<input type="hidden" name="Gowonda" />
</form><br />
<?php
}
try
{
    $pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
    $bdd = new PDO('mysql:host=127.0.0.1;dbname=auth', 'root', '', $pdo_options);
    $reponse = $bdd->query('SELECT date_vote FROM account WHERE username = "'.$_SESSION['username'].'"');
	$donnees = $reponse->fetch();
    $date_vote = $donnees['date_vote'];
	$date = date("Y-m-d H:i:s");
    $reponse->closeCursor();
}
catch(Exception $e)
{
    die('Erreur : '.$e->getMessage());
}
if(isset($_POST['RPG']))
{
	if($date > $date_vote2)
	{
	$pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
	$bdd = new PDO('mysql:host=127.0.0.1;dbname=auth', 'root', '', $pdo_options);
	$bdd->exec('UPDATE account SET dp = dp + 2, date_vote2 = "'.date("Y-m-d H:i:s",time()+7260).'" WHERE username = "'.$_SESSION['username'].'"');
	echo "Vos points ont &eacutet&eacute ajout&eacute sur votre compte.";
	?><br />
    <a href="http://www.rpg-paradize.com/?page=vote&vote=36545" target="_blank">Votez !</a>
    <?php
	}
	}
elseif($date < $date_vote2)
{
	echo "Vous avez d&eacuteja votez il y a moins de 2 heures pour RPG-PARADIZE !";
}
else
{
?>
<form action="vote.php" method="post">
<input type="image" src="img/vote1.gif" alt="submit" />
<input type="hidden" name="RPG" />
</form>
<?php
}
?>
</div>
					</div>
					<div class="spacer"></div>
				</div>
			</div>

<?php include "core/end.php" ?>