Changeset 880 for trunk/Modules/User/Registration.php
- Timestamp:
- Apr 7, 2020, 10:15:48 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/User/Registration.php
r861 r880 5 5 function ShowForm() 6 6 { 7 if (array_key_exists('sc', $_POST)) $Human = true;7 if (array_key_exists('sc', $_POST)) $Human = true; 8 8 else $Human = false; 9 if (array_key_exists('user', $_POST)) $UserName = $_POST['user'];9 if (array_key_exists('user', $_POST)) $UserName = $_POST['user']; 10 10 else $UserName = ''; 11 if (array_key_exists('Email', $_POST)) $Email = $_POST['Email'];11 if (array_key_exists('Email', $_POST)) $Email = $_POST['Email']; 12 12 else $Email = ''; 13 if (array_key_exists('Team', $_POST)) $Team = $_POST['Team'];13 if (array_key_exists('Team', $_POST)) $Team = $_POST['Team']; 14 14 else $Team = ''; 15 if (array_key_exists('Language', $_POST)) $Language = $_POST['Language'];15 if (array_key_exists('Language', $_POST)) $Language = $_POST['Language']; 16 16 else $Language = 1; 17 17 … … 24 24 <tr> 25 25 <th class="Left">'.T('Are you human?').'</th>'; 26 if ($Human) $Checked = ' checked="checked"';26 if ($Human) $Checked = ' checked="checked"'; 27 27 else $Checked = ''; 28 28 $Output .= '<td><input type="checkbox" name="sc" '.$Checked.'/></td> … … 50 50 <tr> 51 51 <th class="Left">'.T('I belong to team').':</th>'; 52 if ($Team == '') $Selected = ' selected="selected"';52 if ($Team == '') $Selected = ' selected="selected"'; 53 53 else $Selected = ''; 54 54 $Output .= '<td><select name="Team"><option value="0"'.$Selected.'>'.T('none').'</option>'; 55 55 $DbResult = $this->Database->query('SELECT `Name`, `Id` FROM `Team`'); 56 while ($Line = $DbResult->fetch_assoc())56 while ($Line = $DbResult->fetch_assoc()) 57 57 { 58 if ($Team == $Line['Id']) $Selected = ' selected="selected"';58 if ($Team == $Line['Id']) $Selected = ' selected="selected"'; 59 59 else $Selected = ''; 60 60 $Output .= '<option value="0'.$Line['Id'].'"'.$Selected.'>'.htmlspecialchars($Line['Name']).'</option>'; … … 81 81 </tr> 82 82 </table></fieldset></form>'; 83 return ($Output);83 return $Output; 84 84 } 85 85 … … 91 91 $ShowForm = true; 92 92 93 if (array_key_exists('user', $_POST)) $UserName = $_POST['user'];93 if (array_key_exists('user', $_POST)) $UserName = $_POST['user']; 94 94 else $UserName = ''; 95 if (array_key_exists('pass', $_POST)) $Pass = $_POST['pass'];95 if (array_key_exists('pass', $_POST)) $Pass = $_POST['pass']; 96 96 else $Pass = ''; 97 if (array_key_exists('pass2', $_POST)) $Pass2 = $_POST['pass2'];97 if (array_key_exists('pass2', $_POST)) $Pass2 = $_POST['pass2']; 98 98 else $Pass2 = ''; 99 if (array_key_exists('Email', $_POST)) $Email = $_POST['Email'];99 if (array_key_exists('Email', $_POST)) $Email = $_POST['Email']; 100 100 else $Email = ''; 101 if (array_key_exists('Team', $_POST)) $Team = $_POST['Team'] * 1;101 if (array_key_exists('Team', $_POST)) $Team = $_POST['Team'] * 1; 102 102 else $Team = ''; 103 if (array_key_exists('Language', $_POST)) $Language = $_POST['Language'] * 1;103 if (array_key_exists('Language', $_POST)) $Language = $_POST['Language'] * 1; 104 104 else $Language = ''; 105 if (array_key_exists('ClientVersion', $_POST)) $PreferredVersion = $_POST['ClientVersion'] * 1;105 if (array_key_exists('ClientVersion', $_POST)) $PreferredVersion = $_POST['ClientVersion'] * 1; 106 106 else $PreferredVersion = ''; 107 if ($PreferredVersion == '') $PreferredVersion = 'NULL';108 if (array_key_exists('sc', $_POST)) $SpamCheck = $_POST['sc'];107 if ($PreferredVersion == '') $PreferredVersion = 'NULL'; 108 if (array_key_exists('sc', $_POST)) $SpamCheck = $_POST['sc']; 109 109 else $SpamCheck = ''; 110 110 111 if ($SpamCheck != '')111 if ($SpamCheck != '') 112 112 { 113 if (($UserName != '') and ($Pass != '') and ($Pass2 != ''))113 if (($UserName != '') and ($Pass != '') and ($Pass2 != '')) 114 114 { 115 if (!in_array(strtolower($UserName), $Config['ForbiddedUserNames']))115 if (!in_array(strtolower($UserName), $Config['ForbiddedUserNames'])) 116 116 { 117 if ($Pass == $Pass2)117 if ($Pass == $Pass2) 118 118 { 119 119 $DbResult = $this->Database->query('SELECT * FROM `User` WHERE LOWER(`Name`) = LOWER("'.$UserName.'")'); 120 120 $Line = $DbResult->fetch_row(); 121 if (!$Line)121 if (!$Line) 122 122 { 123 if ($Team == 0) $Team = 'NULL';123 if ($Team == 0) $Team = 'NULL'; 124 124 $this->System->User->Register($UserName, $Pass, $Email, $Language, $Team, $PreferredVersion); 125 125 $Output .= ShowMessage(T('Registration was successful')); … … 154 154 } else $Output = ShowMessage('Nejsi člověk. Strojům není dovoleno se registrovat.', MESSAGE_CRITICAL); 155 155 156 if ($ShowForm) $Output .= $this->ShowForm();157 return ($Output);156 if ($ShowForm) $Output .= $this->ShowForm(); 157 return $Output; 158 158 } 159 159 … … 162 162 $this->Title = T('User registration'); 163 163 $Output = ''; 164 if (array_key_exists('user', $_POST))164 if (array_key_exists('user', $_POST)) 165 165 { 166 166 $Output .= $this->CheckRegistration(); 167 167 } else $Output .= $this->ShowForm(); 168 return ($Output);168 return $Output; 169 169 } 170 170 }
Note:
See TracChangeset
for help on using the changeset viewer.