Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Tuesday 24 May 2016

How to disable back button in browser using javascript

How to disable back button in browser using javascript


1) If you are using some Form-Submission page and want to don't allow the user to back their previous page, then you must use this script. 


* Browser will set the history each time you visited any page, even if you are using "Private Browsing", but the history is not shown in history bar(Because you can customise the setting for storing history in private browsing).
This script will set the time for storing histrory  is 'ZERO', logically you can't do anything in 'ZERO-TIME'.

 You just copy and paste this code before closing the <head> tag.  


    <script type = "text/javascript" >
   function preventBack(){window.history.forward();}
    setTimeout("preventBack()", 0);
    window.onunload=function(){null};
     </script>

This script will overwrite attempts to navigate back and forth with the state of the current page.

2) If you are not just using  Form-Submission page and want to don't allow the user to back their previous page, then you can use this script. 

Note* This script remove the extension of that particular page (eg. abc.php -> abc).

This script will overwrite attempts to navigate back and forth with the state of the current page.

    <script type = "text/javascript" >
history.pushState(null, null, document.title);
window.addEventListener('popstate', function () {
    history.pushState(null, null, document.title);

});
</script>

Monday 23 May 2016

Email Tips to Avoid Spam Filters

Email Tips to Avoid Spam Filters

One out of every six emails you send to prospects land in spam.  The spam filters on clients’ email addresses are a major issue for businesses today. 
Internet service providers (ISPs) tend to block spam or unsolicited emails with their spam filters based on the content in the sender’s name, subject line of the email and body of the email. Apart from these they also pay attention to the mailing patterns and the volume of mail sent. Spam filters have scores allocated for different mailing patterns and terms used in email. These scores determine when mail is sent to junk folders. The filters calculate the scores and when the number crosses a certain threshold, the server automatically sends the mail to spam.

The following are some common terms associated with email spam:   

Email Blocking: When an email client such as Yahoo, AOL, and Gmail block and bounce back the email at the receiving server, it is known as email blocking.
Spam Filters: Every email server has filtering software that identifies spam in the content or sender’s name or subject line of the email. The spam filter identifies spam trigger words and other indicators to eventually land  emails in a recipients spam folder.
Blacklist: A list of IPs and domain addresses that have been suspected of spamming are featured in blacklist.
Whitelist: A list of IPs, domain addresses and ESPs that have been approved to deliver emails.
False Positive: When a legitimate email is incorrectly filtered and lands in the spam folder.

The following are some important tips to avoid having your emails labeled as spam:  

Do Not:
  • Do not use words that express spam-like content such as Free, Money Back Offer Guaranteed and other similar terms (spam trigger words).
  • Do not use loud colors in the email body text, such as red or green.
  • Do not use all capital letters in the subject line or even within the body of the email.
  • Do not use exclamation signs or other punctuation marks more than once.
  • Do not use excessive symbols, use descriptive words instead. When you use dollar signs, make sure you do not overdo it ($$$).
  • Do not use overly prominent call-to-action buttons, for example, with loud colors or capitalization. Words such as ‘CLICK HERE’ are spam triggers and capitalizing them makes it worse.
  • Do not use bad HTML coding in email. Also, avoid converting Microsoft word files to HTML.
  • Do not use ‘Re’ or ‘Fwd’ in the subject line to trick recipients into thinking that the mail is a continuation of a previous conversation.
  • Do not use a lot of images that include text. If your email is HTML coded, avoid using one big image. Spam filters cannot read images so sometimes emails trick spam filters by embedding text in images. This practice is risky.
  • Do not use purchased lists. Sending emails to those who do not expect your correspondence is risky and can put your company’s reputation at stake.
  • Do not offer misleading claims in the subject line. Always deliver what you have stated in the subject line.
  • Do not use bulky attachments in emails. If you attach files in .jpg, .gif, .png and .pdf make sure the email also contains text content. Do not send emails attached with executable file types, such as .exe, .zip, .swf and so on.
