edit bots

This commit is contained in:
Gnieark 2015-12-27 16:50:10 +01:00
parent c35b12c375
commit ad33503cc0
2 changed files with 60 additions and 1 deletions

View File

@ -162,6 +162,27 @@ if(isset($_GET['arena'])){
break; break;
case "editBot": case "editBot":
if(!isset($_GET['params'])){
error(404,"Page does not exists");
die;
}
$rs=mysqli_query($lnMysql,
"SELECT id,name,game,url,description,date_inscription
FROM bots
WHERE id='".mysqli_real_escape_string($lnMysql,$_GET['params'])."'
AND active='1'");
if(!$r=mysqli_fetch_row($rs)){
error(404,"Page doesn't exist");
die;
}
$theBot=array(
'id' => $r[0],
'name' => $r[1],
'game' => $r[2],
'url' => $r[3],
'description' => $r[4],
'date_inscription' => $r[5]
);
$siteTitle="Modifier un bot"; $siteTitle="Modifier un bot";
$siteDescription="bots arena "; $siteDescription="bots arena ";
$permitIndex=false; $permitIndex=false;

View File

@ -1 +1,39 @@
<h2>EditBot</h2> <?php
if(isset($_POST['xd_check'])){
$botName=$_POST['botname'];
$botGame=$_POST['botGame'];
$botURL=$_POST['botURL'];
$botDescription=$_POST['botDescription'];
$email=$_POST['email'];
}else{
$botName=$theBot['name'];
$botGame=$theBot['game'];
$botURL=$theBot['url'];
$botDescription=$theBot['description'];
$email="";
}
?>
<h2>EditBot</h2>
<form method="POST" action="/p/editBot">
<?php echo xd_check_input(0); ?><input type="hidden" name="act" value="addBot"/>
<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>';
}
?>
</select></p>
<p><label for="botURL"><?php echo $lang['BOT_URL']; ?></label><input type="text" name="botURL" id="botURL" value="<?php echo htmlentities($botURL);?>" placeholder="http://"/></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_VALIDATION']; ?></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>