×

php up to date

11 SIMPLE STEPS TO INCREASE WEBSITE SPEED?

Implement these 10 steps your website speed will increase.

  1. Use external stylesheet only. Remove all inline and internal css.
  2. User external scripts remove internal scripts
  3. Minify css and js.
  4. use gzip and cache technique to increase load speed.
  5. Use image file expire tag using htaccess.
  6. Use css sprites for common and small images .
  7. Remove all Unnecessary and unused codes from html,css and js files.
  8. Try to compress all of your images will reduce loading time of the website.
  9. Use better color combination of your website.
  10. Use labels in forms, rel=”noopener” in external links.
  11. compress all images using gtmatrix tool 
These 10 simple steps definitely increase website speed.

How to integrate Google Captcha in the contact form using PHP using Version 2.0

How to integrate Google Captcha in the contact form using PHP


  Here I can show you how to include google captcha version 2.0 integration in the contact form. 
Step 1:
                Create captcha Account using https://www.google.com/recaptcha this link
Step 2 :
               Register your Website address that mean website url.
Step 3:
                Once you entered your website URL you will get secret key

URL: https://www.google.com/recaptcha/api/siteverify
secret (required)6LdHGIYUAAAAADA67iyHZfcXvIvIBpWMZx0MBRfE
response (required)The value of 'g-recaptcha-response'.
remoteipThe end user's ip address.
This is the overall concept to integrate code in your website, Here i can give you full code to send mail.email,
<?php
header('Content-type: application/json'); $status = array( 'type'=>'success', 'message'=>'Thank you for contact us. We will get touch with you within 2 days ' );
// More headers$headers .= 'From: <info@sssss.com>' . "\r\n";$headers .= 'Cc: sssss@gmail.com' . "\r\n";
    $name = @trim(stripslashes($_POST['name']));     $email = @trim(stripslashes($_POST['email']));     $subject = @trim(stripslashes($_POST['subject']));     $message = @trim(stripslashes($_POST['message']));     $phone = @trim(stripslashes($_POST['phone']));     $company = @trim(stripslashes($_POST['company']));     $service = @trim(stripslashes($_POST['service'])); ;    $email_from = 'info@eightlegbuilders.com';    $email_to = 'ssss@gmail.com';//replace with your email    $email_to = ''; if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response']))             {                         if (strstr($_POST['email'], $hn))        {                              $secret = 'secretkey';                  $verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$_POST['g-recaptcha-response']);        $responseData = json_decode($verifyResponse); if(responseData==='success') { $allowed_hostnames = array("gmail.com", "yahoo.com");    $good_hostname = false;    foreach ($allowed_hostnames as $hn)    {        if (strstr($_POST['email'], $hn))        {            $body = 'Name: ' . $name . "\n\n" . 'Email: ' . $email . "\n\n" . 'Subject: ' . $subject . "\n\n" . 'Contact Number:' . $phone ."\n\n" . 'Company Name:' . $company ."\n\n". 'Message: ' . $message."\n\n". 'Job Required: ' .$service;
    $success = mail($email_to, $subject, $body, $headers);
    echo json_encode($status);    die;        }else{            if ($good_hostname==false)            {                // Keepin' it false here!                $good_hostname = false; // Set it to false anyway            }        }    } }}}    
?>