An Easy Fix For The OpenX M2M Authentication Error

1

I recently decided sto give OpenX a shot for managing my advertisement inventory. I primarily use Google AdSense, but I wanted to be able to rotate through other ads when the opportunities are available. I had played a little bit with OpenX back when it was phpAdsNew but never got too far into a full implementation. Looking at the screenshots, documentation, and features, OpenX looked like a very good option.

After getting the current version (2.8.5) installed, unfortunately, I encountered a problem as soon as I logged in for the first time. After logging in I was directed to a dashboard page, which was one of my key reasons for trying OpenX again, and it failed to load, showing the following error: "Dashboard Error: M2M authentication error – password invalid (code: 823)." (You can also see the screenshot above). Fortunately, there is an extremely easy fix.

After a few Google searches I was able to find out that the error was occurring because I had used Fantastico to install OpenX, and this was not the first time I tried. I had forgotten that I had installed and uninstalled OpenX once before. Because I had installed it once before, it failed to create a valid m2m password the second time OpenX was installed. The invalid m2m password was causing the authentication error on the dashboard page.

The Fix: Simply go to http://(your path to OpenX)/www/admin/regenerate-platformhash.php

It seems too good to be true, but it is really this simple. I followed that one step, and it worked like a charm. The next time I opened the dashboard I was able to see it without any problems. (See screenshot below of working dashboard). I hope this helps!

How To Get Your FeedBurner Circulation With One Simple Function

0

If you have visited a few blogs then I am sure you have seen the FeedBurner stats graphic. The count is very useful, but the graphic itself isn't very appealing, even with the ability to customize it. Thankfully the FeedBurner API was released, which allows you to retrieve your stats without the graphic. I have taken that API and created a simple function, with the help of simple XML, to grab your circulation count and display it as text on your site without the graphic.

To start off, you will need to download the simple XML class and put it in the same folder as the file that will contain this function (or change the include path to reflect the directory of your choice). Once you have done that, you are pretty much done. All you need to do is copy the function below and call the function with your feed URI and it will return the circulation number.

You can see the function and sample usage below.

Function

function FeedBurnerCirc($feed) {
include 'simplexml.class.php';
$api = 'http://api.feedburner.com/awareness/1.0/GetFeedData?uri='.$feed;
$sxml = new simplexml;
$sxml->ignore_level = 1;
$data = $sxml->xml_load_file($api,"array");
return $data["entry"]["@attributes"]["circulation"];
}

Usage

echo FeedBurnerCirc('http://feeds.feedburner.com/webmastersbydesign');

You could also easily customize the function to include more data and return an array of results. The API returns data other that the circulation, such as your reach and views. I only wanted the circulation so I didn't return an array of results, but it wouldn't be tough to do.

Fix the Dreamweaver CS3 No Response FTP Error

1

Dreamweaver CS3 is a great tool for web developers. It has tons of bells and whistles that help make developing a lot faster and easier. Despite the great things I have to say about it, there is one problem that I experienced while using it with Windows Vista (I have included a screenshot above). The problem lies in the FTP function that allows you to remotely edit a file on your web server. When trying to access a file, whether it is saving, opening, or reading a directory, I would get this no response error. After dealing with this for too long, thankfully I found that there is an easy fix.

I was able to fix this by changing the FTP timeout value in the preferences. Apparently when Dreamweaver is installed, it sets this value to 2 seconds. That turned out to be too short for me. I have seen other people with this issue, and I believe the 2 seconds was too short for them as well. All you need to do to change it is go to the "Site" preferences and make the change. I changed mine to 30 seconds and haven't received the error since.

In the toolbar, go to Edit > Preferences > Site and change the "FTP Time out" (screenshot below).

I hope this helps and is able to take care of the problem as easily as it did for me.

Track Page Load Time With This Free Script Execution Class

1

