HTA Script – Parse HTML files as PHP




Tagged Under : , ,

Version: 13.1
Revision: 23 Build 13

Parse HTML files as PHP

pickaweb-server-logoIntroduction:
On the 29th of October, I was trying to get my server to parse php codes from a html / htm file. However, when I tried to define the extension, my server just prompt the user to download a file. But, that is not what I wanted! So, I asked Pickaweb for assistance. Soon enough, my problem was fixed!

Here is my tutorial for Pickaweb users. But, please be aware that this article is only for user who is registered with Pickaweb, as their hosting provider.

Notes: by parsing php codes inside your html file, you can implement image – ads and other sources without touching your main file. This is also useful if you’re adding a big chunk of codes without messing your original html / htm files.

1.] Login to your FTP server and look for your “.htaccess” file.

2.] Rename the file and download it to your hard drive.

3.] Copy one of these codes and paste it to the bottom of your “.htaccess” file.

// For PHP5 Server.
// -----------------------
AddHandler application/x-httpd-php5 .html .htm
AddType x-mapp-php5 .html .htm

// For PHP4 Server.
// ----------------------
AddHandler application/x-httpd-php4 .html .htm
AddType x-mapp-php4 .html .htm

4.] Save your changes and delete your old “.htaccess” file (online server).

5.] Upload your modified file and rename it. After that, you will need to clear your Internet caches and temporary files.

6.] Check your website and have fun!

7.] You are done!

Copyrighted By Lair360




HTA – Redirect everyone for site maintenance




Tagged Under : , , ,

Version: 13.2
Revision: 34 Build 13

HTA – Redirect everyone for site maintenance.

Introduction:
When I was checking my email, I had a request from a university student.
He’s asking me for help about blocking users from an old domain and redirecting them to a new domain. But, he wants to check his old domain, while the other users is redirected to his new domain.

Notes: this is also useful if you want to tell “Google Engine” if you are changing domain names.

Alright, this is kind of dificult for coders. But, it does work if you know how to construct it.
It’s like Chess & Checkers! It means, you have to create codes from trails and errors. Ofcourse, HTA script is not that hard, if you study VBScript and think of these codes as physics equations.

Anyway, if anybody wants to use this script, you must have a “Static IP Address” with HTA engine enabled.
If you haven’t got HTA engine, then you’ll need to consult this problem with your hosting provider.

Warning: if you want to check your old domain, you must input the correct IP address (your IP Address), or else, you be redirected to your new domain.
But, if you want to keep this script, forever. You’ll need to comment out the “Remote Address”. Just add ‘#’ before the codes. But, this is only acceptable if you still own the previous domain name. Nevertheless, if you have SSL encryption, please use the ones that has: “https” – labeled.

Caution *1: if there is a problem with the script, please remove “R=301″ and replace it with “R”.
Caution *2: if your website has SSL, please comment “HTTP_HOST” and remove the comments for “SERVER_PORT”.

Notes: to use everything as default, just use the ones below and replace your domain names with yours.

HTA – Redirect everyone to a new domain (accept you).
———— Copy Text —————

RewriteEngine On
Options +FollowSymLinks
# This is where you add your IP address.
RewriteCond %{REMOTE_ADDR} !^1\.2\.3\.4$
#---------------------
# This is use if your hosting provider requires ports.
# RewriteCond %{SERVER_PORT} 80 [NC,OR]
# RewriteCond %{SERVER_PORT} 443 [NC]
# RewriteCond %{REQUEST_URI} example
#---------------------
# Match a specific domain OR sub domain (if it exist).
RewriteCond %{HTTP_HOST} ^(.+\.)?example\.co\.uk$ [NC,OR]
RewriteCond %{HTTP_HOST} ^(.+\.)?example\.co\.cc$ [NC]
# %1 is the sub domain (or empty).
RewriteRule ^(.*)$ http://%1example.net/$1 [R=301,L]
# RewriteRule ^(.*)$ https://%1example.net/$1 [R=301,L]

———— End —————

Notes: if you don’t have SSL and the above looks complicated, please use this instead of the above.
———— Copy Text —————

RewriteEngine On
Options +FollowSymLinks
# This is where you add your IP address.
RewriteCond %{REMOTE_ADDR} !^1\.2\.3\.4$
# Match a specific domain OR sub domain (if it exist).
RewriteCond %{HTTP_HOST} ^(.+\.)?example\.co\.uk$ [NC,OR]
RewriteCond %{HTTP_HOST} ^(.+\.)?example\.co\.cc$ [NC]
# %1 is the sub domain (or empty).
# %2 is SSL encryption (or disabled)
RewriteRule ^(.*)$ http://%1example.net/$1 [R=301,L]

———— End —————

Copyrighted By Lair360




Block Webpages Access – Proxies




Tagged Under : , ,

Version 2.2d
Revision: 23 Build 31

Block Webpages Access – Proxies

Introduction:
alright everyone! This is going to be very harsh. But, It’s only a warning, for the bad users, who is / are attacking my website.

This articles is only shown for interest, if they want to exclude users, individuals and bad surfers from accessing the author’s website, by using “Proxies” to bypass webpages – security holes; attacking our website and servers; giving us the DDoS attacks and abusing our bandwidth without my consent!

You all know the rules…

