Category: Web Development

Change the Author of Multiple WordPress Posts

Change the Author of Multiple WordPress Posts

Disclaimer: This idea requires access to the shell on your webserver.

This is the SQL query you’ll use:

I had posts that were assigned to Admin (which by default is user ID 1), and I wanted to assign them all to my user (which in this case is user ID 2).

My query looked like this:

That will go through the posts database and update the author for all of them.


Jon

Drupal 4.7.0 Released

Drupal 4.7.0 Released

From the Drupal Homepage:

After more than a year of development we are ready to release Drupal 4.7.0 to the world. More than five years, 13 major releases, 30+ servicing firms employing 100+ Drupal professionals, 300+ third party modules, and over 55,000+ Drupal powered sites later, Drupal 4.7.0 is finally here and it rocks!

Needless to say, I’m going to be updating this version very quickly, aka as soon as my laptop starts up. Look for the next post to be from Drupal 4.7.0!

Later,
Jon Howe

AJAX Based MySql Live Search

AJAX Based MySql Live Search

This is a little something that I made up this afternoon at school.

It’s an implementation of a search app with out a celing. In other words , there’s no submit button. With each keystoke that you type, the query get’s more accurate.

If you just want to check it out (with source, and an example) then Click Here
The code is commented pretty well.

If you want a little explanation read on.

I used a library called Xajax for this project (and the last one as well). It’s an extremely useful and easy to use library because of the fact that it doesn’t require the coder to know any javascript. This is a goood thing, because I HATe javascript.

The Xajax library allows you to take a PHP function and essentially use it as a javascript function asynchronously.

What this script does is check to see if the user presses a key. Each time that they do the PHP function autoSearch() runs. autoSearch() has one paramater, the current value of the input box. Read the code comments for more info on this.

If the entered query is 2 or more charachters, then a mysql query is executed. If there are result(s), then they are diplayed.

Practical Application:
Personally, I hope to use this in the content mananagement system that I’ll be starting soon. I’m planning on having it parse through blog entries, and display the title and the publishing date of the post.

When you click on the link above you’ll see the example page. At the bottom of it are links to the PHP source, as well as the MySql Source.

If you have any questions email me at “howe -dot- jon – at – gmail – dot – com”, and I’ll get back as soon as I can.

Later,
Jon Howe

Howto: AJAX Regular Expression Email Verifier

Howto: AJAX Regular Expression Email Verifier

It’s important to do form validation for obvious reasons. This is an implementation of an email checker that uses php regular expressions, and a little bet if pizzaz with asynchronous javascript and xml, or AJAX.

Here’s the example.

A quick rundown of how this works is:

  1. You type in a string
  2. You hit submit
  3. The data is transfered asynchronously (without refreshing the page) to the server
  4. The server checks to see if the email is valid or invalid
  5. If it’s valid it tells you so, as well as if it’s not
  6. The guts of the script are here:
    if (eregi("^[a-zA-Z0-9_-.+]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-_.]+$",$email)) {
    //return confirmation that it worked
    }
    else {
    //return that it didn't work
    }

    Basically, it checks to see if there’s either a lowercase or uppercase a-z or 0-9 or an underscore, or a dash, or a period before the @ sign ([a-zA-Z0-9_-.+]+@). Then after the @ sign it checks for the same thing except for the period and the underscore up until another dot. After that dot it checks once again for the same charachters as the first set.

    Hopefully this helps someone. If you have any questions feel free to email me at “howe -dot- jon -at- gmail -dot- com” and I’ll help you however I can.

    Later,
    Jon Howe

HOWTO: Create a Logging Redirection Page using PHP and MYSql

HOWTO: Create a Logging Redirection Page using PHP and MYSql

Since I’ve already been on the topic of doing small beginner PHP tutorials, here’s another one. This one is pretty self explanitory.

You can see it here.

Basically what this does is let you enter a domain or page or whatever and it redirects you to the page. On top of just redirecting you, it logs all of the redirections along with the request date, and requester ip address.

If you have a need for this, you’ll most likely know how to implement it. If not, feel free, as always, to email me (howe -dot- jon -at- gmail -dot- com), and I’d be happy to help you out to the best of my abilities.

Later,
Jon Howe

Howto: PHP Secure Download Script

Howto: PHP Secure Download Script

I’ve been wanting to make a script in PHP that handles downloads for a while. Last night I was bored, so I made one.

DISCLAIMER:
This is a very basic example, but if you have any use for this, I’m sure that you can figure out how to use it. If not, I’ll probably work more with it in the future anyways.

This system works with two PHP files.

If you just want to see the script work, go Here.

From there you can download a sample file and see the source of the scripts.

Now, for how it works…

All that the first script (dl.php) does is display a link to the main download script (which handles the actual download) and sets a session variable for 60 seconds in the future.

Once you click on the link, the main download script (dl2.php) sets another session variable containing the time that the link was clicked.

It checks to see if the time that dl.php was generated no more than 60 seconds later than the link was clicked. If it was later than that the download fails.

Feel free to email me (howe -dot- jon -at- gmail -dot- com) if you have any questions, or requests or whatever, and I’ll do my best to get back to you that day.

Later,
Jon Howe

Useful Web Tool from Microsoft

Useful Web Tool from Microsoft

I’ve been working on a couple of new projects that are really javascript intensive, and have been banging my head because of problems with getting scripts working in all browsers.

The odds of me finding a tool to help by Microsoft of all companies is astounding to me, because of my feelings towards them.

I found a tool, which works only in internet explorer (Located Here) that is helping me out a lot.

Check it out, even if you are like me and primarily use firefox.

More later,
Jon Howe

New Idea

New Idea

I just got a new book on Ajax, which is an exploding method of creating code using a combination of Javascript, CSS, DOM, and xhtmlrequest.

That’s a bunch of technical junk I guess. The main point is that it allows you to do really cool things on a webpage without refreshing the whole page.

I’m going to try to read a chapter in it each day, if not one day then every two days, and post comments and maybe code examples (if I feel creative) as well.

I think, actually, that doing some code examples up here each time would cement the ideas into my head. Sounds like a plan.

… Wait, I’m not sure that the content management system that I’m using for this website can handle javacript… I guess we’ll see!

I’ll try and post an example or two / mabye a summary here later tonight once I finish chapter 2. (chapter 1 was way too boring, so I skipped it)

Later,
Jon Howe

Copyright VirtJunkie.com © 2020
Click to access the login or register cheese