Performance is very important to webmasters and a lot of times it would be nice to know how long on average it took for our web pages to load. I created a simple class in order to track how fast a page executes. This is written in PHP because that is what I use to develop my sites. It currently just displays the output on the page; I haven't turned this into a log or database table yet but I probably will. Once I convert it to save the output each time, I could use it to track the averages per page. This is just a basic timer at the moment though. I have included the class and an example within the same PHP file below. You are free to use and change the script as you wish. Feel free to link back if you would like, but it is not mandatory.

<?

class LoadTime {

var $PageLoadStart;
var
$PageLoadEnd;

function PageStart() {
$this->PageLoadStart = microtime();
}

function PageEnd() {
$this->PageLoadEnd = microtime();
}

function LoadTime() {
return
round($this->PageLoadEnd-$this->PageLoadStart,4);
}

}

$timer = new LoadTime();
$timer->PageStart();

$i = 0;
while (
$i<100000) {
$i++;
}

$timer->PageEnd();

echo $timer->LoadTime().' seconds';

?>

Easily Create Custom Error Pages

1

Chances are we've all been to a web page that no longer exists and have been staring at an error page that looks plain and provides virtually no useful information (other than the warning saying the page no longer exists). That's because Apache has included hard coded error pages in its httpd server, and while they get the job done, the job could be done better in just a few small steps. Custom error pages can be developed to help provide more information about the error, to automatically redirect the viewer to a landing page, and to integrate your site design.

Apache's ErrorDocument Directive can be used to display the default page packaged with the server or show custom error pages tailored specifically for your site. The 5 most common custom error pages used are listed below.

  • 400 - Bad Request
  • 401 - Authorization required
  • 403 - Forbidden
  • 404 - Wrong page
  • 500 - Internal server error

Creating custom error pages can be accomplished simply by creating a web page for each (or one web page accepting dynamic input) and adding a few lines to your htaccess file. I have listed examples for a static page for each error and a dynamic page for all errors below. This code should be added to your htaccess file.

Static Pages

ErrorDocument 400 /error/custom_400.html
ErrorDocument 401 /error/custom_401.html
ErrorDocument 403 /error/custom_403.html
ErrorDocument 404 /error/custom_404.html
ErrorDocument 500 /error/custom_500.html

Dynamic Page

ErrorDocument 400 /error/custom_error.php?error=400
ErrorDocument 401 /error/custom_error.php?error=401
ErrorDocument 403 /error/custom_error.php?error=403
ErrorDocument 404 /error/custom_error.php?error=404
ErrorDocument 500 /error/custom_error.php?error=500

Each of these pages could be stored wherever you like. I used the "error" directory as an example, and you can name the files however you like, using whatever type of file you wish. The ErrorDocument directive allows you to redirect to an external URL as well as a local path.

Unable to Use mysqldump on a Shared Host? Here’s an Alternative

10

Hard Drive Backup

I have used many shared hosting providers throughout my years as a webmaster. Shared hosts have many great points, namely, price, and then they have their major drawbacks. For me, one of the major drawbacks is the limited use of the machine on which your site is hosted.

For instance, I love phpMyAdmin for maintaining and managing my databases, but I am not a fan of the need to log in to backup the databases. The easiest way around that of course would be to execute the mysqldump command that comes bundled with MySQL. Unfortunately, most shared hosts, all that I have dealt with, disable the ability to use exec() or system() with PHP to execute the MySQL native command. If these were available, creating a cron job on a simple PHP file that ran mysqldump would have worked perfectly. However, this wasn't the case. After looking around for a long time at a possible way around this, I came up empty handed. Maybe I didn't look hard enough, or looked in all the wrong places, but I was left with nothing. I needed to back up my databases at regular intervals and found it frustrating to log into phpMyAdmin to do this each time. So I did what I should have done to begin with... wrote my own back-up tool.

It is pretty simple and self-explanatory. I did not create it as a function to be called, although you are more than welcome to do so. The main advantage to calling it, I think, would be to pass variables. For my needs, I simply set it up in the directory. I wanted it to run and back up whichever database needed to be. The script simply backs up the database specified in an sql file located in the same directory as the script itself. The file is named in this format, "DB_Backup_YourDatabase_YYYY-MM-DD.sql"; this could be easily modified to save anywhere you have permissions to save. The code is completely free and you can do what you would like with it. If you are feeling generous, throw a shout out my way or maybe even donate, but neither is not required.

