Repel those mosquito robots and spammers!




Version: 13.1
Revision: 13 Build 16

Repel those mosquito robots and spammers!

Introduction:
last night, I was totally ‘brain-dead’ and I am not in a mood, just to write another article. So, to keep my readers and guest happy, I have to keep going and push my knowledge to the edge!

Here is another article for you to filter / block more SPAM, Robots and Comment Junkies (spammers that post the same sentence and acts like robots). However, this code will only work, if you are using “PHP scripting engine” or Wordpress.

Notes: if you want to use this source, just to reduce SPAM and other Robots, I would recommend you to make a backup of your ‘Theme’ folder and your SQL database. After that, you can continue with the tutorial.

1.] Login to your Cpanel and direct yourself to your ‘Theme’ folder.

2.] Look for this file: ‘function.php’ and add this code into the file.

function check_referrer() {
    if (!isset($_SERVER['HTTP_REFERER']) || $_SERVER['HTTP_REFERER'] == "") {
        wp_die( __('Get away from my blog and stop spamming!') );
    }
}
add_action('check_comment_flood', 'check_referrer');

3.] Save your changes and let those crazy spammers deal with their own problem!

4.] You’re done!

Copyrighted By Lair360




Wordpress – Change that horrible login screen!




Tagged Under : ,

Version: 17.2
Revision: 13 Build 11

Wordpress – Change that horrible login screen!

Wordpress Version: 2.8+

Wp-Login-ExIntroduction:
On the 17th of November, I had a short reply from my readers. They told me that my previous “Wordpress Login Screen” tutorials, they are old and outdated. This is because, everyone is now using “Wordpress 2.8+” for their project. So, for those who are using the old version, please click on this link and change your login screen.

http://lair360.co.uk/blog/537/

For the other readers and publishers who are using the latest version, please read this article. But, don’t forget to create a backup of your SQL database!

Have fun and be careful with the modification!

Warning: If you’re unsure about this modification, then please stop reading. This article is only provided for advance users. So, if you want to try this out, please create a dummy area and install Wordpress under your new directory.

—————————————
1.] Log-in to your Cpanel and click on your FTP server. But, do not download each file and modify them outside the server! It is very unstable and dangerous when you upload your modified version.

2.] Look for these files and directories.

…/wp-login.php
…/wp-admin/css/login.css
…/wp-admin/images/

Notes: if you want to change your image, you will need to keep the formats as PNG or GIF and the size must not exceed 400 pixels in width and height.

3.] Search for your “wp-login.php” file and look for these codes.
It’s located at line 73 – 75.

Notes: you will need to replace this phrase: “Powered by WordPress” and its default Url: “http://wordpress.org/”.

<div id="login"><h1><a href="<?php echo apply_filters('login_headerurl', 'http://wordpress.org/'); ?>" title="<?php echo apply_filters('login_headertitle', __('Powered by WordPress')); ?>"><?php bloginfo('name'); ?></a></h1>

4.] Save your changes and look for this file: “login.css”.

…/wp-admin/css/login.css

h1 a {
	background: url(../images/logo-login.gif) no-repeat top center;
	width: 326px;
	height: 67px;
	text-indent: -9999px;
	overflow: hidden;
	padding-bottom: 15px;
	display: block;
}

5.] Modify the image’s location and save your changes.

6.] You are done!

Copyrighted By Lair360




Say NO to SPAM!




Tagged Under : , ,

Version: 1.1a
Revision: 34

Say NO to SPAM!

PrintIntroduction:
for the passed two days, I was revising my IP – ban – script. So that it doesn’t comprise your server load and time, especially, when there is high traffic. Nevertheless, this script was created from my previous article. But, I decided to modified it and make it smaller for everyone to use and share.

On the other hand, this script is everywhere on the search engine. But, please understand, that I had spent a great amount of time, just to refurbish these scripts.

1.] Login to your Cpanel and click on your FTP server. After that, you’ll need to select one of these scripts and add them into your header tags. But, don’t forget to create a data file or a text file for blocking your offending spammers or hackers.

<?php
$ip = $_SERVER['REMOTE_ADDR'];
$ipArray = preg_replace("#\r\n?|\n#","",file('IP.dat',FILE_IGNORE_NEW_LINES));
foreach ($ipArray as $ipTest) {
  if (substr_count($ip, $ipTest) != "0") {
    header('location: http://google.com');  // the banned display page
    die();
  }
} ?>
<?php
$ip = $_SERVER['REMOTE_ADDR'];
$ipArray = preg_replace("#\r\n?|\n#","",file('IP.txt',FILE_IGNORE_NEW_LINES));
foreach ($ipArray as $ipTest) {
  if (substr_count($ip, $ipTest) != "0") {
    header('location: http://google.com');
    die();
  }
} ?>

2.] Save your changes and keep an eye for more spammers!

3.] Done!

Copyrighted By Lair360




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




Suppress those warning and errors!




Tagged Under : , , ,

Version: 11.1
Revision: 23.3 Build 6

Suppress those warning and errors!

php_logo_v2Introduction:
This problem is getting on my nerves and I don’t really like it! It normally triggers when your server is loading a page. But, to clarify this issues, the server must first send the ‘HTTP headers’, before the ‘HTML’ sections and the body tags. So, without the buffer commands, you’ll get something that looks like this: “Cannot modify header information – headers already sent by (output started at ……….)”

Example: “Warning: Cannot modify header information – headers already sent by (output started at /root/file.php:16) in /root/file.php on line 54″

This errors happens a lot on Wordpress & Drupal. But, there is a way to suppress this problem.
We just add this bit of code – straight into the top of the page!

<?php  // Enable output buffering
ob_start(); ?>

For Wordpress users, you’ll need to add this script into your ‘header.php’ file.
After that, just save your changes and the errors should be suppressed!

What is “ob_start” and what is this little function?

ob_start() is an output function that holds back any ‘output’ from the script until everything is ready to go. After that, it sends the headers and HTML.

Copyrighted By Lair360