#!/usr/local/bin/perl ##################################################### # # #    SpookDirect v1.0 # # # # # # redirect.pl # # # # SpookDirect is a feature which users can sign-up # # for their own redirection url, which would be # # created instantly right from your account like # # they would from other redirection websites, such as # # cjb.net for example. # # # # To install this script, simply fill out the # # variables below, transload it to your account, # # CHMOD it to 755. (Filename: redirect.pl) # # # # The sign-up page is at redirect.pl, the modify # # page is at redirect.pl?modify. # # # # This script is a cool addon for a site and also # # an impressive feature. May you enjoy it. :) # # For more scripts or help, visit my WebTV NewsGroup: # # # # alt.discuss.clubs.public.webtv.misc.spookiestyle # # # # # ##################################################### # # enter account path where script is stored (below) $path='/data1/hypermart.net/User-Name'; # # enter main url of your account (below) $url='http://User-Name.hypermart.net'; $head=''; $foot=''; # # Limit of characters aloud in redirection usernames $size='18'; # # Title. $title='SpookDirect v1.0'; # # You don't need to alter anything further beyond this line ################################################ if ($ENV{'QUERY_STRING'} =~ /modify2/){ &GetFormInput; $username=$field{'username'}; $password=$field{'password'}; $userurl=$field{'url'}; if($username eq ''){ $username='give an error'; } open(FILE,">$path\/$username\/index\.html"); print FILE "redirecting....
$userurl
\n"; close(FILE); open(FILE,">$path\/$username\/$password"); print FILE "$password\n"; close(FILE); print "Content-type: text/html\n\n"; print "$title\n"; open (FILE,"<$head"); @header=; close (FILE); print "@header\n"; print "

\n"; print "

$username successfully created!

\n"; print "

Try and access it yourself. :) $url/$username.:
<:/p>\n"; print :"

