Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Password strength meter

Posted by Unknown On Tuesday, 5 February 2013 1 comments

Password strength meter 

 Here we indrodusing a simple password strength meter,it measure of the effectiveness of a password in resisting guessing and brute-force attacks. In its usual form, it estimates how many trials an attacker who does not have direct access to the password would need, on average, to guess it correctly. The strength of a password is a function of length, complexity, and unpredictability


    




  Download Script                  Live Demo

HTML Code



<form name=df style='margin:0px;'>
<p class="border">
Enter Password .
<input type=password length=20 name='pwd' style="text-decoration:none;color: #dddd;"onkeyup='CheckPasswordStrength(this.value);'>
</p><div id='pwd_strength'></div>
</br>
</form>


JavaScript Code



<script type="text/javascript">

var pass_strength;

function IsEnoughLength(str,length)
{
 if ((str == null) || isNaN(length))
  return false;
 else if (str.length < length)
  return false;
 return true;
 
}

function HasMixedCase(passwd)
{
 if(passwd.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/))
  return true;
 else
  return false;
}

function HasNumeral(passwd)
{
 if(passwd.match(/[0-9]/))
  return true;
 else
  return false;
}

function HasSpecialChars(passwd)
{
 if(passwd.match(/.[!,@,#,$,%,^,&,*,?,_,~]/))
  return true;
 else
  return false;
}


function CheckPasswordStrength(pwd)
{
 if (IsEnoughLength(pwd,14) && HasMixedCase(pwd) && HasNumeral(pwd) && HasSpecialChars(pwd))
  pass_strength = "<b><font style='color:olive'>Very strong</font></b>";
 else if (IsEnoughLength(pwd,8) && HasMixedCase(pwd) && (HasNumeral(pwd) || HasSpecialChars(pwd)))
  pass_strength = "<b><font style='color:Blue'>Strong</font></b>";
 else if (IsEnoughLength(pwd,8) && HasNumeral(pwd))
  pass_strength = "<b><font style='color:Green'>Good</font></b>";
 else
  pass_strength = "<b><font style='color:red'>Weak</font></b>";

 document.getElementById('pwd_strength').innerHTML = pass_strength;
}
function ctck()
{
     var sds = document.getElementById("dum");
     if(sds == null){
        alert("You are using a free package.\n You are not allowed to remove the tag.\n");
     }
     var sdss = document.getElementById("dumdiv");
     if(sdss == null){
         alert("You are using a free package.\n You are not allowed to remove the tag.\n");
     }
}
document.onload ="ctck()";
</script>



Don't Forget To Comment ...!
scriptime.blogspot.in
READ MORE

JavaScript Embedding YouTube videos from links

Posted by Unknown On Wednesday, 23 January 2013 1 comments

JavaScript Embedding YouTube videos from links

Embedding video to a webpage make a real change in the early day’s web. It  can make a multimedia interaction with web user and author .so feel of that website become more realistic .most of users have broadband connection so they are flexible with video contents .one of the most  common used method  is  using a flash player and flv videos those hosted in an external server ,like YouTube .
Embedding YouTube

Code

 function linkToYoutube(link, ops) {
         var o = $.extend({
         width: 480,
         height: 320,
         params: ''
         }, ops);
  
          var id = /\?v\=(\w+)/.exec(link)[1];

          return '<iframe style="display: block;"'+
         ' class="youtube-video" type="text/html"'+
         ' width="' + o.width + '" height="' + o.height +
         ' "src="http://www.youtube.com/embed/' + id + '?' + o.params +
          '&amp;wmode=transparent" frameborder="0" />';
         }

      $('a').each(function(){
      var link = $(this).attr('href');
     $(this).html( linkToYoutube(link, { params: 'theme=light' }) );
    })

Download & Live Code Edit

READ MORE

JavaScript love calculator

Posted by Unknown On Friday, 18 January 2013 38 comments

JavaScript love calculator


Hello friends now we presenting a simple java script love calculater .Its the first tutorial that having live demo on our blog . its simple funny and use some mathematics functions ,so it will help to understand how works java script functions and button click listeners..

Live demo                                    

Love Tester

-->
+ =
Scriptime.blogspot.in


Source

function calc() {

first = document.loveform.name1.value.toUpperCase();
firstlength = document.loveform.name1.value.length;
second = document.loveform.name2.value.toUpperCase();
secondlength = document.loveform.name2.value.length;
var LoveCount=0;

for (Count=0; Count < firstlength; Count++) {
letter1=first.substring(Count,Count+1);
if (letter1=='L') LoveCount+=2; 
if (letter1=='O') LoveCount+=2; 
if (letter1=='V') LoveCount+=2; 
if (letter1=='E') LoveCount+=2; 
if (letter1=='Y') LoveCount+=3; 
if (letter1=='O') LoveCount+=1; 
if (letter1=='U') LoveCount+=3;
}

for (Count=0; Count < secondlength; Count++) {
letter2=second.substring(Count,Count+1);
if (letter2=='L') LoveCount+=2;
if (letter2=='O') LoveCount+=2; 
if (letter2=='V') LoveCount+=2; 
if (letter2=='E') LoveCount+=2;
if (letter2=='Y') LoveCount+=3;
if (letter2=='O') LoveCount+=1;
if (letter2=='U') LoveCount+=3; 
}

amount=0;
if (LoveCount> 0) amount=  5-((firstlength+secondlength)/2)
if (LoveCount> 2) amount= 10-((firstlength+secondlength)/2)
if (LoveCount> 4) amount= 20-((firstlength+secondlength)/2)
if (LoveCount> 6) amount= 30-((firstlength+secondlength)/2)
if (LoveCount> 8) amount= 40-((firstlength+secondlength)/2)
if (LoveCount>10) amount= 50-((firstlength+secondlength)/2)
if (LoveCount>12) amount= 60-((firstlength+secondlength)/2)
if (LoveCount>14) amount= 70-((firstlength+secondlength)/2)
if (LoveCount>16) amount= 80-((firstlength+secondlength)/2)
if (LoveCount>18) amount= 90-((firstlength+secondlength)/2)
if (LoveCount>20) amount=100-((firstlength+secondlength)/2)
if (LoveCount>22) amount=110-((firstlength+secondlength)/2)

if (firstlength==0 || secondlength==0) amount= "Err";
if (amount < 0) amount= 0;
if (amount >99) amount=99;

document.loveform.output.value=amount+"%";
}

Download Source

                              
READ MORE

A Simple PHP Image Resize Code

Posted by Unknown On Tuesday, 18 December 2012 1 comments
A PHP image resizing script that will re size JPG and PNG images. Specify a width OR a height OR both. Images are resized proportionally if only a width or a height is specified.


code:

// Get the image info from the photo
$image_info = getimagesize($photo);
$width = $new_width = $image_info[0];
$height = $new_height = $image_info[1];
$type = $image_info[2];

// Load the image
switch ($type)
{
    case IMAGETYPE_JPEG:
        $image = imagecreatefromjpeg($photo);
        break;
    case IMAGETYPE_GIF:
        $image = imagecreatefromgif($photo);
        break;
    case IMAGETYPE_PNG:
        $image = imagecreatefrompng($photo);
        break;
    default:
        die('Error loading '.$photo.' - File type '.$type.' not supported');
}

// Create a new, resized image
$new_width = 180;
$new_height = $height / ($width / $new_width);
$new_image = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);

// Save the new image over the top of the original photo
switch ($type)
{
    case IMAGETYPE_JPEG:
        imagejpeg($image, $photo, 100);
        break;
    case IMAGETYPE_GIF:
        imagegif($image, $photo);         
        break;
    case IMAGETYPE_PNG:
        imagepng($image, $photo);
        break;
    default:
        die('Error saving image: '.$photo);
}
READ MORE

Fashion