Noticed a few people been wanting an add confirm mod which they've said is not avaiable. Here's a quick way to have a confirmation window appear before the link is added.
First go into add.html:
Replace:
<form action="<%db_cgi_url%>/add.cgi" method="POST">
With:
<form action="<%db_cgi_url%>/add.cgi" method="GET">
<input type = "hidden" name= "confirm" value = "yes">
Then open add.cgi and replace the whole of sub main with:
sub main {
# --------------------------------------------------------
local (%in) = &parse_form;
# We are processing the form.
if (keys %in != 0) {
my ($link, $link_output);
if (($ENV{'HTTP_REFERER'} =~ m,$build_root_url/(.+?)/?$,) and $in{'confirm'}) {
$link_output .= &site_html_link (%in) . "\n";
$link = $ENV{'QUERY_STRING'};
$link =~ s/&confirm=yes//;
print "Content-type: text/html\n\n";
print qq|
<html>
<head>
<title>Confirm details</title>
</head>
<body>
$link_output
Click <a href = "$db_cgi_url/add.cgi?$link">HERE</a>to confirm these details
</body>
</html>
|;
}
else{
&process_form;
}
}
# Otherwise we are displaying the form (in site_html.pl).
else {
if ($db_single_category) {
my %is_valid = map { $_ => 1 } &category_list;
$ENV{'HTTP_REFERER'} =~ s,/[^/]+\.[^/]+$,,;
$ENV{'HTTP_REFERER'} =~ m,$build_root_url/(.+?)/?$,;
$is_valid{$1} ? &site_html_add_form ($1) : &site_html_add_form ();
}
else {
&site_html_add_form ();
}
}
}
Glenn
Links 2 Mods Site:
http://cgi-resource.co.uk/pages/links2mods.shtml
First go into add.html:
Replace:
<form action="<%db_cgi_url%>/add.cgi" method="POST">
With:
<form action="<%db_cgi_url%>/add.cgi" method="GET">
<input type = "hidden" name= "confirm" value = "yes">
Then open add.cgi and replace the whole of sub main with:
sub main {
# --------------------------------------------------------
local (%in) = &parse_form;
# We are processing the form.
if (keys %in != 0) {
my ($link, $link_output);
if (($ENV{'HTTP_REFERER'} =~ m,$build_root_url/(.+?)/?$,) and $in{'confirm'}) {
$link_output .= &site_html_link (%in) . "\n";
$link = $ENV{'QUERY_STRING'};
$link =~ s/&confirm=yes//;
print "Content-type: text/html\n\n";
print qq|
<html>
<head>
<title>Confirm details</title>
</head>
<body>
$link_output
Click <a href = "$db_cgi_url/add.cgi?$link">HERE</a>to confirm these details
</body>
</html>
|;
}
else{
&process_form;
}
}
# Otherwise we are displaying the form (in site_html.pl).
else {
if ($db_single_category) {
my %is_valid = map { $_ => 1 } &category_list;
$ENV{'HTTP_REFERER'} =~ s,/[^/]+\.[^/]+$,,;
$ENV{'HTTP_REFERER'} =~ m,$build_root_url/(.+?)/?$,;
$is_valid{$1} ? &site_html_add_form ($1) : &site_html_add_form ();
}
else {
&site_html_add_form ();
}
}
}
Glenn
Links 2 Mods Site:
http://cgi-resource.co.uk/pages/links2mods.shtml