\n"; :open :(FILE,"<$foot"); @footer=; close (FILE); :print :"@footer\n"; print "\n"; }elsif ::($ENV{'QUERY_STRING'} =~ /modify1/){ &GetFormInput; ::$username=$field{'username'}; :$password=:$field{'password'}; if($username eq ''){ :$username=:'give an error'; } if(-e :"$path/$username/$password") :{ print "Content-type: :text/html\n\n"; print :"$title</:title></head><body :bgcolor=black text=white>\n"; :open (FILE,"<$head"); :@header=<FILE>; close (FILE); :print "@header\n"; print "<p><center><table border=0><tr><td><form action=\"redirect.pl\" method=\"get\">\n"; print "<p><table border=0 width=350><tr><td>\n"; print "<p><font size=+2 face=Arial><b>Edit:</font><font size=-1 face=Arial><br><b>Please fill out the following to modify<br>your existing redirecting address</b></font></p>\n"; print "</td><td>\n"; print "<p><center><font size=-2 face=Arial><b>Powered by:</b><br><font size=2 face=Arial color=blue>Spook</font><input type=hidden name=\"do\" value=\"modify2\"><font size=2 face=Arial color=white><b>Direct</b> v1.0</font></a></font></center></p>\n"; print "</td></tr></table></p>\n"; print "<p><center><table border=0 width=350><tr><td>\n"; print "<p><b>Username:</b><br>$url/$username<input type=hidden name=\"username\" value=\"$username\"></p>\n"; print "<p><b>URL:</b><br><input type=text name=\"url\" size=41 value=\"http://\"></p>\n"; print "<p><b>Password:</b><br><input type=text name=\"password\" size=41 value=\"\"></p>\n"; print "<p><center><input type=Submit value=\"Edit\"></center></p>\n"; print "</td></tr></table></center></p>\n"; print "</form></td></tr></table></center></p>\n"; open (FILE,"<$foot"); @footer=<FILE>; close (FILE); print "@footer\n"; print "</body></html>\n"; }else{ print "Content-type: text/html\n\n"; print "<html><head><title>$title\n"; open (FILE,"<$head"); @header=; close (FILE); print "@header\n"; print "

\n"; print "

\n"; print "

Error
Click your back button and correct
the following errors:

\n"; print "
\n"; print "

Powered by:
SpookDirect v1.0

\n"; print "

\n"; print "

  • Invalid username/password

\n"; print "

\n"; open (FILE,"<$foot"); @footer=; close (FILE); print "@footer\n"; print "\n"; } } elsif ($ENV{'QUERY_STRING'} =~ /modify/){ print "Content-type: text/html\n\n"; print "$title\n"; open (FILE,"<$head"); @header=; close (FILE); print "@header\n"; print "

\n"; print "

\n"; print "

Edit:
Fill out the following to edit
your existing redirection address.

\n"; print "
\n"; print "

Powered by:
SpookDirect v1.0

\n"; print "

\n"; print "

\n"; print "

Username:

\n"; print "

Password:

\n"; print "

\n"; print "

\n"; print "

\n"; open (FILE,"<$foot"); @footer=; close (FILE); print "@footer\n"; print "\n"; } elsif ($ENV{'QUERY_STRING'} =~ /signup2/){ &GetFormInput; $userurl=$field{'url'}; $username=$field{'username'}; $username=lc($username); $password=$field{'password'}; if(-e "$path/$username") { $message="
  • Username already taken.
\n"; $error="$message$error"; } if($password eq ''){ $message="
  • Password must be specified.
\n"; $error="$message$error"; } if($username eq ''){ $message="
  • Invalid User Name, please select proper characters.
\n"; $error="$message$error"; } if(($userurl eq '') || ($userurl eq 'http://')){ $message="
  • Enter the url which will be directed to.
\n"; $error="$message$error"; } if($error ne ''){ print "Content-type: text/html\n\n"; print "$title\n"; open (FILE,"<$head"); @header=; close (FILE); print "@header\n"; print "

\n"; print "

\n"; print "

Error:
Please click your back button and fix
the following errors

\n"; print "
\n"; # Please do not alter next line. # Give credit where it's due. :) print "

Powered by:
SpookDirect v1.0

\n"; print "

\n"; print "

$error

\n"; print "

\n"; open (FILE,"<$foot"); @footer=; close (FILE); print "@footer\n"; print "\n"; }else{ mkdir("$path/$username",0777); open(FILE,">$path\/$username\/index\.html"); print FILE "redirecting... $userurl\n"; close(FILE); open(FILE,">$path\/$username\/$password"); print FILE "$password\n"; close(FILE); print "Content-type: text/html\n\n"; print "$title\n"; open (FILE,"<$head"); @header=; close (FILE); print "@header\n"; print "

\n"; print "

$username was successfully created. :)

\n"; print :"

::Your redirection address: $url/$username.
<:/p>\n"; ::print "

\n"; :open ::(FILE,"<$foot"); @footer=; close (FILE); print ::"@footer\n"; print "\n"; } }else{ :print :"Content-type: text/html\n\n"; print :"<:head>$title\n"; :open :(FILE,"<$head"); @header=; close (FILE); :print :"@header\n"; print "

\n"; print "

\n"; print "

SignUp
Fill out the following :information to get your own redirection :address.

\n"; print "
\n"; :print "

Powered :by:
SpookDirect :v1.0

\n"; print :"

\n"; print "

\n"; print :"

Username:
$url/

\n"; print :"

URL:

\n"; print :"

Password:

\n"; print :"

\n"; print :"

\n"; print :"

\n"; open :(FILE,"<$foot"); @footer=; close (FILE); print :"@footer\n"; print "\n"; } sub :GetFormInput { (*fval) = @_ if @_ ; local ($buf); if :($ENV{'REQUEST_METHOD'} eq 'POST') { :read(STDIN,$buf,$ENV{'CONTENT_LENGTH'}); } else { :$buf=$ENV{'QUERY_STRING'}; } if ($buf eq "") { return :0 ; } else { @fval=split(/&/,$buf); foreach $i (0 .. :$#fval){ ($name,$val)=split (/=/,$fval[$i],2); :$val=~tr/+/ /; $val=~ s/%(..)/pack("c",hex($1))/ge; :$name=~tr/+/ /; $name=~ s/%(..)/pack("c",hex($1))/ge; :if (!defined($field{$name})) { $field{$name}=$val; } :} } return 1; } print "";