Do:
  • Always include a ‘from’ address. Emails from unknown senders are immediately reported as spam. However, avoid ‘from’ addresses that look like54ds453w@yourdomain.com  or noreply@yourdomain.com.
  • Always include your physical mailing address and a phone number in the emails.
  • Keep your email size under 30kb. Avoid unnecessary text and images.
  • Provide an unsubscribe link within the email such that it is prominently visible to the recipient. This will help you avoid spam labeling. The unsubscribe link must be active within at least 30 days of sending the email.
  • Use permission marketing techniques or the double opt-in method to avoid sending emails to recipients that are likely to report them as spam. Both these methods ask for the user’s permission to receive your email. While permission marketing can be done in various ways, the double opt-in method refers to a customer opting-in to email newsletters on a form on your website and then confirming the opt-in with a confirmation link sent to his/her email.
  • Ensure that the design of your email templates identify clearly with your brand or website. Include your logo on the upper left corner or center of the email template. Avoid using stock template colors. Customize your email templates with your website’s theme.
The following are some methods to check if your email has spam content in it:  
  • SenderScore.org from ReturnPath will help you get to know what ISPs and email clients think about your emails. This lookup will tell you what you need to change to improve your emails. It shows you the overall health of your email programs.
  • Check if your IP is blacklisted using ReturnPath’s Blacklist Lookup or mxtoolbox’s Blacklist Check.
  • MailingCheck is free software that can be used check your email content for spam.
  • IsNotSpam is a free online spam checker that requires you to email your content to them and sends you an alert if the content contains spam triggering factors.
  • ProgrammersHeaven provides yet another spam check tool that requires you to fill in a form with the ‘from’ address, subject and body of the email.

Thursday 12 May 2016

PHP 5 ARRAYS

PHP 5 Arrays

An array is a Variable which can stores multiple values in one single variable:

In PHP, there are three types of Array:-
1) Indexed Array (Array with a numeric index).
2) Associate Array (Array with Named Keys).
3) multidimensional Array (Array containing one or more array).

                                          INDEXED ARRAY


Syntax:-
    Case1:    $Array=array("aaa","bbb");
                            OR
    Case2:    $Array[0] = "aaa";
                  $Array[1] = "bbb";
Example:-

       <?php

        $Fruit=array("Apple", "Banana", "Mango");

        echo "I like ".$Fruit[0].", ".$Fruit[1].", ".$Fruit[2];

        ?>

OTPUT:-

       I like Apple, Banana, Mango

* Where [0],[1] and [2]... is Index of the array. Bydefault Index is start with  0.


                                                    ASSOCIATIVE ARRAY


 In this, two parameter passes i.e. one is "key" and other is "value".


Syntax:- 




Example:-

        <?php
         $Sharma=123;                
       $Array=array("Gopal"=>$Sharma,"Megha"=>'Parkar',  
      "Akshay"=>789);
       print_r($Array);
         ?>
OTPUT:-

      Array ( [Gopal] => 123 [Megha] => Parkar [Akshay] => 789 )          


* Where "Gopal","Megha","Akshay" are KEY and "123","Parkar","789" are VALUE for the particular KEY.



                                    MULTIDIMENSIONAL ARRAY


It is the part of the PHP-Advance, in which Array have more than one Row and Column.


Example:- Suppose you want to store Student Name, Student Age, Student Roll Number.

         <?php
                    $Student = array
          (
               array("Gopal",21,11068),
               array("Shayam",23,11069),
               array("Akshay",22,11071),
               array("Tuneer",25,11123)
           );

/*Now the two-dimensional $Student array contains four arrays, and it has two indices: row and column.
To get access to the elements of the $Student array we must point to the two indices (row and column):  */
          echo $Student[0][0].": Age: ".$Student[0][1].", Roll No: ".$Student[0]             [2].".<br>";
          echo $Student[1][0].": Age: ".$Student[1][1].", Roll No: ".$Student[1]             [2].".<br>";
          echo $Student[2][0].": Age: ".$Student[2][1].", Roll No: ".$Student[2]             [2].".<br>";
          echo $Student[3][0].": Age: ".$Student[3][1].", Roll No: ".$Student[3]             [2].".<br>";
        ?>OTPUT:-
          Gopal: Age: 21, Roll No: 11068.
          Shayam: Age: 23, Roll No: 11069.
          Akshay: Age: 22, Roll No: 11071.
          Tuneer: Age: 25, Roll No: 11123.



* Where First Index is ROW while the Second Index is Column.


                                  

                                     COUNT FUNCTION

THE COUNT FUNCTION IS USED TO COUNT THE LENGTH OF THE ARRAY and give an integer answer.


Example:- 

           <?php 
             $Array=array("RAM","Shyam","Aman","Yaman");
             echo count($Array);
           ?>
OUTPUT:-
           4


Wednesday 20 April 2016