This script was written and used on a server running PHP Version 4.4.2 and MySQL Version 4.1.22.

View Code | Download File

How To Begin Podcasting

0

Podcasting

For those of you that are new to podcasting, you should really jump on the bandwagon. Podcasting is a great way to keep people engaged and involved. Podcasting is just one of the many amazing resources available to companies, personal sites, and churches alike. Many churches (TRBC & Mars Hill) are now putting their sermons online for members and others to listen to.

  • What is a podcast?
    • A podcast is basically taking a recording of some sort and posting it online. Once the recording is ready to be posted online, you put the information in a specific format (you can get the specs here from Apple). This Apple format is then able to be submitted to the iTunes directory and displayed through iTunes. iTunes users can then subscribe to updates and listen to your recordings directly through iTunes. How cool is that?!
  • Why use a podcast?
    • Why wouldn't you want to reach millions of people? I mean really... what better way to reach millions of people than through an incredible tool given to us by Apple. The hard work has already been done. Reaching a million people is not an easy task, but we have the opportunity to utilize the popularity and credentials that iTunes has already established. Why not allow people to use one of their favorite applications for your content as well?
  • How do I create a podcast?
    • Great question! Thankfully there are many applications out there that will create podcasts for you; all you have to do is provide the content. You can use web applications like podOmatic, download and install your own web application like the Podcast Generator, or you can use the specs listed earlier from Apple to write your own RSS feed.
    • Once you have created your podcast and are ready to publish it to the iTunes store, you can follow the very simple instructions here on how to submit your podcast to iTunes.

What did you use to help create/learn podcasts? How were you able to implement podcasting for your site? Let us know in the comments.

Fix the WordPress Admin Access Forbidden Error

0

The Problem

Here is a quick tip on how to fix an all too common error when using WordPress on a shared host. I have been using WordPress for a while now, and I was comfortable with how it works and operates, until yesterday. When trying to edit a post I received a "403 - you are forbidden to access post.php" error. I was obviously worried and frantic to get it working again so I could continue writing posts. After some searching on the Internet I found what I thought may be a solution.

The Background

It is normal practice for hosts to utilize strict security measures and lock down their servers. In a lot of cases they use the mod_security restrictions with extremely high filters. This causes a problem with access rights when using Apache's mod_rewrite. The mod_rewrite versions of posts for WordPress are so much cooler than the default addresses ("?p=22"); therefore, most installations end up using mod_rewrite.

The Solution

Fortunately, the solution is incredibly easy to implement. All you have to do is add the 2 lines of code, located below, to the mod_rewrite section of your .htaccess file. The first 2 lines should be the following:
SecFilterEngine Off
SecFilterScanPOST Off

I hope this helps save a lot of time for anyone with this problem. This is a problem with an easy solution, fixable in just minutes!

Discover the Power of Cron Jobs

1

crontab

