Update confirm.php

This commit is contained in:
Jesse James Isler 2022-04-05 10:19:17 +02:00
parent 5b272d2761
commit b0d00d2b38

View File

@ -1,6 +1,13 @@
<body> <body>
<html> <html>
<?php <?php
public function removeBrackets($input)
{
$output = str_replace('"', "'", $input)
return $output
}
if (preg_match('/^[\/\w\-. ]+$/', $_POST['rolename'].'.php')){ if (preg_match('/^[\/\w\-. ]+$/', $_POST['rolename'].'.php')){
echo 'VALID FILENAME'; echo 'VALID FILENAME';
@ -15,11 +22,11 @@ if (preg_match('/^[\/\w\-. ]+$/', $_POST['rolename'].'.php')){
# #
# This is the color defined by https://materializecss.com/color.html # This is the color defined by https://materializecss.com/color.html
$f_color = $_POST['rolecolor']." ".$_POST['rolestrength']."-".$_POST['rolemod']; $f_color = removeBrackets($_POST['rolecolor']." ".$_POST['rolestrength']."-".$_POST['rolemod']);
fwrite($rolefile, '$color = "'.$f_color.'"'.PHP_EOL); fwrite($rolefile, '$color = "'.$f_color.'"'.PHP_EOL);
# Text Color # Text Color
$f_tcolor = $_POST['tcolor']; $f_tcolor = removeBrackets($_POST['tcolor']);
fwrite($rolefile, '$tcolor = '.$f_tcolor.PHP_EOL); fwrite($rolefile, '$tcolor = '.$f_tcolor.PHP_EOL);
@ -28,12 +35,12 @@ if (preg_match('/^[\/\w\-. ]+$/', $_POST['rolename'].'.php')){
# #
#The Name of the Role #The Name of the Role
$f_name = $_POST['rolename']; $f_name = removeBrackets($_POST['rolename']);
fwrite($rolefile, '$name = '.$f_name.PHP_EOL); fwrite($rolefile, '$name = "'.$f_name.PHP_EOL);
#The Description of the Role, HTML conform :) #The Description of the Role, HTML conform :)
$f_description = $_POST['roledesc']; $f_description = removeBrackets($_POST['roledesc']);
fwrite($rolefile,'$description = '. $f_description.PHP_EOL); fwrite($rolefile,'$description = "'. $f_description.PHP_EOL);
@ -43,13 +50,13 @@ if (preg_match('/^[\/\w\-. ]+$/', $_POST['rolename'].'.php')){
# #
#How To play #How To play
$f_howtoplay = $_POST['howtoplay']; $f_howtoplay = removeBrackets($_POST['howtoplay']);
fwrite($rolefile, '$howtoplay = '.$f_howtoplay.PHP_EOL); fwrite($rolefile, '$howtoplay = "'.$f_howtoplay.PHP_EOL);
#With what roles does this role play best? #With what roles does this role play best?
fwrite($rolefile, '$playsbestwith = "<ul>'.PHP_EOL); fwrite($rolefile, '$playsbestwith = "<ul>'.PHP_EOL);
foreach($_POST['goodRoles'] as $selectedOption) { foreach($_POST['goodRoles'] as removeBrackets($selectedOption)) {
fwrite($rolefile, '<li>'.$selectedOption.'</li>'.PHP_EOL); fwrite($rolefile, '<li>'.$selectedOption.'</li>'.PHP_EOL);
}; };
fwrite($rolefile, '</ul>;"'.PHP_EOL); fwrite($rolefile, '</ul>;"'.PHP_EOL);
@ -57,10 +64,10 @@ if (preg_match('/^[\/\w\-. ]+$/', $_POST['rolename'].'.php')){
#Convars #Convars
$f_convars = '$convars = "Normal Role Convars (also found in ULX): $f_convars = '$convars = "Normal Role Convars (also found in ULX):
<code>'.$_POST['gconvars'].'</code> <code>'.removeBrackets($_POST['gconvars'].'</code>
Rolespecific Convars: Rolespecific Convars:
<code>'.$_POST['cconvars'].'</code>"'; <code>'.removeBrackets($_POST['cconvars']).'</code>"';
fwrite($rolefile, $f_convars.PHP_EOL); fwrite($rolefile, $f_convars.PHP_EOL);
@ -70,23 +77,23 @@ if (preg_match('/^[\/\w\-. ]+$/', $_POST['rolename'].'.php')){
# #
#The Steam URL to your addon #The Steam URL to your addon
$f_steam = $_POST['steam']; $f_steam = removeBrackets($_POST['steam']);
fwrite($rolefile, '$steam = '.$f_steam.PHP_EOL); fwrite($rolefile, '$steam = "'.$f_steam.'"'.PHP_EOL);
#The Source URL to your addon #The Source URL to your addon
$f_source = $_POST['source']; $f_source = removeBrackets($_POST['source']);
fwrite($rolefile, '$source = '.$f_source.PHP_EOL); fwrite($rolefile, '$source = "'.$f_source.'"'.PHP_EOL);
#Creator of the Addon #Creator of the Addon
$f_author = $_POST['creator']; $f_author = removeBrackets($_POST['creator']);
fwrite($rolefile, '$author = '.$f_author.PHP_EOL); fwrite($rolefile, '$author = "'.$f_author.'"'.PHP_EOL);
#Creatorlink #Creatorlink
$f_authorurl = $_POST['creatorurl']; $f_authorurl = removeBrackets($_POST['creatorurl']);
fwrite($rolefile, '$authorurl = '.$f_authorurl.PHP_EOL); fwrite($rolefile, '$authorurl = "'.$f_authorurl.'"'.PHP_EOL);
# Credittext (can use the above variables) # Credittext (can use the above variables)
$f_ctext = $_POST['credits']; $f_ctext = removeBrackets($_POST['credits']);
fwrite($rolefile, '$ctext = '.$f_ctext); fwrite($rolefile, '$ctext = "'.$f_ctext.'"'.PHP_EOL);
fwrite($rolefile, PHP_EOL.'?>'); fwrite($rolefile, '?>');
fclose($rolefile); fclose($rolefile);
} else { } else {
echo 'INVALID ROLENAME'; echo 'INVALID ROLENAME';