Browser Detection in PHP

Browser Detection in PHP

  1. <?php
  2. $ie = strpos($_SERVER["HTTP_USER_AGENT"], 'IE') ? true : false;
  3. $M_firefox = strpos($_SERVER["HTTP_USER_AGENT"], 'Firefox') ? true : false;
  4. $safari = strpos($_SERVER["HTTP_USER_AGENT"], 'Safari') ? true : false;
  5. $G_chrome = strpos($_SERVER["HTTP_USER_AGENT"], 'Chrome') ? true : false;
  6. ?>
//// Apply condtion for further Uses..../////
  1. <?php
  2. //Firefox
  3. if ($M_firefox) {
  4. echo 'you are using Firefox!';
  5. echo '<br />';
  6. }
  7. // Both(Safari or Chrome) use the same engine - webkit
  8. if ($safari || $G_chrome) {
  9. echo 'your browser is a webkit powered browser(Chrome Or Safari)';
  10. echo '<br />';
  11. }
  12. // IE
  13. if ($ie) {
  14. echo '<br>your browser is Internet Explorer<br>';
  15. echo '<br />';
  16. }
  17. // Not IE and for all other browsers
  18. if (!$ie) {
  19. echo '<br>your browser is not Internet Explorer<br>';
  20. echo '<br />';
  21. }
  22. ?>
If you like it , then don't forgot to share it!

Monday 4 April 2016

Establish connection with MySql Database through PHP.

Establish connection with MySql Database through PHP.

1) Select Database


  MySqli_connect("HostName","Username","Password","DatabaseName") // Recommended to use

                                                                 OR

  MySqli_connect("HostName","Username","Password","DatabaseName","Port","Socket")

2) Store above Connection line OR Object in a PHP Variable.


 $con=  MySqli_connect("HostName","UserName","MySql_Password","DatabaseName");

              // for Localhost:- HostName= Localhost, {also some hosting site like:- Microhost is                              //also use HostName as Localhost.}
              //                          Username= root, 
              //                          Password = Null,
              //                          Port=3306
              //                          Socket=Specifies the socket or named pipe to be used

3) Check whether the connection is established or Not !, For this use 'IF-ELSE' condition.


 if(!$con) // It is same as $con == 0 or $con != 1; or return FASLE. So query will stop here.
{
die("Not Connected");  // die Language Construct( Not a Function ) will  exits the current script.
                               //{ We always recommended that always use either ECHO or PRINTF and                                          // show/Handle an error Like:- Database is not connected at this time ..                                                 //Please try later..... So the whole script will running continue instead of                                                 //Breaks your whole  script. }
}
    echo "Database is connected with your PHP Web-Page"   ;
                           //Now there is not need to define any ELSE condition here because if 'IF'                                              // condition is not executed then content after closing of 'IF'  will be execute.

4) If point 3) is not execute then it mean your connection is established otherwise check your Connection Line or Parameter you write in point 1).

5) Now your connection from MySql Database is established, and in next Tutorial we will discuss about Retrieve information from MySql into the Web-Page.

Saturday 2 April 2016

No Right Click!


Protecting your Images
1. Disable Right Click on Images only
If you really must disable right-click, then limit the aggravation and use a script that disables it on images only (some scripts also prevent the IE6 image toolbar from appearing). Of course there will be times when people want to use right-click and have their mouse over an image, so I’d recommend you change the message slightly to reflect the fact that only images are affected.
But instead you can use :-
1) Normal coding which offer you save the Image:-
 try to right click to save this image
                                                 <img src="puppy.gif" alt="Puppy" />



2) Coding which 'Never' offer you save the Image:-  
try to right click to save this image
                          <img src="puppy.gif" alt="Puppy"  oncontextmenu="return false" />



3) Coding which 'Never' offer you save the Image also show 'Alert Box' :-  try to right click to save this image 
          <img src="puppy.gif" alt="Puppy"  oncontextmenu="alert('Hi Joe'); return false" />


You can also disable all images on the particular page by :- 
 Simply add the following code to the END of your page, right above the tag:
      <script>
document.oncontextmenu = function(e){
var target = (typeof e !="undefined")? e.target: event.srcElement
if (target.tagName == "img" || (target.tagName == 'a' && target.firstChild.tagName == 'img'))
return false
}
</script>

You can also disable all images on the particular page by :- 
Just replace your   <html>  to  <html onContextMenu="return false;">