#!/usr/local/bin/perl ############################################################################## # RAND-O-FRAME # ---------------------------------------------------------------------------- # Created By: Andrew Timmins || webmaster@cgishack.com # Website: http://www.cgishack.com # ---------------------------------------------------------------------------- # umm... Well don't try and sell this program because you will not make any # money off it. .. and if i catch you trying.. BIG TROUBLE! # ---------------------------------------------------------------------------- ############################################################################## # <> # 1) Set the path to Perl on Line 1. # 2) Define the Variables below AND READ WHAT I SAY THEY ARE ABOVE. # 3) Make your header page for the top frame. # 4) chmod the dir that holds this file to 777 (chmod 777 the_dir_name ) # 5) chmod this script to 755 ( chmod 755 rando.cgi ) # 6) chmod data.db to 666 ( chmod 666 data.db ) # ####################### # THIS IS HOW YOU CALL THE ADMIN --->>> # http://www.your_name.com/link_thing/rando.cgi?YOUR_PASSWORD_HERE ############################################################################## # What is your password ?? # <<<<(NOTE)>>>> This is how you will call the admin.. # Example.. http://www.your_name.com/link_thing/rando.cgi?YOUR_PASSWORD_HERE $pass = "gnarly"; # What is your URL ? .. (Your home URL for your visitors ) $home = "http://www.rain.org/~thechief"; # What is the title of your site ? $title = "Chief Blackbear"; # Where is the header file that will have your banner / logo etc.. on it ? $header = "http://www.rain.org/~thechief/topframe.htm"; # What is the PATH to data.db ? (THE FULL PATH !! ) (chmod 666 data.db) $data = "/home/u2/users/thechief/public_html/cgi-bin/webring/data.db"; # How LARGE do you want your top frame to be ?? # A good size is about 25.. This is out of 100.. $top = "10"; # What is the URL to this file ?? $file_url = "http://www.rain.org/~thechief/cgi-bin/webring/rando.cgi"; ############################################################################# # # NOTHING ELSE TO EDIT.. BUT PLEASE DO.. YOU WILL LEARN A THING OR TWO!! ############################################################################# &form_info; print "Content-type: text/html\n\n"; if ($ENV{'QUERY_STRING'} =~ /$pass/i) { &admin; } elsif ($form{'delete'}) {&delete;} elsif ($form{'purge'}) {&purge;} elsif ($form{'$pass'}) {&admin;} elsif ($form{'add_link'}) {&thanx;} elsif ($form{'add'}) {&add;} elsif ($form{'back'}) {&admin;} elsif ($form{'addition'}) { &admin; } else {&main;}; sub main { open (DATA, "$data"); @list = (); srand(); $number=@list; $correct=int(rand($number)); $rando=$list[$correct]; close (DATA); print "\n"; print "\n"; print "$title\n"; print "\n"; $top_frame = 100 - $top; print "\n"; print "\n"; print "\n"; print "\n"; print "<body>\n"; print "<p>This page uses frames, but your browser doesn't support them.</p>\n"; print "</body>\n"; print "\n"; print "\n"; print "\n"; exit; } sub delete { unlink('$data'); open (DATA, ">$data"); close(DATA); &admin; } sub admin { if ($form{'url'}) { &see; open (ADDED, ">>$data"); print ADDED "$form{'url'}\n"; close (ADDED); } ## opps.. forgot to count the lines in the file.. hehehe $count = 0; open(COUNT, "$data"); @counter = ; foreach $adding (@counter) { ++$count; } print "\n"; print "\n"; print "$title RAND-O-FRAME Admin\n"; print "\n"; print "\n"; print "

\n"; if ($form{'delete'}) { print "Database Deleted..\n"; } elsif ($form{'url'}) { print "Link Added\n"; } else { print "$title Small Administration\n"; } print "

\n"; print "
\n"; print "
    \n"; print "
  • Please select the option you wish  to perform below.
  • \n"; print "
\n"; print "
\n"; print "
\n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print "

Test\n"; print " to make sure you random link is working.

Delete\n"; print " the whole database that contains the links.Add\n"; print " a link to the database.Total\n"; print " number of links in database.
$count
\n"; print "
\n"; print "
\n"; print "
    \n"; print "
  • HTML CODE FOR RAND-O-FRAME.
    \n"; print "

    \n"; print "
    \n"; print "
    \n"; print "
  • \n"; print "
\n"; print "
\n"; print "\n"; print "\n"; exit; } sub purge { print < Delete ??

Delete Database


  • Are you 100% sure you want to do this ??
  • Your Whole database will be deleted you know..

PURGE exit; } sub add { print < Add to database

Add Link to Database


  • Please fill in the URL below that you wish to add to the database.

ADD exit; } # Print 0ut the Thank you note. and add tne data to the file . sub thanx { &see; if ($form{'url'} eq "") { print " You must put some website in the textbox.. Please Go back\n"; exit; } open (ADDITION, ">>$data"); print ADDITION "$form{'url'}\n"; close(ADDITION); print < Addition Complete

Thank You For Joining
The Chief's Literary Webring

Your submission has been successful. This makes you a member of the Tribe. Click Here to check the list of ring sites. Yours should be on the bottom. If you don't see it reload the page and it should be there.

Click Here to get the ring code.

Chief
Blackbear's Literary Webring Random Site

List Sites

Join Ring

Get code

THANX exit; } sub form_info { read(STDIN,$buffer,$ENV{'CONTENT_LENGTH'}); if ($ENV{'QUERY_STRING'}) { $buffer = "$buffer\&$ENV{'QUERY_STRING'}"; } @pairs = split(/&/,$buffer); foreach $pair (@pairs) { ($name,$value) = split(/=/,$pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; $form{$name} = $value;} } sub see { open(DB, "$data"); @dat = ; foreach $dat (@dat) { chomp $dat; if ($form{'url'} =~ /^$dat$/i) { print "$form{'url'} is already in our database. You can only add your site one time\n"; exit; } } }