You must remember that there are hard-coded urls all over word press. Here are 3 sql statements to update those urls:
- Update all post guids: UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain-name.com','http://www.new-domain-name.com');
- Update all post content: UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain-name.com', 'http://www.new-domain-name.com');
- Update all home and site_url options: UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain-name.com', 'http://www.new-domain-name.com') WHERE option_name = 'home' OR option_name = 'siteurl';
Tags: database, db, sql, wordpress
I just finished cleaning off a machine with this virus. Please don't click on any links from Facebook that sound like this...
Yesterday, reports started circulating about a virulent piece of worm spreading through Facebook. The malicious code isn't exactly new (it started surfacing in August), but has now been altered to strike social networking websites only and is currently making the rounds on Facebook pretty quickly, it seems. The virus can spread fast because they travel through messages which appear to come from your friends.
The Koobface messages carry subject lines like "You look so funny on our new video" or something similar, and contain a link to a video site that appears to contain a movie clip. If the user tries to watch it, a message appears saying that he or she needs the latest version of Flash Player in order to play the clip. This tricks users into downloading a file carrying the malware. An earlier version of the virus targeted MySpace users earlier this year but was quickly eliminated after new security measures were put in place.
Entire article here...http://www.washingtonpost.com/wp-dyn/content/article/2008/12/05/AR2008120501081.html
Tags: sysadmin spyware virus
Counter Class
Counter class can be used to keep a count and timer of a given object or group of objects. I use it mainly for counting links and stopping and starting a timer in session. This helps me to keep track of how long a user is on a particular page or group of pages. You may find it useful to call this object through AJAX to update counter information in your database, or just hit it using a normal post. In my case, I wrote a small extension of this class which does all of the necessary DB handshaking between the counter data and the database.
Usage:
* @example $counter = new Counter(100) - this instantiates the $counter object and sets the initial counter 'page'=>100,'count'=>1
* @example $counter = new Counter(null,true); - this instantiates the $counter object and sets the initial counter [page]=>'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'],[count] => 1, [time] => 0
If the second value is true, the clock will start ticking on your page's session variable. Every time the counter is called again, the session variable will update to the time difference between the second call and the initial call. You may use the other methods such as, stopTimer, restartTimer to do the obvious. When finished counting and timing, you may obtain all of your counts and times using the getAllCounts method. That's about it. It's simple, but it comes in real handy for me when attempting to, well, count things.
Counter Class
Tags: php code
Here's a quick example of fading in/out of divs with Moofx. In order to use this, you will need two href tags with ids, and two divs to fade in and out of. Read the code comments for more instruction:
Tags: javascript moofx setOpacity opacity moo
This will not get you to SQL-foo master status, but it will help you out when trying to find duplicate rows in a database table that is, err, let's just say not-so-well-formed:
select
count(*),
min(id),
max(id),
email
from users
group by email having count(*) > 1;
Tags: sql database
This is a quick write up for walking through a result set data and converting state names to abbreviations:
Tags: php function array_walk