botsArena/src/editBot.php

59 lines
2.2 KiB
PHP
Raw Normal View History

2015-12-27 16:50:10 +01:00
<?php
if(isset($_POST['xd_check'])){
2016-06-09 19:13:42 +02:00
//un formulaire a été soumis
2015-12-30 16:13:45 +01:00
$botName=$_POST['botName'];
2015-12-27 16:50:10 +01:00
$botGame=$_POST['botGame'];
$botURL=$_POST['botURL'];
$botDescription=$_POST['botDescription'];
$email=$_POST['email'];
2016-06-09 19:13:42 +02:00
2016-06-09 19:15:17 +02:00
if((isset($err)) && ($err <> "")){
2016-06-09 19:13:42 +02:00
$message="<h3>".$err."</h3>";
$editDone=false;
2016-06-09 19:22:29 +02:00
}else{
2016-06-09 19:13:42 +02:00
$editDone=true;
}
2015-12-27 19:50:21 +01:00
2015-12-27 16:50:10 +01:00
}else{
$botName=$theBot['name'];
$botGame=$theBot['game'];
$botURL=$theBot['url'];
2016-06-09 15:05:13 +02:00
$botDescription=$theBot['unclean_description'];
2015-12-27 16:50:10 +01:00
$email="";
2016-06-09 19:13:42 +02:00
$message="";
$editDone=false;
2015-12-27 16:50:10 +01:00
}
2016-06-09 19:13:42 +02:00
if($editDone){
echo ' <h2>EditBot</h2><p>Un e-mail vient de vous être envoyé.
Il contient un lien qui vous permettra de confirmer les modifications que vous souhaitez apporter.</p>';
}else{
2015-12-27 16:50:10 +01:00
?>
2016-06-09 19:13:42 +02:00
<h2>EditBot</h2>
2016-06-09 19:22:29 +02:00
<?php echo $message; ?>
2016-06-09 19:13:42 +02:00
<form method="POST" action="/p/editBot/<?php echo $theBot['id']; ?>">
<?php echo xd_check_input(0); ?><input type="hidden" name="act" value="editBot"/><input type="hidden" name="botId" value="<?php echo $theBot['id']; ?>"/>
<p><label for="botName"><?php echo $lang['BOT_NAME']; ?></label><input id="botName" type="text" name="botName" value="<?php echo htmlentities($botName); ?>" placeholder="<?php echo $lang['YOUR_ALIAS_FOR_EXEMPLE'];?>"/></p>
<p><label for="botGame"><?php echo $lang['BOT_GAME']; ?></label>
<select id="botGame" name="botGame">
<?php
foreach($arenas as $arena){
if($arena['id'] == $botGame){
$selected='selected="selected"';
}else{
$selected='';
}
echo '<option value="'.$arena['id'].'" '.$selected.'>'.$arena['id'].'</option>';
2015-12-27 16:50:10 +01:00
}
2016-06-09 19:13:42 +02:00
?>
</select></p>
<p><label for="botURL"><?php echo $lang['BOT_URL']; ?></label><input type="text" name="botURL" id="botURL" value="" placeholder="let empty for keeping the same URL"/></p>
<p><label><?php echo $lang['BOT_DESCRIPTION']; ?></label><textarea name="botDescription"><?php echo htmlentities($botDescription);?></textarea></p>
<p><label for="email"><?php echo $lang['YOUR_EMAIL_FOR_BOT_EDIT']; ?></label><input type="text" name="email" value="<?php echo htmlentities($email);?>" id="email"/></p>
<p><label for="sub"></label><input id="sub" type="submit" value="<?php echo $lang['SAVE_BOT']; ?>"/></p>
</form>
<?php
}