register.php 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <?php /** @noinspection PhpVoidFunctionResultUsedInspection */
  2. $newsletter_consent_checked = ($user->newsletter_consent) ? "checked" : "";
  3. $year = $month = $day = null;
  4. if($user->date_of_birth) {
  5. list($year, $month, $day) = explode("-", $user->date_of_birth);
  6. }
  7. ?>
  8. <div class="container mt-3 py-4">
  9. <h2><?=htmlspecialchars(__("Register"))?></h2>
  10. <p><?=htmlspecialchars(__("Become a tester and earn £10 per test which should last no longer than 8 minutes!"))?></p>
  11. <p>
  12. <?=sprintf(htmlspecialchars(__("If you want more information on our security policy, please call us on %s (mobile call rate).")), PHONE)?>
  13. </p>
  14. <hr />
  15. <form method="post">
  16. <div class="row">
  17. <div class="col-lg-8 offset-lg-2">
  18. <div class="row mb-1">
  19. <label class="col-sm-4 col-form-label" for="title"><?=htmlspecialchars(__("Title"))?></label>
  20. <div class="col-sm">
  21. <select class="form-control w-auto" name="title" id="title" required>
  22. <option value=""><?=htmlspecialchars(__("Select title"))?></option>
  23. <?php
  24. foreach(User::titles() as $value => $display) {
  25. $selected = ($user->title == $value) ? "selected" : "";
  26. ?>
  27. <option value="<?=htmlspecialchars($value)?>" <?=$selected?>><?=htmlspecialchars($display)?></option>
  28. <?php
  29. }
  30. ?>
  31. </select>
  32. </div>
  33. </div>
  34. <div class="row mb-1">
  35. <label class="col-sm-4 col-form-label" for="first-name"><?=htmlspecialchars(__("First Name"))?></label>
  36. <div class="col-sm">
  37. <input class="form-control w-auto" type="text" name="first_name" id="first-name" placeholder="<?=htmlspecialchars(__("Enter first name"))?>" value="<?=htmlspecialchars($user->first_name)?>" required />
  38. </div>
  39. </div>
  40. <div class="row mb-1">
  41. <label class="col-sm-4 col-form-label" for="last-name"><?=htmlspecialchars(__("Last Name"))?></label>
  42. <div class="col-sm">
  43. <input class="form-control w-auto" type="text" name="last_name" id="last-name" placeholder="<?=htmlspecialchars(__("Enter last name"))?>" value="<?=htmlspecialchars($user->last_name)?>" required />
  44. </div>
  45. </div>
  46. <div class="row mb-1">
  47. <label class="col-sm-4 col-form-label" for="gender"><?=htmlspecialchars(__("Gender"))?></label>
  48. <div class="col-sm">
  49. <select class="form-control w-auto" name="gender" id="gender" required>
  50. <option value=""><?=htmlspecialchars(__("Select gender"))?></option>
  51. <?php
  52. foreach(User::genders() as $value => $display) {
  53. $selected = ($user->gender == $value) ? "selected" : "";
  54. ?>
  55. <option value="<?=htmlspecialchars($value)?>" <?=$selected?>><?=htmlspecialchars($display)?></option>
  56. <?php
  57. }
  58. ?>
  59. </select>
  60. </div>
  61. </div>
  62. <div class="row mb-1">
  63. <label class="col-sm-4 col-form-label" for="email"><?=htmlspecialchars(__("Email Address"))?></label>
  64. <div class="col-sm">
  65. <input class="form-control" type="email" name="email" id="email" placeholder="<?=htmlspecialchars(__("Enter email address"))?>" value="<?=htmlspecialchars($user->email)?>" required />
  66. </div>
  67. </div>
  68. <div class="row mb-1">
  69. <label class="col-sm-4 col-form-label" for="phone"><?=htmlspecialchars(__("Mobile Number"))?></label>
  70. <div class="col-sm">
  71. <input class="form-control w-auto" type="tel" name="phone" id="phone" placeholder="<?=htmlspecialchars(__("Enter mobile number"))?>" value="<?=htmlspecialchars($user->phone)?>" required />
  72. </div>
  73. </div>
  74. <div class="row mb-1">
  75. <label class="col-sm-4 col-form-label" for="password"><?=htmlspecialchars(__("Password"))?></label>
  76. <div class="col-sm">
  77. <input class="form-control" type="password" name="password" id="password" placeholder="<?=htmlspecialchars(__("Enter password"))?>" autocomplete="new-password" required />
  78. <small class="text-muted form-text"><?=sprintf(htmlspecialchars(__("At least %s6 characters%s. Must contain at least one %slowercase%s, %suppercase%s, %snumber%s and %sspecial%s character.")),
  79. '<span data-length-requirement>', '</span>',
  80. '<span data-lowercase-requirement>', '</span>',
  81. '<span data-uppercase-requirement>', '</span>',
  82. '<span data-number-requirement>', '</span>',
  83. '<span data-special-requirement>', '</span>'
  84. )?></small>
  85. </div>
  86. </div>
  87. <div class="row mb-1">
  88. <label class="col-sm-4 col-form-label" for="password-confirm"><?=htmlspecialchars(__("Confirm Password"))?></label>
  89. <div class="col-sm">
  90. <input class="form-control" type="password" name="password_confirm" id="password-confirm" placeholder="<?=htmlspecialchars(__("Confirm password"))?>" autocomplete="new-password" required />
  91. </div>
  92. </div>
  93. <div class="row mb-1">
  94. <label class="col-sm-4 col-form-label"><?=htmlspecialchars(__("Date of Birth"))?></label>
  95. <div class="col-sm">
  96. <label for="date-of-birth-day" class="sr-only"><?=htmlspecialchars(__("Day"))?></label>
  97. <select class="form-control w-auto d-inline-block" name="date_of_birth_day" id="date-of-birth-day" required>
  98. <option value=""><?=htmlspecialchars(__("Day"))?></option>
  99. <?php
  100. Form::renderDayOptions($day);
  101. ?>
  102. </select>
  103. <label for="date-of-birth-month" class="sr-only"><?=htmlspecialchars(__("Month"))?></label>
  104. <select class="form-control w-auto d-inline-block" name="date_of_birth_month" id="date-of-birth-month" required>
  105. <option value=""><?=htmlspecialchars(__("Month"))?></option>
  106. <?php
  107. Form::renderMonthOptions($month);
  108. ?>
  109. </select>
  110. <label for="date-of-birth-year" class="sr-only"><?=htmlspecialchars(__("Year"))?></label>
  111. <select class="form-control w-auto d-inline-block" name="date_of_birth_year" id="date-of-birth-year" required>
  112. <option value=""><?=htmlspecialchars(__("Year"))?></option>
  113. <?php
  114. Form::renderYearOptionsDescending(null, null, $year);
  115. ?>
  116. </select>
  117. </div>
  118. </div>
  119. <div class="row mb-1">
  120. <label class="col-sm-4 col-form-label" for="postal-code"><?=htmlspecialchars(__("Postal Code"))?></label>
  121. <div class="col-sm">
  122. <input class="form-control w-auto" type="text" name="postal_code" id="postal-code" placeholder="<?=htmlspecialchars(__("Enter postal code"))?>" value="<?=htmlspecialchars($user_address->postal_code)?>" required />
  123. </div>
  124. </div>
  125. <div class="row mb-1">
  126. <label class="col-sm-4 col-form-label" for="secondary-postal-code"><?=htmlspecialchars(__("Secondary Postal Code"))?></label>
  127. <div class="col-sm">
  128. <input class="form-control w-auto" type="text" name="secondary_postal_code" id="secondary-postal-code" placeholder="<?=htmlspecialchars(__("Enter postal code"))?>" value="<?=htmlspecialchars($secondary_user_address->postal_code)?>" />
  129. </div>
  130. </div>
  131. <div class="row mb-3">
  132. <label class="col-sm-4 col-form-label" for="country"><?=htmlspecialchars(__("Country"))?></label>
  133. <div class="col-sm">
  134. <select class="form-control w-auto" name="country" id="country" required>
  135. <?=Form::renderCountryOptions($user_address->country)?>
  136. </select>
  137. </div>
  138. </div>
  139. <div class="row mb-1">
  140. <div class="col-sm offset-sm-4">
  141. <label>
  142. <input type="checkbox" value="1" name="terms_accepted" /> <?=sprintf(htmlspecialchars(__("I agree to and have read the %sTerms and Conditions%s and %sPrivacy Policy%s")),
  143. '<a href="/terms-and-conditions" target="_blank">', '</a>',
  144. '<a href="/privacy-policy" target="_blank">', '</a>'
  145. )?>
  146. </label>
  147. </div>
  148. </div>
  149. <div class="row mb-1">
  150. <div class="col-sm offset-sm-4 align-self-center">
  151. <label><input type="checkbox" name="newsletter_content" id="newsletter-consent" value="1" <?=$newsletter_consent_checked?> /> <?=sprintf(htmlspecialchars(__("Opt-in to newsletters about %s")), APP_NAME)?></label>
  152. </div>
  153. </div>
  154. <div class="row">
  155. <div class="col-sm offset-sm-4">
  156. <?php
  157. if(GOOGLE_RECAPTCHA_SITE_KEY) {
  158. ?>
  159. <div class="g-recaptcha mb-1" data-sitekey="<?=GOOGLE_RECAPTCHA_SITE_KEY?>"></div>
  160. <?php
  161. }
  162. ?>
  163. <button class="btn btn-primary" type="submit" name="submit" value="<?=htmlspecialchars($_SESSION["csrf_token"])?>"><?=htmlspecialchars(__("Register"))?></button>
  164. </div>
  165. </div>
  166. </div>
  167. </div>
  168. </form>
  169. </div>