<?php
session_start();
require_once("header.php");
?>
<center> <fieldset style=" padding-top:5%; padding-right:20%; border-radius:12px; border:0;">
     <form  method="POST" action="loginPros.php">
        <table><caption>Ingia kwenye akaunti yako:</caption>
        	
          <tr>
        		<td>Barua pepe</td>
        	</tr>
          <tr>
            <td>
               <sup id="em"></sup> 
              <input id="email" type="text"  placeholder="Barua pepe" name="email"/>
            </td>
          </tr>
          <tr>
        		<td>Neno la siri</td>
        	</tr>
          <tr>
            <td>
               <sup id="pw"></sup> 
              <input id="pwd" type="password" placeholder="Neno la siri" name="pwd"/>
            </td>
          </tr>
                  <tr>
            <td>
              <input type="submit"  value="Ingia"  name="post"/>
            </td>
          </tr>
          <tr>
            <td>
              <a href="indexs.php">Jisajili</a>
            </td>
          </tr>
          
        </table>
      </form>
    </fieldset>
	</center>
 <?php
   require_once("footer.php");
  ?>
<script type="text/javascript">
$(document).ready(function(){
  
$("#log").on('submit',function(e){
///////?????????????????///////
//e.preventDefault();
var email =document.getElementById('email').value;
$.trim(email);
var password =document.getElementById('pwd').value;
$.trim(password);


var vN =/[\(A-Za-z)]/g;
var nV =/[a-z\s]/i;
  var j=0,k=0, g=0,i=0;

////////////

  var pd =/[\(A-Za-z)]/;
  var  pw =/[\(0-9)]/;

var j=0,k=0, g=0,i=0; 
//password=document.getElementById('password').value;
if(password==""){
 e.preventDefault();
 document.getElementById('pw').innerHTML="Neno la siri inahitajika !..";
 


      }

 else{ 
       for (var i =0; i < password.length ; i++)
        {

             if(password[i].match(pd) )
             {
             j++;
             }
        }
         
        for (var i =0; i < password.length ; i++)
        {

             if(!password[i].match(pd) && !password[i].match(pw) )
             {
             k++;
             }
        }
         
          for (var i =0; i < password.length ; i++)
        {

             if( password[i].match(pw) )
             {
             g++;
             }
        }
         

        if(j<=0)
        {
        //e.preventDefault();
         document.getElementById('pw').innerHTML=""; 

              
         }
         
         else if(k>0)
         {
        e.preventDefault();
         document.getElementById('pw').innerHTML="Umeweka alama zisizohitajika katika neno la siri"; 

         }
         else if(g<=0)
         {
            //e.preventDefault();
            document.getElementById('pw').innerHTML="";

         }
         
         else
          {




                     if(password.length<8)
                        {
                     e.preventDefault();
                     document.getElementById('pw').innerHTML=""; 
              

                        }

                        else
                        { 
                        document.getElementById('pw').innerHTML="";

                         }
            }
          }
        
         
     
 
    j=0, i=0;k=0;g=0; 


                                                   ///CONFIRM PASSWORD VALIDATION



               


                                                    //EMAIL VALIDATION


 
var mail=/[\(A-Za-z)][\w.]\w+@\w+\.(net|com|edu)/;
if(email==""){
 e.preventDefault();
document.getElementById('em').innerHTML="Barua pape inahitajika!..";
 

             }
 else{
  
         if(!email.match(mail))
          {
          
        e.preventDefault();
        document.getElementById('em').innerHTML="Barua pepe sio sahihi.."; 
              }
         else{ 
        document.getElementById('em').innerHTML="";

              }
   }
 
  

//////////?????//////////////////
}
);
}
);
            
</script> 
   
