<?php

     if (isset($_GET["q"]) && !empty($_GET["q"]))
{
if (file_exists("embedded/functions/site_functions.php"))
	{
	include_once("embedded/functions/site_functions.php");
	}
else
	{
include_once("../../embedded/functions/site_functions.php");
	}
$language=$_SESSION['language'];
if ($language==1)
	{
	$head1="Κωδικός αδύναμος!";
	$head2="Κωδικός μέτριος!";
	$head3="Κωδικός καλός!";
	$head4="Κωδικός ισχυρός!";
	}
else
	{
	$head1="Too weak password!";
	$head2="Average password!";
	$head3="Good password!";
	$head4="Strong password!";
	}

	$password= $_GET["q"];
    $strength = 0; 
    $patterns = array('#[a-z]#','#[A-Z]#','#[0-9]#','/[¬!"£$%^&*()`{}\[\]:@~;\'#<>?,.\/\\-=_+\|]/'); 
    foreach($patterns as $pattern) 
    { 
        if(preg_match($pattern,$password,$matches)) 
        { 
            $strength++; 
        } 
    } 
    switch ($strength)
		{
		case 1:
		echo '<span class="invalid">'.$head1.'</span>';
		break;
		case 2:
		echo '<span class="invalid">'.$head2.'</span>';
		break;
		case 3:
		echo '<span class="valid">'.$head3.'</span>';
		break;
		case 4:
		echo  '<span class="valid">'.$head4.'</span>';
		break;		
		}
}    
   
?>