Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Ask not what Boards.ie can do for you... one for the Perl types...

Options
  • 15-08-2000 1:55am
    #1
    Business & Finance Moderators, Entertainment Moderators Posts: 32,387 Mod ✭✭✭✭


    I dunno if anyone out there has hacked up UBB but if you look here: http://www.boards.ie/newlook/html/index.htm

    you will see our new look for boards.

    Now, if you use www.boards.ie/bulletin you get a nice little light that says "theres new stuff in this forum since you last were here"

    I'd really like to get that on the front page as it would be great to just pull the front page up and see whats new in the last 5 mins since you are bored at work... you know what I mean smile.gif

    Now I know shag all Perl but it might be educational to have a root around and see how it's done. Plus I'll buy pints if you can do it and forever will your name be carved in stone
    "This Man Had Too Much Free Time".

    Anyone?

    DeV.


Comments

  • Moderators, Social & Fun Moderators Posts: 28,633 Mod ✭✭✭✭Shiminay


    Where can one find the code? I'm nearly finished the thingy I'm working on (Java + Style sheets integration) and will have a bit of free time to play with smile.gif

    I think Karla's the real Perl hear on these boards smile.gif



    All the best,

    Dav
    @B^)
    My page of stuff


  • Closed Accounts Posts: 202 ✭✭Karla


    Hehe I've made a name for myself huh? :P

    Dev if you like I'll give it a shot, but I'll need the source to the http://www.boards.ie/bulletin page. I have a feeling it could be all done in Javascipt.
    Plus, I have way too much free time on my hands smile.gif

    Karla




  • Closed Accounts Posts: 202 ✭✭Karla


    Try this, not 100% sure if it'll work, and it's pretty dirty too (it just prints out the topics and tells you if there's been any new posts).

    If it don't work get back to me.
    #!/usr/bin/perl -w
    
    use CGI qw/:all/;
    use strict;
    
    my $cur = CGI->new();
    
    my $number = "";
    
    my @cookie = cookie('lasttime');
    
    my $path = "http://www.boards.ie/bulletin";
    
    my $numOfForums = 19;         # Let's say you've got 19 forums.
    
    my $file = "";
    
    my @forums = ();
    
    my @topics = qw(After-Hours Games Quake Unreal Half-Life Tribes Role-Playing Films-TV Books Music-Radio Humanities Humour Technology Webmaster Security Programming Sport Work For-Sale);
    
    foreach $number (1..$numOfForums) {
    
        open (LASTTIME, "< $path/Forum$number/lasttime.file") or die $!;
        flock(LASTTIME, 2);           # Locks the file
        my @lasttime = <LASTTIME>;
        close(LASTTIME);
    
        # $lasttime[2] is the total number of posts in the forum.
        # $lasttime[1] is the total number of topics (I think)
      
        $forums[$number] = $lasttime[2];
    
    }
        
    # So now, $forums[1] contains the number of posts that are in the first forum
    # and $forums[2] contains the number of posts in the second forum etc.
    # Now all that's needed is to compare the values in @forums and the values in @cookie
    
    my @newposts = ();
    
    foreach (@forums) {
    
       if ($cookie[$_] > $_) {
          $newposts[$_] = 1;
       } else {
          $newposts[$_] = 0;
       } 
    
    }
    
    
    # Prepare the cookie
          
    my $cookie = cookie(-name => 'lasttime', -value => \@forums, -expires => '+7d');
    
    print header(-cookie => '$cookie');
    print start_html;
    print h1("Boards.ie Topics");
    
    foreach (@topics) {
    
       if ($newposts[$_]) {
          print "<B>$topics[$_]</B> There are New Posts since your last visit<br>\n";
       } else {
          print "<B>$topics[$_]</b><br>\n";
       }
    
    }
    
    
    print end_html;
    
    

    Karla




  • Closed Accounts Posts: 202 ✭✭Karla


    Oops smile.gif

    Try this instead:
    #!/usr/bin/perl -w
    
    use CGI qw/:all/;
    use strict;
    
    my $cur = CGI->new();
    
    my $number = "";
    
    my @cookie = cookie('lasttime');
    
    my $path = "http://www.boards.ie/bulletin";
    
    my $numOfForums = 19;         # Let's say you've got 19 forums.
    
    my $file = "";
    
    my @forums = ();
    
    my @topics = qw(After-Hours Games Quake Unreal Half-Life Tribes Role-Playing Films-TV Books Music-Radio Humanities Humour Technology Webmaster Security Programming Sport Work For-Sale);
    
    foreach $number (1..$numOfForums) {
    
        open (LASTTIME, "< $path/Forum$number/lastnumber.file") or die $!;
        flock(LASTTIME, 2);           # Locks the file
        my @lasttime = <LASTTIME>;
        close(LASTTIME);
    
        # $lasttime[2] is the total number of posts in the forum.
        # $lasttime[1] is the total number of topics (I think)
      
        $forums[$number] = $lasttime[2];
    
    }
        
    # So now, $forums[1] contains the number of posts that are in the first forum
    # and $forums[2] contains the number of posts in the second forum etc.
    # Now all that's needed is to compare the values in @forums and the values in @cookie
    
    my @newposts = ();
    
    foreach (@forums) {
    
       if ($cookie[$_] > $_) {
          $newposts[$_] = 1;
       } else {
          $newposts[$_] = 0;
       } 
    
    }
    
    
    # Prepare the cookie
          
    my $cookie = cookie(-name => 'lasttime', -value => \@forums, -expires => '+7d');
    
    print header(-cookie => '$cookie');
    print start_html;
    print h1("Boards.ie Topics");
    
    my $i = 0;
    
    foreach (@topics) {
    
       if ($newposts[$i]) {
          print "<B>$topics[$_]</B> There are New Posts since your last visit<br>\n";
       } else {
          print "<B>$topics[$_]</b><br>\n";
       }
    
       $i++;
    
    }
    
    
    print end_html;
    
    




  • Business & Finance Moderators, Entertainment Moderators Posts: 32,387 Mod ✭✭✭✭DeVore


    <monty python voice>
    How shall we try this oh lord?
    </monty python voice>


    Kharn, the code for UBB is open afaik...

    DeV (deffo not a perl head)



  • Advertisement
  • Closed Accounts Posts: 202 ✭✭Karla


    You want to know what to do with the code?

    Well, once it's on the server, chmod it to 0755 or whatever ye use and it should do the trick.

    If you get a 500 Error, the best thing to do is to run it from telnet and see what the errors are.



  • Subscribers Posts: 4,419 ✭✭✭PhilipMarlowe


    Dev...have you tried http://www.ubbhackers.com/ ????

    All legal stuff too...as they say themselves
    A few policy reminders, folks.

    In all instances at this site, we use the traditional definition of hacker: "A person who enjoys exploring the details of programmable systems and how to stretch their capabilities." (The Jargon File: http://www.tuxedo.org/~esr/jargon/html/entry/hacker.html)

    We are not the malicious type who enjoy breaking into systems and exploiting security holes. We are not pirates. We are not crackers. We are not 'elite hackers'. We are programmers.

    If you ask a question here relating to the unfortunate new definition of 'hacking', you will be flamed to a blackend crisp and forcefully escorted out.

    Next, If your UBB is violating the UBB license (by removing or hiding the powered-by/copyright notices), and post the URL to it here, you will be given 24 hours to correct the violations before we report you to Infopop.

    If you are using a pirated UBB, you will be reported immediately.

    Are we clear on these points? Yes? Good.

    Have a nice day!

    Some nice features like the whois currently online, last post by.... custom icons... etc. etc.

    ok.... there's a nice 'Welcome to the most recent member to register' thingy.... (all together...aaaaaaawwwww...true, 'tis a bit cute but nice too...also a thread-counter thingy... see it in action on http://24.13.120.101/cgi-bin/forumdisplay.cgi?action=topics&forum=Audiograbber&number=22&DaysPrune=30&LastLogin= (along with the last post by thingy) ps. take a look at the nice regestering message at the top of that page..


    Also, Dev, with the new look, how come there isn't a direct link to the /bulletin page (which has all the info on it...)

    Don't even think about it...™
    www.licksy.net
    info@licksy.net

    [This message has been edited by Licksy20 (edited 19-08-2000).]


Advertisement