diff --git a/Readme.md b/Readme.md index e59ef8a..56b28b8 100644 --- a/Readme.md +++ b/Readme.md @@ -18,6 +18,11 @@ Do whatever you want with this. 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 cards.csv created from [google doc](https://docs.google.com/spreadsheets/d/1IePxyWlr6AEI0uwGhos1a6e6S84W0ssHwt-2e6AZ5Aw/edit#gid=736622417) minus columns "text" and "notes" diff --git a/parse.php b/parse.php index 4eff242..ccdad26 100644 --- a/parse.php +++ b/parse.php @@ -31,7 +31,7 @@ else { $turns = 0 ; $winner = "" ; $first = "" ; - $data = trim( $_POST["log"] ) ; + $data = htmlspecialchars(trim( $_POST["log"] ) ) ; $data_ar = preg_split("/\r\n|\n|\r/", $data); foreach ($data_ar as $line ) { @@ -45,7 +45,7 @@ else { $winner = $line_a[0] ; } - if( preg_match( '/^Played (.*)<\/color>/', $line, $match ) ) { + if( preg_match( '/^Played <color=#[A-Z0-9]+>(.*)<\/color>/', $line, $match ) ) { guessExpansion( $match[1], $cards, $ext ) ; }