- No sneaking (behind the wall) and looking at the author’s website.
- Stealing website’s information and attacking the servers, by using “Proxies”, is against the laws.
- Using proxies to hide yourself and abuse the author’s website and servers is a criminal offence.

———————-

Part A: block Proxies (99.5%) with htaccess scripts.

—Copy Source Code—

RewriteEngine On
RewriteCond %{HTTP:VIA} !^$ [OR]
RewriteCond %{HTTP:FORWARDED} !^$ [OR]
RewriteCond %{HTTP:USERAGENT_VIA} !^$ [OR]
RewriteCond %{HTTP:X_FORWARDED_FOR} !^$ [OR]
RewriteCond %{HTTP:PROXY_CONNECTION} !^$ [OR]
RewriteCond %{HTTP:XPROXY_CONNECTION} !^$ [OR]
RewriteCond %{HTTP:HTTP_PC_REMOTE_ADDR} !^$ [OR]
RewriteCond %{HTTP:X-FORWARDED} !^$ [OR]
RewriteCond %{HTTP:FORWARDED-FOR} !^$ [OR]
RewriteCond %{HTTP:HTTP_CLIENT_IP} !^$
RewriteRule ^(.*)$ - [F]

—End Source Code—

Part B: block anonymous user agents.


—Copy Source Code—

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} anonymous [NC]
RewriteRule ^.* - [F,L]

—End Source Code—

Part C: block domain referrers.

—Copy Source Code—

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(www\.)?refererdomain1\.com  [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)? referrerdomain2\.co\.uk
RewriteRule .* - [F]

—End Source Code—

Single Domain Refferers

—Copy Source Code—

RewriteEngine On
RewriteCond %{HTTP_REFERER} refererdomain1\.com.*$ [NC]
RewriteRule .* - [F]

—End Source Code—

Notes:
these codes should block those nasty proxies’ users from abusing your website, forums or blogs. But, please be careful…

Copyrighted By Lair360




How to remove world wide web – WWW




Tagged Under : , ,

Version: 13.1
Revision: 22 Build 12c

How to remove world wide web – WWW

Introduction:
everyday in my life, there are hundreds of users, who would like to get rid of this annoying “world wide web”, which is located on their hosting services and the address bar. These strings can be remove by using “htaccess” commands, to redirect a web-link into an url without “www”.

Example: all urls will be redirect by the ‘htaccess’ files, from “www.example.com” to “example.com”, even if the “www” is typed into the address box.

1.] Create a single “.htaccess” file or add this code into the top of your “.htaccess” file.
But, you must delete your old “htaccess” files (server files) before you transfer it into your hosting server. If you overwrite it, the codes will not work…

—Copy Source Code—

<IfModule mod_rewrite.c>
RewriteEngine On
Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^www\.example\.come$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
</IfModule>

—End Source Code—

Notes: replace “example” with your own domain names (before you import). After that, just clear your internet browsers’ temporary files and caches.

2.] Check your website by typing the urls with “www” and see it for yourself.

3.] Finish!

Tips: if you want to be smart and keep your page rank from being slaughter, you can use this htaccess methods to hide this problem.

—Copy Source Code—

<IfModule mod_rewrite.c>
RewriteEngine On
#Options +FollowSymLinks
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
</IfModule>

—End Source Code—

Notes: just remove the “#” symbol, if you want to activate “FollowSymLinks”.




Htaccess – regular expressions




Tagged Under : , , ,

Version: 16.1a
Revision: 33 Build 18

Htaccess – regular expressions

Introduction:
many users these days aren’t sure about “htaccess” syntax and their regular expressions. So, I’ve written this article to stop you from getting confuse!

. (full stop) – match any character and any single character
* (asterix) – match zero or more of the previous symbol
———————————
Notes: * – means one or more of the preceding characters

+ (plus) – match one or more of the previous symbol
? (question) – match zero or one of the previous symbol
\? (backslash-something) – match any special characters
^ (caret symbol) – match the start of a string
# – this symbol is a commented-out line
——————————–
Notes: ^ – refers to the beginning of a string. So any syntax that has ^ in it means “starts with”

$ (dollar symbol) – match the end of a string
——————————–
Notes: $ – refers to the end of the string. So any syntax that ends with $ means “ends with” the previous character

[set] – match any of the symbols inside the square braces
(pattern) – grouping, remember what the pattern matched as a special variable

Extended information
——————————–
^$ – refers to a string that starts and stops with nothing in between, also known as an empty string, as there’s nothing in it.

^demo.* – refers to a string that starts with “demo” and then may contain any number of any characters.

^globalnews\.net$ – refers to a string that contains only “globalnews.net”

! symbol is a negation. Anywhere you see a ! (exclaimation mark), it means denied or exclude. So, “!string”, matches everything except (exclude) string.

Exclusion is a very useful method and it will allow your domain from being block by htaccess as bad referrers and agent-robots.

!^friend1@client1.mydomain\.com$

Notes: the ! symbol notify the engine to exclude “friend1@client1.mydomain” from a “.com” domain. This way, your website or friend’s site will not get block.

——————————–

Advice: ^(.*)$ – the ^ (caret) symbol defines the start, (.*) is a designated variable (using brackets) containing a regular expression that matches any combination of characters, and the $ symbol defines the end.

That is all everyone and thank you for your support!

Copyrighted by Lair360