Thursday, January 12, 2012

How to block users from accessing your site based on their IP address

Web Hosting Articles » A simple guide to .htaccess » How to block users from accessing your site based on their IP address

Blocking users by IP address is pretty simple with .htaccess.
So here it is the example:


Order allow, deny
Deny from 192.168.0.10
Deny from 212.155.
Deny from 1.2.3.4  5.6.7.8 127.0.0.1
Allow from all
 
Let’s take a look at the code line by line:
The first line “Order allow, deny” tells the web server the “Order”  in which the Allow and Deny directive will be evaluated. It simply says: Give access to all hosts that are not present in the Deny from list and are present in the Allow from list.  With allow, deny order Allow list is looked up first and then the web server checks the deny from list. So as we have allow from all – all access is allowed. Then the allowed access is filtered based on the Deny lists. With allow,deny access is disabled by default.
If we change the order to “deny, allow” then all access is enabled by default and only users in the deny lists are blocked. However as the deny is being processed first allow directives will override any maching settings set in deny directives.
The default Apache order is deny,allow. So you can skip the first line in your .htaccess file if you do not need to change the order in which the Deny and Allow rules are being evaluated by the web server.

So to keep the .htaccess simple you can just use:

Deny from 192.168.0.10
Deny from 212.155.
 
Basically you can use such rules in your .htaccess file to block a particular user, or a network from accessing your site.
You can put several IP address in a Deny or Allow rule. For example:
 
Deny from 1.2.3.4   5.6.7.9
 
The IP addresses must be separated by a space or tab.
You can put entire networks as


Deny from 212.155.
 
This will block all users which IP addresses start with 212.155
Or to block all access to your site:


Deny from all
 
And then add another line to enable access only for yourself:

Allow from 1.2.3.4

Where “1.2.3.4” should be replaced with your computer IP address.
 


 




Wednesday, January 4, 2012

Windows Server 2008 Tips








How to install Java ME application in mobile phone

Overview

Installing J2ME applications to the phones can be done in a number of ways:
First you have to transfer the application to your mobile. You can transfer your application to the mobile from PC by making use of data cable, infrared or Bluetooth. You can install the MIDlets either with or without PC Suite or Ovi Suite.
On Series 40 phones the application gets installed automatically. On S60 phones you need to open message (in the inbox) containing the application and install it manually. However if you use PC Suite to install the MIDlet, the installation process is started automatically on the S60 phones, although you need to step through it manually.
Another way to transfer the MIDlet to the phone is store it (JAR and or JAD file) on a Web server and download the files using the browser of the phone (so called OTA download). Note that the server has to have the MIME types correctly defined:

There are four ways to deploy the application into a mobile device

Over-the-Air (OTA)

With OTA deployment, the MIDlet (Java ME application) is installed on a Web server and then downloaded to a device via the device's Internet microbrowser. A JAR file and a JAD file are required for OTA installation. The process begins by browsing to a page that includes a link to a MIDlet suite. The link is then clicked, which causes the Web server to deliver the JAD file for the MIDlet suite to the browser. On receipt of the JAD file, it is opened and its contents are displayed. The JAD file contains a description of the MIDlet suite, including its size, version number, and who provided it. A request is then sent for the JAR file and, finally, the Web server delivers the JAR file. Once the JAR file has been delivered to the device, the suite is installed and individual MIDlets can be selected and run.

Infrared and Bluetooth

IR or Bluetooth technology can be used to send the MIDlet from a PC to another device .And these two technologies can also be used to send JAR files between two devices.Of course,the file must be saved in source device memory by any way before sent.And the destination device must support installing applications via MMS.

Installing over a serial cable

If the device has a serial cable port and connectivity software (either Nokia PC suite or the Ovi Suite) for a PC, the MIDlet can be installed on the device over a serial cable. To install the MIDlet, double-click on either the *.jar or *.jad file and follow on-screen instructions. On a PC, if jar/jad files are not associated with PC suite or Ovi suite by default, you can right click and select "open with" then choose "Ovi suite" or "PC suite" as applicable. Many devices can also be operated by connectivity software via IR or Bluetooth.

WAP Push

We can send as a WAP Push messages, the download link will be send to the targeted mobile number. User can download the application by clicking the link.
WAP Push messages are specially formatted SMS messages that display an alert message to the user, and give the user the option of connecting directly to a particular URL via the mobile phone’s WAP browser

Search