How to Block or Redirect Websites in windows ?

                       The Windows Hosts file is a file that Windows uses to control and map IP addresses. By editing the Hosts file, Windows can be customized to block or redirect specific websites and even protocols that are used by programs and applications.

To get started editing the Windows Hosts file, you first need to locate it.
  1. Open Windows Explorer and click on This PC or My Computer
  2. Double-click on C:\
  3. then the Windows folder and scroll down the page until you reach the System32 folder.
  4. Inside of that folder, open drivers 
  5. and then open etc folder
  6. You’ll now see several files, one of which is hosts.

 

Now, notice that the file type for the hosts file is listed as File. Because there is no default program set to open a file type like this, double clicking the hosts file will simply give you a Windows prompt, asking you which program you would like to use to open the file.

From this prompt, you can choose to edit the hosts file with Notepad. So, simply click to select Notepad and click the OK button. From there, Notepad will launch with the hosts file information.

This way of opening the hosts file was demonstrated to show where the hosts file is actually located within Windows, but you won’t be able to edit it because it’s a system file. In order to edit the file, you have to open Notepad first, running as an Administrator.
Click on Start and type in Notepad, but don’t click on Notepad to open it. Rather, right-click the Notepad listing to bring up the context menu. Select the option Run as Administrator.


With Notepad open, select File > Open. Navigate to C:\Windows\System32\drivers\etc. You will get a blank screen that displays the prompt No items match your search. Change Text Documents (*.txt) to All Files using the drop down menu. Now, you can select the hosts file and click Open.

open_hosts_file

Adding files to the hosts file is very simple. The hosts file uses the format:
IP Address   exampledomain.com
Blocking a website in Windows is as simple as typing the following into the bottom of the hosts file:
127.0.0.1    www.exampledomain.com
So, if I wanted to block a website like www.youtube.com, I could just add the following line:
127.0.0.1    www.youtube.com
 
 
 

What we are actually telling Windows is that the website www.youtube.com should redirect to the IP address 127.0.0.1, which is just the loopback address on our local system. If you don’t have a local website setup on your computer, you’ll just get an error page in your web browser.


For more details you can ask in the comments for more queries ...

Search value exist in array or not using php

Search value exist in array or not using php

                In php there is a inbuild function called in_array() which is used to search data is existing or not in array. It returns boolean value i.e "TRUE" if the search value is found in the array, and "FALSE" if the search value is not found.

Syntax :
 bool in_array ( $value, $array_name ,$mode )  

Parameters: The in_array() function accepts three parameters, out of which two are compulsory and other one is optional. All three parameters are described following:
  1. $value: This is the compulsory parameter for in_array () function which contains the searching value. This can be of mixed type i.e, it can be of string type or integer type or any other type. it depends on user that which type of search value wants to find in array.
  2. $array_name: This is a compulsory parameter and it specifies the array in which we want to search.
  3. $mode: This is third one which is an optional parameter and is of boolean type. This parameter specifies the mode in which we want to perform the search. If it is set to TRUE, then the in_array() function searches for the value with the same type of value as specified by $val parameter. The default value of this parameter is FALSE.
Return Value: The in_array() function returns a boolean value i.e, TRUE if the value $val is found in the array otherwise it returns FALSE.

Below programs to illustrate The in_array() function in PHP:

<?php
$marks = array(100, 65, 70, 87);
 
if (in_array("100", $marks))
  {
  echo "found";
  }
else
  {
  echo "not found";
  }
?>

in the program we are searching 100 in array marks weather it exist in array or not. after successfull running when its found the 100 in array then function returns "TRUE" as a "found" string message.

Output:
found




How to import and export mysql database using Command Prompt?

                                  If you have a large database and you want to export which is not exported by phpmyadmin default export option. because it shows some maximum limit or time expired. For that you can try importing and exporting any size database of phpmyadmin using Command prompt.

So command for importing and exporting is below : 

       1. open cmd
       2. set mysql path in cmd

            set path=c:\wamp\bin\mysql\mysql5.6.17\bin

       3. For database export (Backup)
           
           mysqldump -u YourUser -p YourDatabaseName > filename.sql

       4. For database import (Restore): 

            mysql -u YourUser -p YourDatabaseName < filename.sql



you can change your set path command as per your xampp,wampp etc.