Cron jobs are commands run by the unix program cron. The cron program takes a specific syntax and runs the command at every time interval set by the user. These are used to automate scripts of all kinds. There are a lot of uses out there for setting up crons with web applications. As webmasters, if we can harness the power of the cron application, we can use cron jobs to our advantage in a number of ways. Let's get right into it.

  • How do you set up a cron job?
    • The first assumption I'm making is that you have access to cron jobs through your own web server or your web host's control panel.
    • The syntax for a cron job is "minute hour dom month dow user command"
      • minute - This is a numeric value that can be set between 0 and 59. The cron will run at this minute of the hour.
      • hour - This is a numeric value that can be set between 0 and 23 where 0 represents midnight. The cron will run at this hour of the day.
      • day of month (dom) - This is a numeric value that can be set between 1 and 31. The max value is dependent on the month you will select next.
      • month - This is a numerical value that can be set between 0 and 12.
      • day of week (dow) - This is a numerical value that can be set between 0 and 6.
      • user - This is the user that will execute the command.
      • command - This is the actual unix command that will be executed by the user specified at the specific day and time selected.
    • A * may be used for any of the day or time values if you do not wish to specify one.

  • How can we use the power of a cron job?
    • Cron accepts some special values for times and day/date values in order to meet the needs of as many users as possible:
      • Lists – Lists are accepted in a comma-separated list set.
        • Ex: dow = 1,3,5. This would schedule the cron job to run on Monday, Wednesday, and Friday.
        • Ex: dow = 1-5. This would schedule the cron job to run Monday through Friday.
      • Steps – Steps are accepted in a division style format.
        • Ex: hours = */4. This would schedule the cron job to run every four hours.
      • Lists and Steps can be combined to arrive at the desired schedule.

  • Examples:
    • 30 2 * 6 0 startrak118 php -q /home/www/site_backup.php – This cron would execute the site_backup.php file from the /home/www/ directory through php every Sunday of June at 2:30 am.
    • 0 */4 * * * startrak118 php –q /home/www/site_stats.php – This cron job would execute the site_stats.php file from the /home/www/ directory through php every four hours.

Do you have any good tips or pointers to help us understand cron better? Leave us some comments so we can continue to discover the power of cron jobs.

Creating a WordPress Widget

0

If you are reading this post, you are familiar with a wordpress widget because you can see multiple widgets displayed in the right hand sidebar of this theme. The Archives, Recent Posts, Blogroll, and Links are all wordpress widgets. If you are asking yourself, "why create a wordpress widget?" here is a short answer:

This blog, like many others, is run using wordpress (wordpress was downloaded 3,816,965 times in 2007 alone). WordPress has become increasingly popular thanks to the incredible features, themes, and plugins offered, both by wordpress.org, as well as third party developers, such as:. The administrative end of wordpress is very easy to use and at the same time very powerful. The blog has all the necessary features necessary to run a successful blog, as well as the ability to add onto the large set of tools included with the download and installation of a wordpress blog. One of the best features of wordpress in my opinion, is the ability to create plugins and widgets that suit your needs. Once the plugin or widget has been successfully created, implementation is even easier. So now that we have covered a little background information, let's get started!

Steps

1. Create a php file and put it in the "wp-content/plugins" directory in your wordpress installation path.
2. The first information in the widget file is required to be there. Each line needs to be there and is fairly self-explanatory. These lines tell the wordpress plugins manager what the plugin is, who made it, what version it is currently in, and the links to provide support and updates. It looks like this:

/*

Plugin Name: Test Widget

Plugin URI: http://smseserver.com/blog/

Description: This is my first custom created widget.

Version: 1.0

Author: Scott Spear

Author URI: http://smseserver.com/blog/

*/

3. Create the function to initialize the widget. The widget_test_init() function checks if you can register custom widgets and then loads the actual widget function, in this case named "widget_test()". The last line actually registers the new widget by calling the register_sidebar_widget() function.

function widget_test_init() {

if (!function_exists('register_sidebar_widget')) {

return;

}

function widget_test() {

echo 'This is the test widget.';

}

register_sidebar_widget(array('Test Widget', TestWidget'), 'widget_test');

}

4. After the widget is registered to the sidebar, the very last line will call the add_action() function to load the widget and show it in widget control in the admin section of your blog. The function looks like this:

add_action('plugins_loaded', 'widget_test_init');

The final php file would look like this:

<?

/*

Plugin Name: Test Widget

Plugin URI: http://smseserver.com/blog/

Description: This is my first custom created widget.

Version: 1.0

Author: Scott Spear

Author URI: http://smseserver.com/blog/

*/

function widget_test_init() {

if (!function_exists('register_sidebar_widget')) {

return;

}

function widget_test() {

echo 'This is the test widget.';

}

register_sidebar_widget(array('Test Widget', TestWidget'), 'widget_test');

}

add_action('plugins_loaded', 'widget_test_init');

?>