This commit has been accessed 612 times via Git panel.
commit 24a306a557ea81478fac89fbc191ae3df25a4817
tree 923f11adedaea2ddb9912d2bb0619fe7c85ab938
parent 4859f82c1cd35f3ffd3de9ef1987c8a1701108c4
author Engels Antonio <engels@majcms.org> 1312395266 +0800
committer Engels Antonio <engels@majcms.org> 1312395266 +0800
Add tel and org toggles for user registration
diff --git a/reg.php b/reg.php
index 0911fed..ac3f3ad 100644
--- a/reg.php
+++ b/reg.php
@@ -247,7 +247,7 @@ if (isset($_REQUEST['username']) and !empty($_REQUEST['username']) and isset($_R
}
- echo "<font style=\"font-size: 12px;\"><b>Thanks!</b></font>You have successfully verified your e-mail address.<br>";
+ echo "<font style=\"font-size: 12px;\"><b>Thanks!</b></font><br>You have successfully verified your e-mail address.<br>";
if (file_exists("$maj_data_directory/xapp.txt")) {
echo "You are now a registered member on this site.";
@@ -256,7 +256,7 @@ if (isset($_REQUEST['username']) and !empty($_REQUEST['username']) and isset($_R
echo "Your membership will be activated as soon as your registration is approved.";
}
- echo "<br>Click <a href=index.php>here</a> to go to the index page.";
+ echo "<br><br>Click <a href=index.php>here</a> to go to the index page.";
}
@@ -393,6 +393,48 @@ if ($_POST['submit'] == "1") {
}
}
}
+
+ if (file_exists("$maj_data_directory/bb-tel.txt") and (!isset($_POST['tel']) or empty($_POST['tel']))) {
+ $err_reg = $err_reg + 1;
+ $err_tel = "This field is required.";
+ $err_tel = "<td><img src=\"images/widget.x.png\" border=\"0\" width=\"14\" height=\"14\"></td><td>$err_tel</td>";
+ }
+ else {
+ $tel = strip_tags($_POST['tel']);
+ $tel = htmlentities($tel, ENT_QUOTES, 'UTF-8');
+ $tel = trim($tel);
+
+ $tel = preg_replace('/[^0-9+]/i','',$tel);
+
+ if (preg_match("/^\+/",$tel)) {
+
+ $tel = preg_replace('/[^0-9]/i','',$tel);
+ $tel = '+' . $tel;
+ }
+ else {
+ $tel = preg_replace('/[^0-9]/i','',$tel);
+ }
+
+ $err_tel = "<td><img src=\"images/widget.ok.png\" border=\"0\" width=\"14\" height=\"14\"></td><td>$tel</td>";
+
+ if (mb_strlen(preg_replace("/[^0-9]/","", $tel)) < 7) {
+ $err_reg = $err_reg + 1;
+ $err_tel = "The mobile number $tel is invalid.";
+ $err_tel = "<td><img src=\"images/widget.x.png\" border=\"0\" width=\"14\" height=\"14\"></td><td>$err_tel</td>";
+ }
+ }
+
+ if (file_exists("$maj_data_directory/bb-org.txt") and (!isset($_POST['org']) or empty($_POST['org']))) {
+ $err_reg = $err_reg + 1;
+ $err_org = "This field is required.";
+ $err_org = "<td><img src=\"images/widget.x.png\" border=\"0\" width=\"14\" height=\"14\"></td><td>$err_org</td>";
+ }
+ else {
+ $org = trim(strip_tags($_POST['org']));
+ $org = htmlentities($org, ENT_QUOTES, 'UTF-8');
+ $org = ucwords($org);
+ $err_org = "<td><img src=\"images/widget.ok.png\" border=\"0\" width=\"14\" height=\"14\"></td><td>$org</td>";
+ }
if (!isset($_POST['bd_year']) or empty($_POST['bd_year']) or !isset($_POST['bd_month']) or empty($_POST['bd_month']) or !isset($_POST['bd_day']) or empty($_POST['bd_day']) or !is_numeric($_POST['bd_year']) or !is_numeric($_POST['bd_month']) or !is_numeric($_POST['bd_day'])or (mb_strlen($_POST['bd_year']) > "4") or (mb_strlen($_POST['bd_month']) > "2") or (mb_strlen($_POST['bd_day']) > "2") or ($_POST['bd_month'] < 1) or ($_POST['bd_month'] > 12) or ($_POST['bd_day'] < 1) or ($_POST['bd_day'] > 31) or (date("Y", time() + $maj_offset) < $_POST['bd_year']) or ((date("Y", time() + $maj_offset) == $_POST['bd_year']) and (date("m", time() + $maj_offset) < $_POST['bd_month'])) or ((date("Y", time() + $maj_offset) == $_POST['bd_year']) and (date("m", time() + $maj_offset) == $_POST['bd_month']) and (date("d", time() + $maj_offset) < $_POST['bd_day']))) {
$err_reg = $err_reg + 1;
@@ -494,7 +536,21 @@ if ($_POST['submit'] == "1") {
$fp_email_txt = fopen("$maj_data_directory/members/pending/$username/email.txt","w");
fwrite($fp_email_txt,$email);
fclose($fp_email_txt);
+
+ if (file_exists("$maj_data_directory/bb-tel.txt") and isset($tel) and !empty($tel)) {
+
+ $fp_mobile_txt = fopen("$maj_data_directory/members/pending/$username/tel.txt","w");
+ fwrite($fp_mobile_txt,$tel);
+ fclose($fp_mobile_txt);
+ }
+
+ if (file_exists("$maj_data_directory/bb-org.txt") and isset($org) and !empty($org)) {
+ $fp_organization_txt = fopen("$maj_data_directory/members/pending/$username/org.txt","w");
+ fwrite($fp_organization_txt,$org);
+ fclose($fp_organization_txt);
+ }
+
$bday = $_POST['bd_year'] . $_POST['bd_month'] . $_POST['bd_day'];
$fp_bday_txt = fopen("$maj_data_directory/members/pending/$username/bday.txt","w");
fwrite($fp_bday_txt,$bday);
@@ -545,11 +601,13 @@ if ($_POST['submit'] == "1") {
"From: $email_from\r\n" .
"Reply-To: $email_from\r\n" .
"X-Mailer: $mailer");
-
+
unset($err_username);
unset($err_firstname);
unset($err_lastname);
unset($err_email);
+ unset($err_tel);
+ unset($err_org);
unset($err_bday);
unset($err_country);
unset($err_city);
@@ -604,6 +662,21 @@ if (file_exists("$maj_data_directory/bb-disclaimer.txt")) {
<tr><td width="100">First Name</td><td width="300" colspan="3"><input required class="input" type="text" autocomplete="off" name="firstname" maxlength="30"></td><?php echo $err_firstname; ?></tr>
<tr><td width="100">Last Name</td><td colspan="3"><input required class="input" type="text" autocomplete="off" name="lastname" maxlength="30"></td><?php echo $err_lastname; ?></tr>
<tr><td width="100">E-mail Address</td><td colspan="3"><input required class="input" type="email" autocomplete="off" name="email" maxlength="60"></td><?php echo $err_email; ?></tr>
+
+<?php
+
+if (file_exists("$maj_data_directory/bb-tel.txt")) {
+
+ echo "<tr><td width=\"100\">Mobile Number</td><td colspan=\"3\"><input required class=\"input\" type=\"tel\" autocomplete=\"off\" name=\"tel\" maxlength=\"30\"></td>$err_tel</tr>";
+}
+
+if (file_exists("$maj_data_directory/bb-org.txt")) {
+
+ echo "<tr><td width=\"100\">Organization</td><td colspan=\"3\"><input required class=\"input\" type=\"text\" autocomplete=\"off\" name=\"org\" maxlength=\"60\"></td>$err_org</tr>";
+}
+
+?>
+
<tr><td width="100">Birthdate</td><td><input required class="bd" type="text" autocomplete="off" name="bd_year" maxlength="4" value="YYYY"></td><td><input required class="bd" type="text" autocomplete="off" name="bd_month" maxlength="2" value="MM"></td><td><input required class="bd" type="text" autocomplete="off" name="bd_day" maxlength="2" value="DD"></td><?php echo $err_bday; ?></tr>
<tr><td width="100">Website (optional)</td><td colspan="3"><input class="input" type="url" autocomplete="off" name="url" maxlength="300"></td></tr>
diff --git a/settings.php b/settings.php
index 79bd518..9ad99bd 100644
--- a/settings.php
+++ b/settings.php
@@ -532,6 +532,30 @@ if (!isset($_POST['ml']) or empty($_POST['ml'])) {
}
}
+if (isset($_POST['tel']) and !empty($_POST['tel']) and ($_POST['tel'] == "on") and !file_exists("data/bb-tel.txt")) {
+ touch("data/bb-tel.txt");
+}
+
+if (!isset($_POST['tel']) or empty($_POST['tel'])) {
+ if (isset($_POST['edit']) and ($_POST['edit'] == "on")) {
+ if (file_exists("data/bb-tel.txt")) {
+ unlink("data/bb-tel.txt");
+ }
+ }
+}
+
+if (isset($_POST['org']) and !empty($_POST['org']) and ($_POST['org'] == "on") and !file_exists("data/bb-org.txt")) {
+ touch("data/bb-org.txt");
+}
+
+if (!isset($_POST['org']) or empty($_POST['org'])) {
+ if (isset($_POST['edit']) and ($_POST['edit'] == "on")) {
+ if (file_exists("data/bb-org.txt")) {
+ unlink("data/bb-org.txt");
+ }
+ }
+}
+
if (isset($_POST['stats']) and !empty($_POST['stats']) and ($_POST['stats'] == "on") and !file_exists("data/bb-stats.txt")) {
touch("data/bb-stats.txt");
}
@@ -1455,7 +1479,7 @@ if (file_exists("data/pf-censor.txt")) {
if (file_exists("data/bb.txt")) {
- $bb_rowspan = "12";
+ $bb_rowspan = "14";
if (file_exists("images/avatar.jpg") or file_exists("images/avatar.gif") or file_exists("images/avatar.png")) {
@@ -1482,6 +1506,8 @@ else {
<tr><td><input type="checkbox" name="noadd" <?php if (file_exists("data/noadd.txt")) { echo checked; } ?>> Edit only. Members cannot add new entries.</td></tr>
<tr><td><input type="checkbox" name="member" <?php if (file_exists("data/member.txt")) { echo checked; } ?>> Only members can view posts of other members.</td></tr>
<tr><td><input type="checkbox" name="nomem" <?php if (file_exists("data/nomem.txt")) { echo checked; } ?>> Only members can view member list and member info.</td></tr>
+<tr><td><input type="checkbox" name="tel" <?php if (file_exists("data/bb-tel.txt")) { echo checked; } ?>> Require mobile number during registration.</td></tr>
+<tr><td><input type="checkbox" name="org" <?php if (file_exists("data/bb-org.txt")) { echo checked; } ?>> Require organization name during registration.</td></tr>
<tr><td><input type="checkbox" name="stats" <?php if (file_exists("data/bb-stats.txt")) { echo checked; } ?>> Enable statistics panel.</td></tr>
<tr><td><input type="checkbox" name="summary" <?php if (file_exists("data/bb-summary.txt")) { echo checked; } ?>> Enable summary panel.</td></tr>
<tr><td><input type="checkbox" name="rank" <?php if (file_exists("data/rank.txt")) { echo checked; } ?>> Enable ranks.</td></tr>
tree 923f11adedaea2ddb9912d2bb0619fe7c85ab938
parent 4859f82c1cd35f3ffd3de9ef1987c8a1701108c4
author Engels Antonio <engels@majcms.org> 1312395266 +0800
committer Engels Antonio <engels@majcms.org> 1312395266 +0800
Add tel and org toggles for user registration
diff --git a/reg.php b/reg.php
index 0911fed..ac3f3ad 100644
--- a/reg.php
+++ b/reg.php
@@ -247,7 +247,7 @@ if (isset($_REQUEST['username']) and !empty($_REQUEST['username']) and isset($_R
}
- echo "<font style=\"font-size: 12px;\"><b>Thanks!</b></font>You have successfully verified your e-mail address.<br>";
+ echo "<font style=\"font-size: 12px;\"><b>Thanks!</b></font><br>You have successfully verified your e-mail address.<br>";
if (file_exists("$maj_data_directory/xapp.txt")) {
echo "You are now a registered member on this site.";
@@ -256,7 +256,7 @@ if (isset($_REQUEST['username']) and !empty($_REQUEST['username']) and isset($_R
echo "Your membership will be activated as soon as your registration is approved.";
}
- echo "<br>Click <a href=index.php>here</a> to go to the index page.";
+ echo "<br><br>Click <a href=index.php>here</a> to go to the index page.";
}
@@ -393,6 +393,48 @@ if ($_POST['submit'] == "1") {
}
}
}
+
+ if (file_exists("$maj_data_directory/bb-tel.txt") and (!isset($_POST['tel']) or empty($_POST['tel']))) {
+ $err_reg = $err_reg + 1;
+ $err_tel = "This field is required.";
+ $err_tel = "<td><img src=\"images/widget.x.png\" border=\"0\" width=\"14\" height=\"14\"></td><td>$err_tel</td>";
+ }
+ else {
+ $tel = strip_tags($_POST['tel']);
+ $tel = htmlentities($tel, ENT_QUOTES, 'UTF-8');
+ $tel = trim($tel);
+
+ $tel = preg_replace('/[^0-9+]/i','',$tel);
+
+ if (preg_match("/^\+/",$tel)) {
+
+ $tel = preg_replace('/[^0-9]/i','',$tel);
+ $tel = '+' . $tel;
+ }
+ else {
+ $tel = preg_replace('/[^0-9]/i','',$tel);
+ }
+
+ $err_tel = "<td><img src=\"images/widget.ok.png\" border=\"0\" width=\"14\" height=\"14\"></td><td>$tel</td>";
+
+ if (mb_strlen(preg_replace("/[^0-9]/","", $tel)) < 7) {
+ $err_reg = $err_reg + 1;
+ $err_tel = "The mobile number $tel is invalid.";
+ $err_tel = "<td><img src=\"images/widget.x.png\" border=\"0\" width=\"14\" height=\"14\"></td><td>$err_tel</td>";
+ }
+ }
+
+ if (file_exists("$maj_data_directory/bb-org.txt") and (!isset($_POST['org']) or empty($_POST['org']))) {
+ $err_reg = $err_reg + 1;
+ $err_org = "This field is required.";
+ $err_org = "<td><img src=\"images/widget.x.png\" border=\"0\" width=\"14\" height=\"14\"></td><td>$err_org</td>";
+ }
+ else {
+ $org = trim(strip_tags($_POST['org']));
+ $org = htmlentities($org, ENT_QUOTES, 'UTF-8');
+ $org = ucwords($org);
+ $err_org = "<td><img src=\"images/widget.ok.png\" border=\"0\" width=\"14\" height=\"14\"></td><td>$org</td>";
+ }
if (!isset($_POST['bd_year']) or empty($_POST['bd_year']) or !isset($_POST['bd_month']) or empty($_POST['bd_month']) or !isset($_POST['bd_day']) or empty($_POST['bd_day']) or !is_numeric($_POST['bd_year']) or !is_numeric($_POST['bd_month']) or !is_numeric($_POST['bd_day'])or (mb_strlen($_POST['bd_year']) > "4") or (mb_strlen($_POST['bd_month']) > "2") or (mb_strlen($_POST['bd_day']) > "2") or ($_POST['bd_month'] < 1) or ($_POST['bd_month'] > 12) or ($_POST['bd_day'] < 1) or ($_POST['bd_day'] > 31) or (date("Y", time() + $maj_offset) < $_POST['bd_year']) or ((date("Y", time() + $maj_offset) == $_POST['bd_year']) and (date("m", time() + $maj_offset) < $_POST['bd_month'])) or ((date("Y", time() + $maj_offset) == $_POST['bd_year']) and (date("m", time() + $maj_offset) == $_POST['bd_month']) and (date("d", time() + $maj_offset) < $_POST['bd_day']))) {
$err_reg = $err_reg + 1;
@@ -494,7 +536,21 @@ if ($_POST['submit'] == "1") {
$fp_email_txt = fopen("$maj_data_directory/members/pending/$username/email.txt","w");
fwrite($fp_email_txt,$email);
fclose($fp_email_txt);
+
+ if (file_exists("$maj_data_directory/bb-tel.txt") and isset($tel) and !empty($tel)) {
+
+ $fp_mobile_txt = fopen("$maj_data_directory/members/pending/$username/tel.txt","w");
+ fwrite($fp_mobile_txt,$tel);
+ fclose($fp_mobile_txt);
+ }
+
+ if (file_exists("$maj_data_directory/bb-org.txt") and isset($org) and !empty($org)) {
+ $fp_organization_txt = fopen("$maj_data_directory/members/pending/$username/org.txt","w");
+ fwrite($fp_organization_txt,$org);
+ fclose($fp_organization_txt);
+ }
+
$bday = $_POST['bd_year'] . $_POST['bd_month'] . $_POST['bd_day'];
$fp_bday_txt = fopen("$maj_data_directory/members/pending/$username/bday.txt","w");
fwrite($fp_bday_txt,$bday);
@@ -545,11 +601,13 @@ if ($_POST['submit'] == "1") {
"From: $email_from\r\n" .
"Reply-To: $email_from\r\n" .
"X-Mailer: $mailer");
-
+
unset($err_username);
unset($err_firstname);
unset($err_lastname);
unset($err_email);
+ unset($err_tel);
+ unset($err_org);
unset($err_bday);
unset($err_country);
unset($err_city);
@@ -604,6 +662,21 @@ if (file_exists("$maj_data_directory/bb-disclaimer.txt")) {
<tr><td width="100">First Name</td><td width="300" colspan="3"><input required class="input" type="text" autocomplete="off" name="firstname" maxlength="30"></td><?php echo $err_firstname; ?></tr>
<tr><td width="100">Last Name</td><td colspan="3"><input required class="input" type="text" autocomplete="off" name="lastname" maxlength="30"></td><?php echo $err_lastname; ?></tr>
<tr><td width="100">E-mail Address</td><td colspan="3"><input required class="input" type="email" autocomplete="off" name="email" maxlength="60"></td><?php echo $err_email; ?></tr>
+
+<?php
+
+if (file_exists("$maj_data_directory/bb-tel.txt")) {
+
+ echo "<tr><td width=\"100\">Mobile Number</td><td colspan=\"3\"><input required class=\"input\" type=\"tel\" autocomplete=\"off\" name=\"tel\" maxlength=\"30\"></td>$err_tel</tr>";
+}
+
+if (file_exists("$maj_data_directory/bb-org.txt")) {
+
+ echo "<tr><td width=\"100\">Organization</td><td colspan=\"3\"><input required class=\"input\" type=\"text\" autocomplete=\"off\" name=\"org\" maxlength=\"60\"></td>$err_org</tr>";
+}
+
+?>
+
<tr><td width="100">Birthdate</td><td><input required class="bd" type="text" autocomplete="off" name="bd_year" maxlength="4" value="YYYY"></td><td><input required class="bd" type="text" autocomplete="off" name="bd_month" maxlength="2" value="MM"></td><td><input required class="bd" type="text" autocomplete="off" name="bd_day" maxlength="2" value="DD"></td><?php echo $err_bday; ?></tr>
<tr><td width="100">Website (optional)</td><td colspan="3"><input class="input" type="url" autocomplete="off" name="url" maxlength="300"></td></tr>
diff --git a/settings.php b/settings.php
index 79bd518..9ad99bd 100644
--- a/settings.php
+++ b/settings.php
@@ -532,6 +532,30 @@ if (!isset($_POST['ml']) or empty($_POST['ml'])) {
}
}
+if (isset($_POST['tel']) and !empty($_POST['tel']) and ($_POST['tel'] == "on") and !file_exists("data/bb-tel.txt")) {
+ touch("data/bb-tel.txt");
+}
+
+if (!isset($_POST['tel']) or empty($_POST['tel'])) {
+ if (isset($_POST['edit']) and ($_POST['edit'] == "on")) {
+ if (file_exists("data/bb-tel.txt")) {
+ unlink("data/bb-tel.txt");
+ }
+ }
+}
+
+if (isset($_POST['org']) and !empty($_POST['org']) and ($_POST['org'] == "on") and !file_exists("data/bb-org.txt")) {
+ touch("data/bb-org.txt");
+}
+
+if (!isset($_POST['org']) or empty($_POST['org'])) {
+ if (isset($_POST['edit']) and ($_POST['edit'] == "on")) {
+ if (file_exists("data/bb-org.txt")) {
+ unlink("data/bb-org.txt");
+ }
+ }
+}
+
if (isset($_POST['stats']) and !empty($_POST['stats']) and ($_POST['stats'] == "on") and !file_exists("data/bb-stats.txt")) {
touch("data/bb-stats.txt");
}
@@ -1455,7 +1479,7 @@ if (file_exists("data/pf-censor.txt")) {
if (file_exists("data/bb.txt")) {
- $bb_rowspan = "12";
+ $bb_rowspan = "14";
if (file_exists("images/avatar.jpg") or file_exists("images/avatar.gif") or file_exists("images/avatar.png")) {
@@ -1482,6 +1506,8 @@ else {
<tr><td><input type="checkbox" name="noadd" <?php if (file_exists("data/noadd.txt")) { echo checked; } ?>> Edit only. Members cannot add new entries.</td></tr>
<tr><td><input type="checkbox" name="member" <?php if (file_exists("data/member.txt")) { echo checked; } ?>> Only members can view posts of other members.</td></tr>
<tr><td><input type="checkbox" name="nomem" <?php if (file_exists("data/nomem.txt")) { echo checked; } ?>> Only members can view member list and member info.</td></tr>
+<tr><td><input type="checkbox" name="tel" <?php if (file_exists("data/bb-tel.txt")) { echo checked; } ?>> Require mobile number during registration.</td></tr>
+<tr><td><input type="checkbox" name="org" <?php if (file_exists("data/bb-org.txt")) { echo checked; } ?>> Require organization name during registration.</td></tr>
<tr><td><input type="checkbox" name="stats" <?php if (file_exists("data/bb-stats.txt")) { echo checked; } ?>> Enable statistics panel.</td></tr>
<tr><td><input type="checkbox" name="summary" <?php if (file_exists("data/bb-summary.txt")) { echo checked; } ?>> Enable summary panel.</td></tr>
<tr><td><input type="checkbox" name="rank" <?php if (file_exists("data/rank.txt")) { echo checked; } ?>> Enable ranks.</td></tr>