From c4981740fa089d8975251734d0d09da8d9b0d3cc Mon Sep 17 00:00:00 2001 From: arman Date: Sun, 2 Feb 2025 05:42:23 +0000 Subject: [PATCH] initial fixes for participant registration --- .devcontainer/science-ation-blank-generic.sql | 4 ++-- admin/schools.php | 6 +++--- common.inc.php | 21 +++++++++++-------- register_participants.php | 3 ++- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/.devcontainer/science-ation-blank-generic.sql b/.devcontainer/science-ation-blank-generic.sql index 9c74ea58..dd1285e2 100644 --- a/.devcontainer/science-ation-blank-generic.sql +++ b/.devcontainer/science-ation-blank-generic.sql @@ -903,7 +903,7 @@ LOCK TABLES `emailqueue_recipients` WRITE; UNLOCK TABLES; -- --- Table structure for table `emails` +-- Table structure for table `git -- DROP TABLE IF EXISTS `emails`; @@ -3223,7 +3223,7 @@ CREATE TABLE `students` ( `lang` char(2) NOT NULL DEFAULT '', `year` int(11) NOT NULL DEFAULT 0, `schools_id` int(10) unsigned NOT NULL DEFAULT 0, - `fairs_id` int(11) NOT NULL, + `fairs_id` int(11) NOT NULL DEFAULT 0, `tshirt` varchar(32) NOT NULL DEFAULT 'medium', `medicalalert` varchar(255) NOT NULL DEFAULT '', `foodreq` varchar(255) NOT NULL DEFAULT '', diff --git a/admin/schools.php b/admin/schools.php index 008984f9..2bf2338f 100644 --- a/admin/schools.php +++ b/admin/schools.php @@ -153,7 +153,7 @@ if (get_value_from_array($_POST, 'save') == 'edit' || get_value_from_array($_POS $sh['username'] = $em; user_save($sh); } - + $exec = 'UPDATE schools SET ' . "school='" . get_value_from_array($_POST, 'school') . "', " . "schoollang='" . get_value_from_array($_POST, 'schoollang') . "', " @@ -170,8 +170,8 @@ if (get_value_from_array($_POST, 'save') == 'edit' || get_value_from_array($_POS . "phone='" . get_value_from_array($_POST, 'phone') . "', " . "fax='" . get_value_from_array($_POST, 'fax') . "', " . "registration_password='" . get_value_from_array($_POST, 'registration_password') . "', " - . "projectlimit='" . get_value_from_array($_POST, 'projectlimit') . "', " - . "projectlimitper='" . get_value_from_array($_POST, 'projectlimitper') . "', " + . "projectlimit='" . get_value_from_array($_POST, 'projectlimit', 0) . "', " + . "projectlimitper='" . get_value_from_array($_POST, 'projectlimitper', 'total') . "', " . "accesscode='" . get_value_from_array($_POST, 'accesscode') . "', " . $sciencehead_update . $principal_update . "atrisk='$atrisk' " diff --git a/common.inc.php b/common.inc.php index 8718c4f4..8d113bde 100644 --- a/common.inc.php +++ b/common.inc.php @@ -712,10 +712,21 @@ function emit_month_selector($name, $selected = '') $s = ''; echo "\n"; } - + // returns true if its a valid email address, false if its not + echo "\n"; } +function isEmailAddress($str) + { + if (preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$/i", $str)) + return true; + else + return false; + + } + + function emit_day_selector($name, $selected = '') { echo "