In my wanderings about the monastery I've discovered some cool goings-on on people's home nodes. The following is a collection of a few such things as well as some enhancements I've made. I've tried to give credit where credit is due, but as some of these things appear on many home nodes I've probably got it wrong. If you want to claim 'I was first' leave a note for others to read below.
1. Other stuff in your Bio
Beatnik's home node shows several extra pieces of info in his bio. Normally your bio just shows a few things that are standard on everyone's home node (Experience, Level, Location etc.) However, as the location is free-text it is possible to insert further fields into your bio.
Add this to your location, you can put more than one, just repeat the code:
2. The Button</td></tr><tr><td>Field Name:</td><td>Field Content
Note: It is possible to add the button to your bio in the manner described above and as done on my home node.<form method="POST"> <input type="hidden" name="op" value="message"> <input type="hidden" name="node_id" value="5993"> <input type="hidden" name="message" value="Your Message"> <input type="submit" value="Button Title"> </form>
3. The Javascript Warning
Petruchio has this piece of javascript on his home node as a warning. This javascript reads your perlmonks cookie and warns that is could be sent to another site for hacking your password.
3a. The Javascript Greeting<img src="http://www.brinzer.net/png/border.png" onload="if (document.cookie.length < 1) { return } alert( 'This is why you should not run around with JavaScript' + 'enabled. Your cookie says: ' + document.cookie + ' This information could have been quietly sent to a remote server, +' + ' and your account stolen.');">
3b. The Home Node Logbook<script language="javascript"> <!-- var cookie = document.cookie; var userstart = cookie.indexOf('userpass', 0) + 9; var userend = cookie.indexOf('%257C', userstart); if( userend > userstart ) { var username = cookie.substring(userstart, userend); // For some reason, the RegExps don't work, // so we resort to the good old style. :) while( username.indexOf('%2520') > -1 ) { var index = username.indexOf('%2520'); username = username.substring(0, index) + ' ' + username.subst +r(index + 5, username.length); } document.write( '' + '<hr /><p align="center">' + '<table border="1" cellpadding="6">' + '<tr><td>' + 'Hello <i>' + '<a href="/?node=' + username + '">' + username + '</a></i>!<br />' + 'Javascript bad, you know? ' + 'Maybe you should turn it off,' + ' lest I dunk your cookies, bub.' + '</td></tr></table>' + '</p>' ); } //--> </script>
The javascript:
The perl code. This code will not log you and will print your log if called without a visitor parameter:<script language="javascript"> <!-- var cookie = document.cookie; var userstart = cookie.indexOf('userpass', 0) + 9; var userend = cookie.indexOf('%257C', userstart); if( userend > userstart ) { var username = cookie.substring(userstart, userend); while( username.indexOf('%2520') > -1 ) { var index = username.indexOf('%2520'); username = username.substring(0, index) + ' ' + username.subst +r(index + 5, username.length); } document.write("<script src='http://www.isite.net.au/perlmonks/per +lmonkvisitor.pl?visitor="+username+"'></script>"); document.write("Hello "+username+", welcome to my homenode. Your visit + has been logged. If you'd like to see my log you can see it <a href= +'http://www.isite.net.au/perlmonks/perlmonkvisitor.pl'>here</a>.") } //--> </script>
4. The Messager#!/usr/bin/perl -w $visitorfile = "/path/to/visitors.txt"; use CGI; $query = new CGI; # If the visitor parameter exists then we assume its a visit from the +home node: if (my $visitor = $query->param('visitor')) { # Don't log ourselves: unless ($visitor =~ /your_username/i ) { open (VISITORS,">>$visitorfile") || die("Perlmonk Visitors cou +ldn't open $visitorfile: $!"); print VISITORS scalar(localtime) . "\t" . $visitor . "\t" . $E +NV{HTTP_REFERER} . "\n"; close VISITORS; } print "Content-Type: text/javascript\n\n"; # Output our javascript: print qq|document.write("Welcome and ")|; } else { open (VISITORS,"$visitorfile") || die("Perlmonk Visitors couldn't +open $visitorfile: $!"); @data = <VISITORS>; close VISITORS; print "Content-Type: text/html\n\n"; print "<h1>Visitors to my Homenode</h1>\n"; print "<table border=1 cellspacing=0><tr><th>Time/Date</th><th>Use +rname</th></tr>\n"; foreach $line(@data) { my ($date, $user) = split(/\t/,$line); print "<tr><td>$date</td><td>$user</td></tr>\n"; } print "</table>"; }
4a. The Custom Messager<form method="post"> <input type="hidden" name="op" value="message"> <input type="hidden" name="message" value="/msg Petruchio Hi, I just visited your page."> <center> <input type="submit" name="message_send" value="Hello"> </center> </FORM>
<form method="post" name='f' onSubmit="f.message.value = f.message.val +ue + prompt('Enter your message:'); return true;"> <input type="hidden" name="op" value="message"> <input type="hidden" name="message" value="/msg Username "> <center> <input type="submit" name="message_send" value="Hello"> </center> </form>
Edit kudra, 2002-09-26 Added readmore tag
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Cool code for your home node
by Chady (Priest) on Sep 26, 2002 at 07:09 UTC | |
Re: Cool code for your home node
by Lexicon (Chaplain) on Sep 26, 2002 at 18:21 UTC | |
Re: Cool code for your home node
by moxliukas (Curate) on Sep 26, 2002 at 11:33 UTC | |
Re: Cool code for your home node
by ignatz (Vicar) on Sep 26, 2002 at 14:12 UTC | |
Re: Cool code for your home node
by b10m (Vicar) on Dec 02, 2003 at 11:06 UTC |