New Version 2.0 of Windows XP BITS Fix

December 3rd, 2013 5 comments

Thanks to all the feedback from those of you who’ve experienced problems with Windows Updates and the Windows XP BITS service. I’ve now updated my script to include an even more comprehensive registry fix. The latest version attempts to restore BITS and Windows Update related registry keys as well as registry permissions that can be broken by some viruses. I’m confident this is the most effective fix yet – please let me know if it works for you!

Windows XP BITS Fix Version 2.0

E-mail Munger: A PHP function to display click-able but spam safe e-mail addresses on web pages

April 10th, 2012 4 comments

If you’ve ever published your e-mail address online in plain text you will likely have noticed an increase in the amount of spam mail you receive. One of the easiest ways for spammers to pick up e-mail addresses is to use automated tools to crawl the web and to extract e-mail addresses from web pages. The software tools to do this are relatively easy to create and e-mail addresses on web pages are usually quite easy to spot as they often include a mailto: link to provide that expected click-to-email action.

I’ve seen various methods used to protect e-mail addresses from spam harvesting but most have a downside and/or generate a non-functioning mailto link. Examples are:

  1. Replace the e-mail address with an image (visitor must retype).
  2. Put spaces in the address (visitor must edit).
  3. Add a word that must be removed e.g. email@domain.net-REMOVE (visitor must edit).
  4. Change the character encoding to use HTML ASCII codes.
  5. Use JavaScript to generate the e-mail link on click or page load (relies on visitor having JavaScript enabled)
  6. Use a contact form instead of providing an e-mail address.

Of the above only options 4 and 5 can maintain the mailto: link functionality – option 6 works but is more hassle for the developer and visitors are often cautious of entering their own e-mail address on a web form.

I prefer not to rely on the availability of JavaScript so thus far option 4 has been my preference, however most solutions out there rely on a single type of encoding and even with useful online tools like http://www.addressmunger.com/ it is a pain to generate the e-mail links manually each time.

So I created my own solution – a PHP e-mail munging function that uses three types of character encoding and which makes it simple to include a munged e-mail link in your HTML page. As a little bonus the encoding is random so the e-mail address is encoded differently on every page load (though I’m not sure what real benefit this brings).

The end result of using this function is a click-able mailto: e-mail link. Setup is easy. Just include the below function on every PHP page or more likely in your main PHP include.

Then each time you want to include an e-mail address link on your web page simply insert this PHP snippet:

<?=mungemail('email@domain.net')?>

And thats it!

If you want to show different display text or want the scrambled e-mail address but no link just pass in those parameters as described in the function below.

<?php
// Email Munger Function
// Published: 10/04/12 by Phil Morgan
// This funtion returns an e-mail address randomly encoded in ascii/hex, as a link (optionally) with display text (if specified).

// Parameters:
// $str_email - email addressto munge
// $str_display - display text (optional otherwise uses e-mail address)
// $bln_link - create link (default, set to false to return e-mail address only)

function to_rand_ascii($chr)
{
    switch (mt_rand(1, 3)) {
        case 1:
            return "&#" . ord($chr) . ";";
            break;
        case 2:
            return "&#000" . ord($chr) . ";";
            break;
        default:
            return "&#x" . dechex(ord($chr)) . ";";
    }
}
function mungemail($str_email, $str_display = NULL, $bln_link = True)
{
    for ($i = 0; $i < strlen($str_email); $i++) {
        $str_encoded_email .= to_rand_ascii(substr($str_email, $i));
    }
    if (strlen(trim($str_display)) > 0) {
        $str_display = $str_display;
    } else {
        $str_display = $str_encoded_email;
    }
    if ($bln_link) {
        for ($i = 0; $i < strlen('mailto:'); $i++) {
            $str_mailto .= to_rand_ascii(substr('mailto:', $i, 1));
        }
        return "" . $str_display . "";
    } else {
        return $str_display;
    }
}
?>

Comments and ideas are welcome! The code above is free to use in your own personal web sites. If you want to use it in commercial sites I’d appreciate a donation.

Categories: PHP code Tags:

