ChangeSet ID: 23378 CVSROOT: /opt/cvs-commit Module name: lostwages Changes by: jnewman@winehq.org 2006/03/03 10:31:12
Modified files: include/plugins: register.php
Log message: get the field names from the form
Patch: http://cvs.winehq.org/patch.py?id=23378
Old revision New revision Changes Path 1.2 1.3 +8 -5 lostwages/include/plugins/register.php
Index: lostwages/include/plugins/register.php diff -u -p lostwages/include/plugins/register.php:1.2 lostwages/include/plugins/register.php:1.3 --- lostwages/include/plugins/register.php:1.2 3 Mar 2006 16:31:12 -0000 +++ lostwages/include/plugins/register.php 3 Mar 2006 16:31:12 -0000 @@ -21,6 +21,9 @@ if (isset($_GET['done'])) } else if ($_POST['submit']) { + // fields + $fields = preg_split('/|/', $_POST['fields']); + // check vars if (!$_POST['q']['name'] or !$_POST['q']['email'] or !preg_match("/@/", $_POST['q']['email'])) { @@ -38,11 +41,11 @@ else if ($_POST['submit']) if (file_exists($db_file)) { $fh = fopen($db_file, 'a'); - fwrite($fh, preg_replace("/[\t\r\n]+/", " ", stripslashes($_POST['q']['name']))); - fwrite($fh, "\t"); - fwrite($fh, preg_replace("/[\t\r\n]+/", " ", stripslashes($_POST['q']['email']))); - fwrite($fh, "\t"); - fwrite($fh, preg_replace("/[\t\r\n]+/", " ", stripslashes($_POST['q']['comment']))); + foreach ($fields as $field) + { + fwrite($fh, preg_replace("/[\t\r\n]+/", " ", stripslashes($_POST['q'][$field]))); + fwrite($fh, "\t"); + } fwrite($fh, "\n"); fclose($fh);