Advertisement
Dominikus_22

Login

Oct 1st, 2023
1,154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.20 KB | None | 0 0
  1. <?php include_once('head.php'); ?>
  2.  
  3.  
  4. <style>
  5.  
  6. .form-control-feedback {
  7.  
  8.    pointer-events: auto;
  9.  
  10. }
  11.  
  12.  
  13. .msk-set-color-tooltip + .tooltip > .tooltip-inner {
  14.  
  15.      min-width:180px;
  16.      background-color:red;
  17. }
  18.  
  19. .bg{
  20.     width:100%;
  21.     height:100%;
  22. }
  23.  
  24. #loginFrom{
  25.     opacity:0.6;   
  26. }
  27.  
  28. body{
  29.     background-color:#fef492;
  30. }
  31.  
  32. </style>
  33. <body onLoad="login()">
  34.     <img src="../uploads/bg.jpg" class="bg" />
  35.    
  36.     <!--Success! - Insert-->
  37.     <div class="modal fade" id="loginFrom" tabindex="-1" role="dialog" aria-labelledby="loginFrom" aria-hidden="true">
  38.         <div class="modal-dialog">    
  39.             <div class="modal-content ">
  40.                 <div class="modal-header bg-aqua-gradient">
  41.                     <h4>User Login...!</h4>
  42.                 </div>
  43.                 <div class="modal-body bgColorWhite">
  44.                     <form role="form" action="../index.php" method="post">                    
  45.                         <div class="box-body">
  46.                             <div class="form-group" id="divEmail">
  47.                                 <label for="">Email</label>
  48.                                 <input type="text" class="form-control" id="email" placeholder="Enter email address" name="email" autocomplete="off">
  49.                             </div>
  50.                             <div class="form-group" id="divPassword">
  51.                                 <label for="">Password</label>
  52.                                 <input type="password" class="form-control" id="password" placeholder="Enter password" name="password" autocomplete="off">
  53.                             </div>
  54.                         </div><!-- /.box-body -->
  55.                         <div class="box-footer">
  56.                             <input type="hidden" name="do" value="user_login" />
  57.                             <button type="submit" class="btn btn-info" id="btnSubmit">Submit</button>
  58.                         </div>
  59.                     </form>
  60.                 </div>
  61.             </div>      
  62.         </div>
  63.     </div><!--/.Modal-->
  64.  
  65. <script>
  66.  
  67. function login(){
  68. //document.ready(function{ 
  69.    
  70.     $('#loginFrom').modal({
  71.         backdrop: 'static',
  72.         keyboard: false
  73.     });
  74.     $('#loginFrom').modal('show');
  75. };
  76.  
  77. $("form").submit(function (e) {
  78. //MSK-000098-form submit   
  79.  
  80.     var uname = $('#email').val();
  81.     var password = $('#password').val();
  82.    
  83.     if(uname == ''){
  84.         //MSK-00099-name
  85.         $("#btnSubmit").attr("disabled", true);
  86.         $('#divEmail').addClass('has-error has-feedback'); 
  87.         $('#divEmail').append('<span id="spanEmail" class="glyphicon glyphicon-remove form-control-feedback msk-set-color-tooltip" data-toggle="tooltip"    title="The user name is required" ></span>');  
  88.            
  89.         $("#email").keydown(function() {
  90.             //MSK-00100-name
  91.             $("#btnSubmit").attr("disabled", false);   
  92.             $('#divEmail').removeClass('has-error has-feedback');
  93.             $('#spanEmail').remove();
  94.            
  95.         });
  96.        
  97.     }
  98.    
  99.     if(password == ''){
  100.         //MSK-00099-name
  101.         $("#btnSubmit").attr("disabled", true);
  102.         $('#divPassword').addClass('has-error has-feedback');  
  103.         $('#divPassword').append('<span id="spanPassword" class="glyphicon glyphicon-remove form-control-feedback msk-set-color-tooltip" data-toggle="tooltip"    title="The password is required" ></span>'); 
  104.            
  105.         $("#password").keydown(function() {
  106.             //MSK-00100-name
  107.             $("#btnSubmit").attr("disabled", false);   
  108.             $('#divPassword').removeClass('has-error has-feedback');
  109.             $('#spanPassword').remove();
  110.            
  111.         });
  112.        
  113.     }
  114.    
  115.    
  116.     if(uname == '' || password == ''){
  117.         //MSK-000098- form validation failed
  118.         $("#btnSubmit").attr("disabled", true);
  119.         e.preventDefault();
  120.         return false;
  121.            
  122.     }else{
  123.         $("#btnSubmit").attr("disabled", false);
  124.        
  125.     }
  126.  
  127.  
  128. });
  129. </script>
  130.  
  131. <!--Warnning! - Email or Password is Incorrect-->
  132.     <div class="modal fade" id="login_error" tabindex="-1" role="dialog" aria-labelledby="insert_alert1" aria-hidden="true">
  133.         <div class="modal-dialog">    
  134.             <div class="modal-content">
  135.                 <div class="modal-header bg-red-active">
  136.                     <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>
  137.                     <h4>Information...!</h4>
  138.                 </div>
  139.                 <div class="modal-body bgColorWhite">
  140.                     <strong style="color:red; font-size:14px">Warnning!</strong> Email or Password is Incorrect.
  141.                 </div>
  142.             </div>
  143.         </div>
  144.     </div><!--/.Modal-->
  145.  
  146.  
  147. <?php
  148. if(isset($_GET["do"])&&($_GET["do"]=="login_error")){
  149. //MSK-000143-6-PHP-JS-INSERT
  150.  
  151.     $msg=$_GET['msg'];
  152.    
  153.     if($msg==1){
  154.         echo"
  155.             <script>
  156.            
  157.             var myModal = $('#login_error');
  158.             myModal.modal('show');
  159.            
  160.             myModal.data('hideInterval', setTimeout(function(){
  161.                 myModal.modal('hide');
  162.             }, 3000));
  163.                        
  164.             </script>
  165.         ";
  166.    
  167.     }
  168.    
  169. }
  170. ?>
  171.  
  172. <!--redirect your own url when clicking browser back button -->
  173. <script>
  174. (function(window, location) {
  175. history.replaceState(null, document.title, location.pathname+"#!/history");
  176. history.pushState(null, document.title, location.pathname);
  177.  
  178. window.addEventListener("popstate", function() {
  179.   if(location.hash === "#!/history") {
  180.     history.replaceState(null, document.title, location.pathname);
  181.     setTimeout(function(){
  182.       location.replace("../index.php");//path to when click back button
  183.     },0);
  184.   }
  185. }, false);
  186. }(window, location));
  187. </script>
  188. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement