hide bot url
This commit is contained in:
parent
55e25b2201
commit
7a4dc1619e
24
src/act.php
24
src/act.php
|
|
@ -27,7 +27,7 @@ switch($_POST['act']){
|
||||||
}
|
}
|
||||||
|
|
||||||
//BotUrl
|
//BotUrl
|
||||||
if(!preg_match("/^(http|https):\/\//", $_POST['botURL'])){
|
if (!preg_match("/^(http|https):\/\//", $_POST['botURL'])){
|
||||||
$alerts.="L'URL n'est pas valide.\n";
|
$alerts.="L'URL n'est pas valide.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,23 +120,37 @@ switch($_POST['act']){
|
||||||
$err.="Un bot du même nom existe déjà";
|
$err.="Un bot du même nom existe déjà";
|
||||||
}
|
}
|
||||||
//BotUrl
|
//BotUrl
|
||||||
if(!preg_match("/^(http|https):\/\//", $_POST['botURL'])){
|
if(($_POST['botURL'] <> "") && (!preg_match("/^(http|https):\/\//", $_POST['botURL']))){
|
||||||
$alerts.="L'URL n'est pas valide.\n";
|
$alerts.="L'URL n'est pas valide.\n";
|
||||||
}
|
}
|
||||||
if($err == ""){
|
if($err == ""){
|
||||||
|
|
||||||
//save bot on temp table
|
//save bot on temp table
|
||||||
$secret=rand_str(8, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890');
|
$secret=rand_str(8, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890');
|
||||||
|
|
||||||
|
if( $_POST['botURL'] == "" ){
|
||||||
|
$rs=mysqli_query($lnMysql,
|
||||||
|
"SELECT url FROM bots
|
||||||
|
WHERE game='".mysqli_real_escape_string($lnMysql,$_POST['botGame'])."'
|
||||||
|
AND id ='".mysqli_real_escape_string($lnMysql,$_POST['botId'])."'"
|
||||||
|
);
|
||||||
|
$r=mysqli_fetch_row($rs);
|
||||||
|
$botUrl = $r[0];
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$botUrl = $_POST['botURL'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
mysqli_query($lnMysql,
|
mysqli_query($lnMysql,
|
||||||
" INSERT INTO bots_modifs( name, game, url, description, date_modification, validate_secret, author_email) VALUES (
|
" INSERT INTO bots_modifs( name, game, url, description, date_modification, validate_secret, author_email) VALUES (
|
||||||
'".mysqli_real_escape_string($lnMysql,htmlentities($_POST['botName']))."',
|
'".mysqli_real_escape_string($lnMysql,htmlentities($_POST['botName']))."',
|
||||||
'".mysqli_real_escape_string($lnMysql,$_POST['botGame'])."',
|
'".mysqli_real_escape_string($lnMysql,$_POST['botGame'])."',
|
||||||
'".mysqli_real_escape_string($lnMysql,$_POST['botURL'])."',
|
'".mysqli_real_escape_string($lnMysql,$botUrl."',
|
||||||
'".mysqli_real_escape_string($lnMysql,
|
'".mysqli_real_escape_string($lnMysql,
|
||||||
preg_replace('#^(http|https|mailto|ftp)://(([a-z0-9\/\.\?-_=\#@:~])*)#i','<a href="$1://$2">$1://$2</a>'
|
preg_replace('#^(http|https|mailto|ftp)://(([a-z0-9\/\.\?-_=\#@:~])*)#i','<a href="$1://$2">$1://$2</a>'
|
||||||
,nl2br(htmlentities($_POST['botDescription'])))
|
,nl2br(htmlentities($_POST['botDescription'])))
|
||||||
)."',
|
)."',
|
||||||
|
|
||||||
NOW(),
|
NOW(),
|
||||||
'".$secret."',
|
'".$secret."',
|
||||||
'".mysqli_real_escape_string($lnMysql,$_POST['email'])."'"
|
'".mysqli_real_escape_string($lnMysql,$_POST['email'])."'"
|
||||||
|
|
@ -178,7 +192,7 @@ switch($_POST['act']){
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
error(500,"erf");
|
error(404,"erf");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user