Words :: Writing, technical and otherwise
A series of short articles constructed using the English language and Notepad.exe.

Generating e-mail addresses with JavaScript to avoid spam
One of the easiest ways to get bombarded with spam e-mail is to put your e-mail address on your web site as a simple mailto link. Having an e-mail address present as clear text makes it vulnerable to e-mail harvester bots. These programs crawl web pages and store any e-mail addresses they find to be spammed later.

 

A fool-proof way to avoid this, of course, is to create an HTML form to allow a user to submit a message. This requires some sort of server-side component, though, and may be more complicated than many casual web-page authors want to deal with. A quick and effective alternative is to generate e-mail addresses using JavaScript.

To implement this solution, paste the following code into the body of your HTML document where you want the e-mail address to appear:

  <script language="JavaScript" type="text/javascript">
    <!--
      noSpam("name")
    //-->
  </script>

Now, put the following code into your HTML document's <header> section:

 
  <script language="JavaScript" type="text/javascript">
    function noSpam(username){
      var address = username + "@yourdomain.com" //assembles e-mail address
      var noSpamLink = "<a href='mailto:" + address + "'>" + address + "</a>" //creates A tag
      document.open()
      document.write(noSpamLink) //displays mailto link on page
      document.close 
    }
  </scirpt>
 

This function first assembles the e-mail address using the name passed to the function and your hard-coded domain name. Next it creates a text string containing the <A HREF> tag to be displayed on the page. Finally, the link is written to the page.

The result is an e-mail link that looks and acts exactly as if it was normal mailto link: . There is no e-mail link for a bot to harvest though: the name is only shown in the function call, and the mailto link is assembled and generated as the page loads.

What if the the page visitor has turned off JavaScript in the browser? Well, this won't work of course. You can add <noscript> tags to let these people know what's going on: a warning message, a suitably garbled version of the address that humans can read (but bots can't), or an image of the e-mail address text (don't blow it by using the address as the alt attribute!).

  <noscript>
    <p>To guard against spam, e-mail addresses 
       on this page are encoded using JavaScript. 
       Please turn on scripting in your browser 
       to see e-mail addresses.</p>

    <p>name[@@AT@@]yourdomain[..DOT..]com</p>

    <img src="emailaddress.gif" alt="e-mail address">
  </noscript>

[back to top]


Subscribing visitors to a mailing list using PHP
An e-mail announcement or discussion list is a cheap and easy way to communicate with customers, users, or like-minded individuals. To set up an e-mail list, you'll need to use a mailing list manager, which many web hosts now provide. Once the mailing list is set up, make it easy for people visiting your web site to sign up. A quick and easy way to do this is using the PHP mail() function. For this example, we're using PHP 4 and EZ Mailing List Manager, this popular list manager similar to LISTSERV or Majordomo.

Once you've set up an EZ list, a user can subscribe to a list by sending an e-mail message to a special address. For example, if joe@yahoo.com wants to subscribe to the news@flanneljammies.com list, he sends an e-mail message to news-subscribe-joe=yahoo.com@flanneljammies.com. Our job is to simplfy this process for Joe. To make it easy for Joe, we'll create a small form so he can type in his e-mail address and click the Sign Up button.

Create a PHP document called signup.php and paste in the code below. This code creates an HTML form that posts to itself (signup.php). If an address has been entered, the script validates it, assembles the special subscription address, calls the mail() function, and displays a thank-you message. If the form has been posted without any address or the address is invalid, the script displays warning messages. If this is the first time the page has been displayed or there are errors with the submission, the script displays the form fields for user entry.

 
  <form action="signup.php" method="post">
    <h1>Receive FlannelJammies news</h1> 
    <?php
      $address = $_POST['address']; //posted e-mail address
      $subscribeAddress;
      $encodedAddress;
      $subscribed = False;
      if($address != ""){ //if address is not empty
        //validate address format using regular expression
        if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $address)){ 
          //display validation warning 
          echo "<div class='error'>Please enter a valid e-mail address.</div>";   
        }else{ //assemble subscription address and send mail 
          $encodedAddress = ereg_replace("@","=",$address);
          $subscribeAddress  = "news-subscribe-" . $encodedAddress . "@flanneljammies.com";
          mail($subscribeAddress, "Subscribe " . $address, "Subscribe " . $address);
          echo "Thanks for signing up. "; //display thank-you message
          echo "You'll receive an e-mail asking you to confirm your subscription.";
          $subscribed = true; //set flag indicating that e-mail address was subscribed
        } 	
      }else if(isset($address)){//if empty address field was posted, display warning
        echo "<div class='error'>Please enter your e-mail address.</div>";
      }
      if(!$subscribed){//if form not yet posted or errors exist, display form fields
        echo " E-Mail: ";
        echo "<input type='text' name='address' size='20' value='" . $address . "'>"; 
        echo "<input type='submit' value='Sign Up'>";
      }
    ?>
  </form>
 
[back to top]


Review of Fiction Jones CD by Gaddis
Much has been made of Gaddis' literary fascination. It's an easy trap to fall into given its appellation and Fiction Jones' copious liner notes filled with reading lists and background on each and every piece of writing that inspired these songs. None of that really matters if all the academic pretension isn't backed up by worthwhile music.

What initially seems to be arty lo-fi wankery, ultimately proves to be a well-constructed and, yes, beautiful collection of songs. Fiction Jones is confounding in a thoroughly architected manner, yet it's often hard to be sure whether the duo is just being impenetrable on purpose or whether they're just so wrapped up in their art that they've shut out the rest of the world.

Gaddis is the sound of beauty fighting to be heard above the groaning of decaying machinery. It's a sad sound, filled with ennui and bitterness and only the slightest hint of long-hoped-for joy. For every lush and beautiful thing on this record, there is something of equal and opposing ugliness. Hypnotic guitar figures, violins, trumpets, and bells fight against distortion, static, equipment malfunction, and noise. Gorgeous guitar tones are obscured by artifical tape hiss, drums are deliberately disjointed, transistions are jarring and violent, production veers wildly from amateurish lo-fi to heartbreakingly lush and expansive. These maddening details are much too calculated to be the result of some naive studio experimentation, especially when placed in the context of the skillful and painstaking construction of this record.

Todd Seguin's accomplished post-rock guitars ride above multi-instrumentalist Edward Mish's percussion, keyboards, strings, horns, and tape manipulations. Indeed, it is the gentle guitar figures that anchor all these songs and fuse Mish's orchestration with the expository lyrics. Seguin's trembling every-man voice betrays his emo heritage in the broad phrasings and linear melodies but he often rises above these limitations with a delicate intimacy unthinkable for most who fancy themselves "singers." A number of spoken-word pieces are included here as well and unlike any number of arty indie-rock bands who dabble in poetry, Gaddis wisely chooses to use the mesmerizing novelist Greg Williard for both voice and text.

On Fiction Jones, Gaddis shows monumental growth. Seguin and Mish's attention to detail in their intricate and varied production, songwriting, instrumentation, and arranging is astounding. As with all boundry pushers (like their peers on labels such as Constellation, Thrill Jockey, and Kranky), there are the expected missteps, but these only serve to remind us how much more they will accomplish in the future if they continue to experiment with challenging and beautiful music.


[back to top]