Wednesday, May 6, 2015

Encryption in code igniter

Encryption
 </pre>  
 this->load->library('encrypt');  
 $enc_username=$this->encrypt->encode($username);  
 $enc_username=str_replace(array('+', '/', '='), array('-', '_', '~'), $enc_username);  
 <pre>  

Decryption
 </pre>  
 $this->load->library('encrypt');  
 $dec_username=str_replace(array('-', '_', '~'), array('+', '/', '='), $enc_username);  
 $dec_username=$this->encrypt->decode($dec_username);  
 <pre>  

For further info
matin.pariab
roshanbh
smarttutorials
Code Igniter

Sunday, May 3, 2015

Get the id of input on keyup


 <script>   
   function myFunction(val)  
   {  
     var id = val.getAttribute('id');  
     alert("The input value has changed. The id of input is "+ id);  
   }  
 </script>  
 In this line i have dynamically generated the input according to length of the array.  
 <input style="width: 90%;" type="text" required="" name="mac[]" id="mac_<?php echo $i;?>" onkeyup="myFunction(this)" />  
 If you have fixed number of inputs then use this code  
 <input style="width: 90%;" type="text" required="" name="mac[]" id="mac" onkeyup="myFunction(this)" />