umm.. ok
[jump.cgi]
FIND:
Code:
require "admin/links.cfg"; # Change this to full path to links.cfg if you have problems.
require "$db_lib_path/db_utils.pl";
require "$db_lib_path/links.def";
BELOW ADD:
Code:
$build_use_templates ?
require "$db_lib_path/site_html_templates.pl" :
require "$db_lib_path/site_html.pl";
FIND:
Code:
if ($id eq "random") {
my ($count, $rand, $find);
# Pull out the total number of links.
open (COUNT, "<$db_hits_path/index.count") or &error ("unable to open index count file: $db_hits_path/index.count. Reason: $!");
$count = int <COUNT>;
close COUNT;
# Get the random line from the url lookup database.
srand;
$find = 0; $rand = int (rand ($count + 0.5)); ($rand == $count) and ($rand--);
open (URL, "<$db_url_name") or &error ("unable to open url database: $db_url_name. Reason: $!");
while (<URL> ) {
$find++ == $rand or next;
/\d+$delim(.+)/o or next;
$goto = $1;
last;
}
close URL;
$goto or &error ("Can't find random line: $rand.");
}
UNDER ADD:
Code:
elsif ($in{'display'}) {
my (%rec) = &get_record ($in{$db_key});
($rec{$db_key} eq $in{$db_key}) ?
&site_html_jump_display (%rec) :
&error ("Unkown Link ID: $in{$db_key}");
exit;
}
FIND:
Code:
/\d+$delim(.+)/o or next;
$goto = $1;
CHANGE TO:
Code:
/(\d+)$delim(.+)/o or next;
($id, $goto) = ($1, $2);
####################################
IF YOU WANT TO USE YOUR RATING TEMPLATES AS THE TOP HEADER, SKIP THE NEXT STEPS AND GO TO THE NEXT MESSAGE
####################################
FIND:
Code:
# Now let's send the user to the url..
$goto ?
print "Location: $goto\n\n" :
&error ("Record not found ($in{$db_key})");
CHANGE TO:
Code:
# Now let's send the user to the url..
($goto) or &error ("Record not found ($in{$db_key})");
my (%rec) = &get_record ($id);
print "Content-type: text/html\n\n";
print qq~<html>
<head><title>$rec{'Title'}</title></head>
<body>
<frameset rows="70,*">
<frame name="top" src="$build_jump_url?ID=$id&display=1" marginwidth="10" marginheight="10" scrolling="no" frameborder="no">
<frame name="bottom" src="$goto" marginwidth="10" marginheight="10" scrolling="auto" frameborder="no">
</frameset>
</body>
</html>~;
IF YOU USE TEMPLATES:
[site_html_templates.pl]
ADD THIS (above the 1; on the bottom):
Code:
sub site_html_jump_display {
my (%rec) = @_;
&html_print_headers;
print &load_template ('jump_display.html', {
%rec,
%globals
});
}
NEW TEMPLATE IN TEMPLATE FOLDER: jump_display.html
Code:
<html>
<head>
<title><%Title%></title>
</head>
<body>
Link: <%Title%>
Oh my gosh! look.. you can rate the link!!<p>
<form action="<%db_cgi_url%>/rate.cgi" method="POST">
<input type=hidden name="ID" value="<%ID%>">
<select name=rate>
<option>---
<option>1
<option>2
<option>3
<option>4
<option>5
<option>6
<option>7
<option>8
<option>9
<option>10
</select>
<input type=submit value="Rate this Link">
</form>
</body>
</html>
OTHERWISE, IF YOU DON'T USE TEMPLATES:
[site_html.pl]
ADD THIS (above 1; at the bottom):
Code:
sub site_html_jump_display {
my (%rec) = @_;
$output = qq~<html>
<head>
<title>$rec{'Title'}</title>
</head>
<body>
Link: $rec{'Title'}
Oh my gosh! look.. you can rate the link!!<p>
<form action="<%db_cgi_url%>/rate.cgi" method="POST">
<input type=hidden name="ID" value="$rec{$db_key}">
<select name=rate>
<option>---
<option>1
<option>2
<option>3
<option>4
<option>5
<option>6
<option>7
<option>8
<option>9
<option>10
</select>
<input type=submit value="Rate this Link">
</form>
</body>
</html>~;
return $output;
}
[This message has been edited by widgetz (edited September 11, 1999).]