Archive for the ‘Admin-type scripts’ Category

PHP Command Prompt Part II - Regular Expressions

Wednesday, March 12th, 2003

How often has it happened that you have a few hundred pages, with something that needs to be changed on each page? Luckily, PHP >= 4.2.0 ships with PCRE enabled by default, opening up the power of regular expressions to PHP scripters.

I’m not going to give a primer on REs (Regular Expressions), but if you don’t know about them you should really sit right down & teach yourself. O’Reilly has an excellent book on them, and the program Visual REGEXP (search Freshmeat) is a great learning tool.

If you need help on running PHP from the command prompt, see my earlier post on the topic.

Here’s the setup:
(more…)

PHP at the command prompt

Tuesday, March 11th, 2003

Figured it was about time I actually posted something…

Little known to many people, PHP actually makes an excellent system level scripting language. Let’s take a quick look at scrapping Perl & using PHP for a simple problem.

Setup:
I’ve got a bunch of m3u files that contain reference to single mp3 files on a friend’s web server. I want to download all the mp3s, but don’t want to open each m3u file & copy and paste the http link. Let’s use PHP for the task.
(more…)

Friendly error pages using PHP and .htaccess

Sunday, December 8th, 2002

I know that we’ve posted about .htaccess files and friendly error pages before, but after some questions from my spouse, I decided to write up something more along the lines of a package of scripts. It contains a bit of optional logging, if you want to keep an eye on the details of your errors, but that can be turned off if you want.

My full entry (although not much longer than this) about the package is available here; you can also download the zip file and just work from the README I’ve included.

Introduction to AD

Saturday, October 5th, 2002

This is an introduction to a couple of postings I’ll be writing on system admin style scripting. Web scripting is great, but its good to see how the skills you aquire scripting for the web can spill over into “backend” style administration work. That said, lets get into Active Directory (AD), and how to script against it.

What is AD?

AD is basically a Microsoft based implementation of LDAP (Light Directory Access Protocol), which is a hierarchical database of objects (users, computers, etc). LDAP is an open, standard based protocol, meaning that LDAP enabled applications should be able to work with AD. Since this will probably be a long article, please read on…
(more…)