<commit_before>﻿<?php

	$serveur="localhost";
	$login = "imperacu_vote";
	$pass = "<PASSWORD>";
	
	//--------------------------------------------------------------------------
	//			CONNEXION AU RCON POUR ENVOYER DES COMMANDES AU SERVEUR
	//--------------------------------------------------------------------------
	require_once('Rcon.class.php'); 
	
	$r = new rcon("192.168.127.12",23375,"(Ne revez pas, je l'ai retiré)"); // ("IP",port,"mdp")
	
	if(isset($_GET['pseudo']))
	{
		
		/* On récupère le pseudo */
		$pseudo = htmlspecialchars($_GET["pseudo"]);
		if ($pseudo <> "" and $pseudo <> "Roger") 
		{
			try{
				$bdd = new PDO("mysql:host=$serveur;dbname=imperacu_vote;charset=utf8",$login,$pass);
			}
			catch (Exception $e)
			{
				die('Erreur : ' . $e->getMessage());
			}
			//$sql = 'SELECT * FROM `votage` WHERE `pseudo` = "'.$pseudo.'" LIMIT 0,1';
			//$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
			$req = $bdd->query('SELECT * FROM `votage` WHERE `pseudo` = "'.$pseudo.'" ORDER BY id DESC LIMIT 0,1'); //ORDER BY ID DESC
			$data = $req->fetch();
			$diff = time() - $data["date"];
			//echo "<script type='text/javascript'>alert('le dernier vote de ".$data['pseudo']." à été fait le ".$data['date']." et ".$diff."');</script>";
			if((time() - $data["date"]) > 86400)
			{
				$command = 'give '. $pseudo .' minecraft:diamond';
				$message = 'say '.$pseudo.' viens de voter pour ImperReborn et gagne 1 diamant ! Merci !';
				$date = time();
				if($r->Auth()){
					$r->rconCommand($command);
					$r->rconCommand($message);
				}
				try{

					$connexion = new PDO("mysql:host=$serveur;dbname=imperacu_vote",$login,$pass);
					$connexion->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
					$insertion = "INSERT INTO votage(`pseudo`, `date`) VALUES ('".$pseudo."', '".$date."')";
					$connexion->exec($insertion);
					echo "<script type='text/javascript'>document.location.replace('http://www.serveurs-minecraft.org/vote.php?id=48119');</script>";
				}
				catch(PDOException $e){
					echo 'Echec : '.$e->getMessage();
				}
			}
			else
			{
				echo "<script type='text/javascript'>alert('Désolé, vous avez dejà voté il y a moins de 24h');</script>";
			}
		}
		else
		{
			if ($pseudo = "Roger")
			{
				$message = 'say '.$pseudo.' viens de voter pour ImperReborn et pond 1 diamant ! <NAME> !';
				if($r->Auth())
				{
					$r->rconCommand($message);
				}
				echo "<script type='text/javascript'>document.location.replace('http://www.serveurs-minecraft.org/vote.php?id=48119');</script>";
			}
			else
			{
				echo "<script type='text/javascript'>alert('Veuillez entrer un pseudo');</script>";
			}
		}
	}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
	<meta charset="utf-8">
	<title>PunkVote - Votez pour ImperAttack</title>
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.4/css/bootstrap.min.css" integrity="<KEY>" crossorigin="anonymous">
	<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>

	<!-- UN PEU DE CSS POUR ADAPTER BOOTSTRAP A NOS BESOINS -->
	<style type="text/css">
		body{
			background-image: url("img/use_your_illusion.png");
			padding:10px;
			
		}
		
		#global {
			background-color:#F4FAFC;
			max-width:900px;
			margin:auto;
			text-align:center;
			padding:20px;
			margin-top:10px;
			border-radius:25px;<commit_msg>Bug hunt<commit_after>﻿<?php

	$serveur="localhost";
	$login = "imperacu_vote";
	$pass = "<PASSWORD>";
	
	//--------------------------------------------------------------------------
	//			CONNEXION AU RCON POUR ENVOYER DES COMMANDES AU SERVEUR
	//--------------------------------------------------------------------------
	require_once('Rcon.class.php'); 
	
	$r = new rcon("192.168.127.12",23375,"(Ne revez pas, je l'ai retiré)"); // ("IP",port,"mdp")
	
	if(isset($_GET['pseudo']))
	{
		
		/* On récupère le pseudo */
		$pseudo = htmlspecialchars($_GET["pseudo"]);
		if ($pseudo <> "" and $pseudo <> "Roger") 
		{
			try{
				$bdd = new PDO("mysql:host=$serveur;dbname=imperacu_vote;charset=utf8",$login,$pass);
			}
			catch (Exception $e)
			{
				die('Erreur : ' . $e->getMessage());
			}
			//$sql = 'SELECT * FROM `votage` WHERE `pseudo` = "'.$pseudo.'" LIMIT 0,1';
			//$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
			$req = $bdd->query('SELECT * FROM `votage` WHERE `pseudo` = "'.$pseudo.'" ORDER BY id DESC LIMIT 0,1'); //ORDER BY ID DESC
			$data = $req->fetch();
			$diff = time() - $data["date"];
			//echo "<script type='text/javascript'>alert('le dernier vote de ".$data['pseudo']." à été fait le ".$data['date']." et ".$diff."');</script>";
			if((time() - $data["date"]) > 86400)
			{
				$command = 'give '. $pseudo .' minecraft:diamond';
				$message = 'say '.$pseudo.' viens de voter pour ImperReborn et gagne 1 diamant ! Merci !';
				$date = time();
				if($r->Auth()){
					$r->rconCommand($command);
					$r->rconCommand($message);
				}
				try{

					$connexion = new PDO("mysql:host=$serveur;dbname=imperacu_vote",$login,$pass);
					$connexion->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
					$insertion = "INSERT INTO votage(`pseudo`, `date`) VALUES ('".$pseudo."', '".$date."')";
					$connexion->exec($insertion);
					echo "<script type='text/javascript'>document.location.replace('http://www.serveurs-minecraft.org/vote.php?id=48119');</script>";
				}
				catch(PDOException $e){
					echo 'Echec : '.$e->getMessage();
				}
			}
			else
			{
				echo "<script type='text/javascript'>alert('Désolé, vous avez dejà voté il y a moins de 24h');</script>";
			}
		}
		else
		{
			if ($pseudo = "Roger")
			{
				$message = 'say '.$pseudo.' viens de voter pour ImperReborn et pond 1 diamant ! Merci Roger !';
				if($r->Auth())
				{
					$r->rconCommand($message);
				}
				echo "<script type='text/javascript'>document.location.replace('http://www.serveurs-minecraft.org/vote.php?id=48119');</script>";
			}
			else
			{
				echo "<script type='text/javascript'>alert('Veuillez entrer un pseudo');</script>";
			}
		}
	}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
	<meta charset="utf-8">
	<title>PunkVote - Votez pour ImperAttack</title>
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.4/css/bootstrap.min.css" integrity="<KEY>" crossorigin="anonymous">
	<!-- UN PEU DE CSS POUR ADAPTER BOOTSTRAP A NOS BESOINS -->
	<style type="text/css">
		body{
			background-image: url("img/use_your_illusion.png");
			padding:10px;
			
		}
		
		#global {
			background-color:#F4FAFC;
			max-width:900px;
			margin:auto;
			text-align:center;
			padding:20px;
			margin-top:10px;
			border-radius:25px;
{'fraction_non_alphanumeric': 0.24372759856630824, 'fraction_numerical': 0.01747311827956989, 'mean_word_length': 2.948702830188679, 'pattern_counts': {'":': 0, '<': 58, '<?xml version=': 0, '>': 82, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2420238', 'n_tokens_mistral': 2857, 'n_tokens_neox': 2404, 'n_words': 459}