add a bit of input sanitization

add install instructions
This commit is contained in:
2023-08-06 23:57:16 +02:00
parent 462ab68070
commit 932a46d096
2 changed files with 7 additions and 2 deletions

View File

@@ -18,6 +18,11 @@ Do whatever you want with this.
Parse a Star Realms log and gather some stats about your game Parse a Star Realms log and gather some stats about your game
## Installation
Just drop cards.csv and parse.php in any directory served by any decent webserver with php support
## Notes ## Notes
cards.csv created from [google doc](https://docs.google.com/spreadsheets/d/1IePxyWlr6AEI0uwGhos1a6e6S84W0ssHwt-2e6AZ5Aw/edit#gid=736622417) minus columns "text" and "notes" cards.csv created from [google doc](https://docs.google.com/spreadsheets/d/1IePxyWlr6AEI0uwGhos1a6e6S84W0ssHwt-2e6AZ5Aw/edit#gid=736622417) minus columns "text" and "notes"

View File

@@ -31,7 +31,7 @@ else {
$turns = 0 ; $turns = 0 ;
$winner = "" ; $winner = "" ;
$first = "" ; $first = "" ;
$data = trim( $_POST["log"] ) ; $data = htmlspecialchars(trim( $_POST["log"] ) ) ;
$data_ar = preg_split("/\r\n|\n|\r/", $data); $data_ar = preg_split("/\r\n|\n|\r/", $data);
foreach ($data_ar as $line ) { foreach ($data_ar as $line ) {
@@ -45,7 +45,7 @@ else {
$winner = $line_a[0] ; $winner = $line_a[0] ;
} }
if( preg_match( '/^Played <color=#[A-Z0-9]+>(.*)<\/color>/', $line, $match ) ) { if( preg_match( '/^Played &lt;color=#[A-Z0-9]+&gt;(.*)&lt;\/color&gt;/', $line, $match ) ) {
guessExpansion( $match[1], $cards, $ext ) ; guessExpansion( $match[1], $cards, $ext ) ;
} }