Monday, 9 December 2013

Check curl is install or on at your server with php

<?php





///  check curl is install or on at your server with php
function iscurlinstalled()
{
    if  (in_array  ('curl', get_loaded_extensions())) {
        return true;
    }
    else{
        return false;
    }
}









?>

Thursday, 5 December 2013

Downalod any file with php

<?php
///Downalod any file with php


function downloadFile($filename)
    {
        header("Content-disposition: filename=".$filename."");

        header("Content-type: application/octetstream");
       
        header("Pragma: no-cache");
       
        header("Expires: 0");
       
    }
   
    $filename='test.doc';
    downloadFile($filename);
   
    ?>

filter_var function in php

<?php

      // The filter_var() function Returns the filtered data TRUE on success or FALSE on failure.
     $emailid='test@test.com';
        if(!filter_var($emailid, FILTER_VALIDATE_EMAIL))
        {
           echo("E-mail ID is Invalid");
        }
       else
        {
             echo("E-mail ID is valid ");
       }
?>

Check e-mail address is valid with php

<?php

  // Check e-mail address is valid with php
         $email=$_POST['email'];
          if (!preg_match("/^([a-zA-Z0-9])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-] +)+/",$email))
            {
                  echo "Email Address Is Invalid !";
            }
          else
           {
                 echo "Email Address Is Valid !";
           }
          

?>

Check IP address by Host Name or Site url

<?php


/// get IP address by Host Name or   site url

 $ip_address = gethostbyname("www.google.com");

 echo "Your  Site IP address :". $ip_address;
?>

Check Password is Strong or weak with php

<?php


$password = "Fyfjk34sdfjfsjq7";

if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
    echo "Your passwords is strong.";
} else {
    echo "Your password is weak.";
}

?>

Redirect to page with php & javascript

/////// Redirect to  any page

function redirectToPage($page)
{

 if($page!="")
 {
    echo "<script>window.location='".$page."';</script>";
 }

}


//////////////////////// example//////////////////


redirectToPage('home.php');
Freelance Jobs