diff --git a/stream/index.php b/stream/index.php index cbcc214..0e4b9bd 100644 --- a/stream/index.php +++ b/stream/index.php @@ -21,31 +21,7 @@ - 25) - { - throw new Exception('Variable res not set'); - } - } - else - { - throw new Exception('Variable res not set'); - } - } - catch (Exception $e) - { - $res = $default; - } - echo "\n"; - ?> + diff --git a/stream/js/Params.js.php b/stream/js/Params.js.php new file mode 100644 index 0000000..10153b6 --- /dev/null +++ b/stream/js/Params.js.php @@ -0,0 +1,39 @@ + 25) + { + throw new Exception('Variable res not set'); + } + } + catch (Exception $e) + { + // If an exception occur, let's just set the default value + $res = $default; + } + + // And finally, generate a correct js code with no possible injection + echo "params.get.res = " . $res . ";\n"; diff --git a/stream/js/main.js b/stream/js/main.js index 2b3872a..1ce57b3 100644 --- a/stream/js/main.js +++ b/stream/js/main.js @@ -46,7 +46,7 @@ function init() { // Load the scene loader = new THREE.OBJLoader(); - sphere = new ProgessiveSphere(loader, global_array.res); + sphere = new ProgessiveSphere(loader, params.get.res); plane = new Plane(1000,1000); plane.translate(0,0,-100);