Advertisement
Guest User

Untitled

a guest
Mar 14th, 2017
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.05 KB | None | 0 0
  1. <?php
  2. /*
  3. UserSpice 4
  4. An Open Source PHP User Management System
  5. by the UserSpice Team at http://UserSpice.com
  6.  
  7. This program is free software: you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation, either version 3 of the License, or
  10. (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program.  If not, see <http://www.gnu.org/licenses/>.
  19.  
  20. Special thanks to John Bovey for the password strenth feature.
  21. */
  22. ?>
  23.  
  24. <?php
  25. if (!$form_valid && Input::exists()){
  26.     echo display_errors($validation->errors());
  27. }
  28. ?>
  29.  
  30. <form class="form-signup" action="<?=$form_action;?>" method="<?=$form_method;?>" id="payment-form">
  31.  
  32.     <h3 class="form-signin-heading">REGISTRACIJA</h3>
  33.     <br>
  34.  
  35.     <!--<div class="form-group">-->
  36.     <div class="form-group">
  37.         <input  class="form-control" type="text" name="username" id="username" placeholder="Username (Between <?=$settings->min_un?> and <?=$settings->max_un?> characters)" value="<?php if (!$form_valid && !empty($_POST)){ echo $username;} ?>" required autofocus>
  38.     </div>
  39.    
  40.     <div class="form-group">
  41.         <input type="text" class="form-control" id="fname" name="fname" placeholder="First Name" value="<?php if (!$form_valid && !empty($_POST)){ echo $fname;} ?>" required>
  42.     </div>
  43.    
  44.     <div class="form-group">
  45.         <input type="text" class="form-control" id="lname" name="lname" placeholder="Last Name" value="<?php if (!$form_valid && !empty($_POST)){ echo $lname;} ?>" required>
  46.     </div>
  47.    
  48.     <br>
  49.    
  50.     <div class="form-group">
  51.         <input  class="form-control" type="text" name="email" id="email" placeholder="Email Address" value="<?php if (!$form_valid && !empty($_POST)){ echo $email;} ?>" required >
  52.     </div>
  53.     <?php
  54.  
  55.         $character_range = 'Be between '.$settings->min_pw . ' and ' . $settings->max_pw;
  56.         $character_statement = '<span id="character_range" class="gray_out_text">' . $character_range . ' characters</span>';
  57.  
  58.         if ($settings->req_cap == 1){
  59.             $num_caps = '1'; //Password must have at least 1 capital
  60.            
  61.             if($num_caps != 1){
  62.                 $num_caps_s = 's';
  63.             }
  64.            
  65.             $num_caps_statement = '<span id="caps" class="gray_out_text">Have at least ' . $num_caps . ' capital letter </span>';
  66.         }
  67.  
  68.         if ($settings->req_num == 1){
  69.             $num_numbers = '1'; //Password must have at least 1 number
  70.            
  71.             if($num_numbers != 1){
  72.                 $num_numbers_s = 's';
  73.             }
  74.  
  75.             $num_numbers_statement = '<span id="number" class="gray_out_text">Have at least ' . $num_numbers . ' number</span>';
  76.         }
  77.        
  78.         $password_match_statement = '<span id="password_match" class="gray_out_text">Be typed correctly twice</span>';
  79.  
  80.  
  81.         //2.) Apply default class to gray out green check icon
  82.         echo '
  83.             <style>
  84.                 .gray_out_icon{
  85.                     -webkit-filter: grayscale(100%); /* Safari 6.0 - 9.0 */
  86.                     filter: grayscale(100%);
  87.                 }
  88.                 .gray_out_text{
  89.                     opacity: .5;
  90.                 }
  91.             </style>
  92.         ';
  93.  
  94.         //3.) Javascript to check to see if user has met conditions on keyup (NOTE: It seems like we shouldn't have to include jquery here because it's already included by UserSpice, but the code doesn't work without it.)
  95.         echo '
  96.             <script type="text/javascript">
  97.             $(document).ready(function(){
  98.  
  99.                 $( "#password" ).keyup(function() {
  100.                     var pswd = $("#password").val();
  101.  
  102.                     //validate the length
  103.                     if ( pswd.length >= ' . $settings->min_pw . ' && pswd.length <= ' . $settings->max_pw . ' ) {
  104.                         $("#character_range_icon").removeClass("gray_out_icon");
  105.                         $("#character_range").removeClass("gray_out_text");
  106.                     } else {
  107.                         $("#character_range_icon").addClass("gray_out_icon");
  108.                         $("#character_range").addClass("gray_out_text");
  109.                     }
  110.  
  111.                     //validate capital letter
  112.                     if ( pswd.match(/[A-Z]/) ) {
  113.                         $("#num_caps_icon").removeClass("gray_out_icon");
  114.                         $("#caps").removeClass("gray_out_text");
  115.                     } else {
  116.                         $("#num_caps_icon").addClass("gray_out_icon");
  117.                         $("#caps").addClass("gray_out_text");
  118.                     }
  119.  
  120.                     //validate number
  121.                     if ( pswd.match(/\d/) ) {
  122.                         $("#num_numbers_icon").removeClass("gray_out_icon");
  123.                         $("#number").removeClass("gray_out_text");
  124.                     } else {
  125.                         $("#num_numbers_icon").addClass("gray_out_icon");
  126.                         $("#number").addClass("gray_out_text");
  127.                     }
  128.                 });
  129.  
  130.                 $( "#confirm" ).keyup(function() {
  131.                     var pswd = $("#password").val();
  132.                     var confirm_pswd = $("#confirm").val();
  133.  
  134.                     //validate password_match
  135.                     if (pswd == confirm_pswd) {
  136.                         $("#password_match_icon").removeClass("gray_out_icon");
  137.                         $("#password_match").removeClass("gray_out_text");
  138.                     } else {
  139.                         $("#password_match_icon").addClass("gray_out_icon");
  140.                         $("#password_match").addClass("gray_out_text");
  141.                     }
  142.  
  143.                 });
  144.             });
  145.             </script>
  146.         ';
  147.  
  148.     ?>
  149.  
  150.     <div style="display: inline-block">
  151.         <div class="form-group">
  152.             <input  class="form-control" type="password" name="password" id="password" placeholder="Password (Between <?=$settings->min_pw?> and <?=$settings->max_pw?> characters)" required autocomplete="off" aria-describedby="passwordhelp">
  153.         </div>
  154.        
  155.         <div class="form-group">
  156.             <input  type="password" id="confirm" name="confirm" class="form-control" placeholder="Confirm Password" required autocomplete="off" >
  157.         </div>
  158.     </div>
  159.     <div style="display: inline-block; padding-left: 20px">
  160.         <strong>Passwords Should...</strong><br>
  161.         <span id="character_range_icon" class="glyphicon glyphicon-ok gray_out_icon" style="color: green"></span>&nbsp;&nbsp;<?php echo $character_statement;?>
  162.         <br>
  163.         <?php if ($settings->req_cap == 1){ ?>
  164.             <span id="num_caps_icon" class="glyphicon glyphicon-ok gray_out_icon" style="color: green"></span>&nbsp;&nbsp;<?php echo $num_caps_statement;?>
  165.             <br>
  166.         <?php }
  167.  
  168.         if ($settings->req_num == 1){ ?>
  169.             <span id="num_numbers_icon" class="glyphicon glyphicon-ok gray_out_icon" style="color: green"></span>&nbsp;&nbsp;<?php echo $num_numbers_statement;?>
  170.             <br>
  171.         <?php } ?>
  172.         <span id="password_match_icon" class="glyphicon glyphicon-ok gray_out_icon" style="color: green"></span>&nbsp;&nbsp;<?php echo $password_match_statement;?>
  173.     </div>
  174.     <br><br>
  175.            
  176.     <!--<label for="confirm">Check box to agree to terms</label>
  177.     <input type="checkbox" id="agreement_checkbox" name="agreement_checkbox" class="form-control">-->
  178.    
  179.     <div class="form-group">
  180.         <input type="checkbox" id="agreement_checkbox" name="agreement_checkbox">
  181.         <label for="confirm">Strinjam se s <a href="includes/user_agreement.php">pogoji uporabe</a></label>
  182.     </div>
  183.  
  184.     <?php if($settings->recaptcha == 1|| $settings->recaptcha == 2){ ?>
  185.         <div class="g-recaptcha" data-sitekey="<?=$publickey; ?>"></div>
  186.     <?php } ?>
  187.     <br>
  188.     <!--<input type="hidden" value="<?=Token::generate();?>" name="csrf">-->
  189.     <button class="submit btn btn-success full-width" type="submit" id="next_button">REGISTRIRAJ SE</button>
  190. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement