Archive for the ‘PHP’ Category

PostHeaderIcon How to: Only allow yourself to login to WordPress.

<div class=\"postavatar\">how-to-only-allow-yourself-to-login-to-wordpress</div>

So I was just casually sitting here minding my own business this evening, working on a top secret project when all of a sudden my email alarm went crazy.  Yes I have an alarm.  A lot of the time I pass most of these bells and whistles off as spam, and close my e-mail client.  However this time I decided to actually check, and lo and behold, a message from Flyninja.net.

Now this was no ordinary e-mail, such as for a new comment, or a new post from one of our contributing authors.  No.  This was to notify me that my password had been forgotten by someone else, and had been reset.  That is an annoyance.  Oh but what to do? What to do?

I decided I would add a few lines of my own code to the login page.  This code checks for a specified IP address, and if it is not the defined IP, redirects the person somewhere else.  All in a couple lines of code.

Before I divulge this little trinket, letme just clarify that it’s very generic, and simple.  If you are the only person who posts to your blog, this is great.  If you have more than one author, then it will need a bit more added to it.  If you don’t have a static IP, then this probably is not a good idea for you.

Open up wp-login.php in your favorite editor and find the line:

add_action(‘login_head’, ‘noindex’);

This is found within the Function ‘login_header’ and may be about line 49

Beneath this line add this code:

$data = ‘you.ip.add.ress’;

if ($_SERVER['REMOTE_ADDR'] != $data) {

header(‘Location: http://www.somewebsite.com/’);

}

$data should equal your IP address, and after Location: you should add a website which you would like the stupid fucks who attempt to login to be redirected to.

PostHeaderIcon Migrate Xoops users to Joomla

<div class=\"postavatar\">migrate-xoops-users-to-joomla</div>

A lot of people probably have been wondering if there is a way to migrate existing XOOPS users to Joomla 1.5, and there is. Last night I needed to transfer users from a XOOPS 1.02 database to a new Joomla 1.5 database running Community Builder and Fireboard. So I wrote a nifty script to do just that.

So far this script is in beta and both XOOPS and Joomla databases must be on the same host. Make sure to read the readme carefully and pay attention, its nothing fancy and dont get mad at me if you make a mistake, I’ve commented the code only where you need to change a value.

You can download the scripts by clicking xoopsuserstojoomla1_0 <—

PostHeaderIcon PHP – 8 Files

Learning PHP and MySQL

Programming PHP 2nd Edition

PHP Architects’s Zend PHP 5 Certification Study Guide

Core PHP Programming 3rd Ed 2003

Integrating PHP and XML 2004

PHP 5 in Practice 2006

PHP 5 Recipies – A Problem-Solution Approach 2005

PHP 5 And MySQL Bible 2004

Search
Awesome Links
Subscribe
Vote for Flyninja
Random Reading