This commit is contained in:
Gnieark 2015-12-03 13:04:33 +01:00
parent bc9335220e
commit a9e95a8007
3 changed files with 26 additions and 17 deletions

View File

@ -1,23 +1,24 @@
CREATE TABLE IF NOT EXISTS `arena_history` (
`game` int(11) NOT NULL, CREATE TABLE `arena_history` (
`game` varchar(8) NOT NULL,
`player1_id` int(11) NOT NULL, `player1_id` int(11) NOT NULL,
`player2_id` int(11) NOT NULL, `player2_id` int(11) NOT NULL,
`player1_winsCount` int(11) NOT NULL, `player1_winsCount` int(11) NOT NULL,
`player2_winsCount` int(11) NOT NULL, `player2_winsCount` int(11) NOT NULL,
`nulCount` int(11) NOT NULL `nulCount` int(11) NOT NULL,
PRIMARY KEY (`game`,`player1_id`,`player2_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE `arena_history`
ADD PRIMARY KEY (`game`,`player1_id`,`player2_id`);
CREATE TABLE `bots` (
CREATE TABLE IF NOT EXISTS `bots` ( `id` int(11) NOT NULL AUTO_INCREMENT,
`id` int(11) NOT NULL,
`name` text NOT NULL, `name` text NOT NULL,
`game` varchar(10) NOT NULL, `game` varchar(10) NOT NULL,
`url` int(11) NOT NULL, `url` text NOT NULL,
`description` text NOT NULL, `description` text NOT NULL,
`active` int(1) NOT NULL `active` int(1) NOT NULL,
) ENGINE=InnoDB DEFAULT CHARSET=latin1; `date_inscription` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
ALTER TABLE `bots` `validate_secret` varchar(8) NOT NULL,
ADD PRIMARY KEY (`id`); PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
INSERT INTO `bots` VALUES (1,'moul','tictactoe','http://tictactoe.m.42.am/','moul\'s Tic Tac Toe resolver in Golang. <a href=\"https://github.com/moul/tictactoe\">Open sourced</a> using Minimax algorithm',1,'2015-12-03 10:55:34',''),(2,'stupidAI','tictactoe','http://morpionmaster.tinad.fr/stupidIa.php','A PHP script that choose next case by... random. <a href=\"https://github.com/jeannedhack/programmingChallenges/blob/master/morpionsFights/Master/stupidIa.php>By Gnieark, here on github</a>',1,'2015-12-03 10:55:34',''),(3,'Gnieark','tictactoe','http://morpionmaster.tinad.fr/gnieark.php','Gnieark\'s PHP AI, using minmax algorythm. <a href=\"https://github.com/gnieark/tictactoeChallenge\">Published on github</a>',1,'2015-12-03 10:55:34','');

View File

@ -11,7 +11,7 @@ switch($_POST['act']){
erreur(404,"wrong post parameter"); erreur(404,"wrong post parameter");
} }
//botname -> il ne doit pas y avoir una autre bot //botname -> il ne doit pas y avoir un autre bot du même nom sur le même jeu
$rs=mysqli_query($lnMysql, $rs=mysqli_query($lnMysql,
"SELECT 1 "SELECT 1
FROM bots FROM bots
@ -38,9 +38,17 @@ switch($_POST['act']){
$alerts.="L'email n'est pas valide\n"; $alerts.="L'email n'est pas valide\n";
} }
//BotDescription=> a voir //BotDescription=> a voir
if($alerts <>""){
}else{
//enregistrer le bot et envoyer un email pour la validation
}
echo "TODO"; echo "TODO";
break; break;

View File

@ -16,7 +16,7 @@ echo $lang['SITE_DESCRIPTION'];?>
?> ?>
</select></p> </select></p>
<p><label for="botURL">URL du bot:</label><input type="text" name="botURL" id="botURL" placeholder="http://"/></p> <p><label for="botURL">URL du bot:</label><input type="text" name="botURL" id="botURL" placeholder="http://"/></p>
<p><label>Description:</label><textarea></textarea></p> <p><label>Description:</label><textareaname="botDescription"></textarea></p>
<p><label for="email">Votre e-mail (sera utilisé pour valider l'inscription du bot)</label><input type="text" name="email" id="email"/></p> <p><label for="email">Votre e-mail (sera utilisé pour valider l'inscription du bot)</label><input type="text" name="email" id="email"/></p>
<p><input type="submit" value="Enregistrer mon bot"/></p> <p><input type="submit" value="Enregistrer mon bot"/></p>
</form> </form>