#!/usr/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.thearma.org/link_thing/rando.cgi?YOUR_PASSWORD_HERE $pass = "123456"; # What is your URL ? .. (Your home URL for your visitors ) $home = "http://www.thearma.org"; # What is the title of your site ? $title = "thearma.org"; # Where is the header file that will have your banner / logo etc.. on it ? $header = "$home/rando/top.html"; # What is the PATH to data.db ? (THE FULL PATH !! ) (chmod 666 data.db) $data = "/www/thearma/rando/data.db"; # How LARGE do you want your top frame to be ?? # A good size is about 25.. This is out of 100.. $top = "25"; # What is the URL to this file ?? $file_url = "$home/rando/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 Your Addition


  • Your submission has been successful.


CLICK HERE TO GO HOME

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; } } }