Mozilla Firefox – how to prevent the first run Firefox Import Settings and Data Wizard and the first run welcome page

September 23rd, 2009 3 comments


In my work I look after software installation for a number of computer labs and one of the applications that I deploy is Mozilla Firefox. Some time ago I discovered the excellent FrontMotion Firefox Community Edition which is exactly the same as the Mozilla version except that it allows for the possibility of configuring many of the browser settings through Active Directory Group Policy.

If you haven’t seen FrontMotion Firefox before check it out here: http://www.frontmotion.com/FMFirefoxCE/index.htm

The associated ADM templates are available on this page and as you can see they don’t hang about in getting the latest versions packaged up ready for you to use: http://www.frontmotion.com/FMFirefoxCE/download_fmfirefoxce.htm


    Disabling the first run Import Settings and Data Wizard:

Once deployed; one thing was bugging me. Whenever a user launches Firefox for the first time (and they do not have an existing Firefox profile they get the Import Wizard to Import Settings and Data… and once they’ve made it past that instead of the default homepage (which I set to our organisation’s web site) they get the Welcome to Version X.x firstrun tab.

Luckily there is a way to disable the Firefox Import Bookmarks and Settings Wizard that runs on first launch and if users do want to import their IE Favorites they can still do this once Firefox has launched from the main menu: File > Import

To disable the first run Import Wizard simply create a file named override.ini containing this text:

[XRE]
EnableProfileMigrator=false

Copy it into: C:\Program Files\Mozilla Firefox\
You could do this using a command script that runs on startup.

The bug is documented here: https://bugzilla.mozilla.org/show_bug.cgi?id=286557


    Disabling the first run Welcome to Version X.x tab:

But wait! We don’t want that annoying Welcome to Version X.x page to appear either when the user launches Firefox for the first time. We just want our home page to appear.

So using the Mozilla ADM template that works with FrontMotion Firefox Community Edition you can disable this via group policy:

In the ADM under locked settings simply set:
browser.startup.homepage_override.mstone to ignore

This bug is documented here: https://bugzilla.mozilla.org/show_bug.cgi?id=102313



Eh voila, user logs onto PC for the first time and starts Firefox, up comes the homepage!

New Version 1.6 of Windows XP BITS Fix

June 15th, 2009 No comments

Thanks to feedback from those of you who’ve experienced problems with Windows XP BITS I’ve updated my script to include a more conprehesive registry fix. The new version attempts to restore the BITS related registry keys and registry permissions that are reportedly altered by some viruses. Hope this is useful for people – please let me know if it works for you!

Windows XP BITS Fix Version 1.6

Welcome to version 2.0!

May 25th, 2009 No comments

Welcome to version 2.0 of my site! In various forms philmorgan.net has been online for some years now but over the last 2 years the techie tools that I’ve posted have brought over a 1000 visitors a month to the site. With that in mind I thought it was about time I gave it a facelift and added some more content.

This blog is a home for all the useful techie stuff, interesting articles and random information I come across in the course of my work, research and web browsing.

Feel free to comment on any of the postings and add your own ideas and links. Hopefully this blog will grow into a useful and interesting read for anyone with a vague interest in IT.

Categories: General, Site News Tags:

New command line version of RD Enable

October 25th, 2008 No comments

I’m still getting mail about RD Enable from lots of people who have found it useful. Therefore, I’m now pleased to release a simple command line version – RD Enable CL. This version is much faster (as it’s written in C) and much smaller in filesize. It does almost the same thing, although the remote firewall exception feature is not available in this version. I know that RD Enable XP doesn’t work too well in Windows Vista, but hopefully this version does. Feed back is always welcome!

Techie Tools

October 4th, 2007 No comments

A while back I created a few tools to help me in my work and made them available for people to download on my Lancaster University staff webpage. Within a few weeks I was amazed to see them appearing in the top 10 for relevant searches on Google!

I’ve since had a number of e-mails about them and thanks from people who have downloaded them over the past year. Therefore I’ve decided to make them available again here. You’ll find them in the Techie Tools section – hope they are as useful for you as they have been for me!

http://www.philmorgan.net/techie-tools/

Categories: Techie Tools Tags: ,