Ok here we go - there are quite a few changes you need to make:
1) Open add_spider.cgi and replace sub get_url with:
Code:
sub get_url {
use LWP;
use LWP::Simple;
my ($url,$new,$page,@rest,$desc,$ref);
$url = $IN->param('url');
$ref = $IN->param('ref');
&site_html_add_spider_error("Your URL should begin with http://") and return unless ($url =~ /^http:\/\//);
&site_html_add_spider_error("Please enter your full URL") and return unless ($url =~ /^http:\/\/(.+\.)?.+\..+/);
$new = LWP::UserAgent->new();
$new->agent("Cyberwhispers");
$page = $new->request(HTTP::Request->new(GET => $url));
@rest = get($url);
foreach (@rest) {
if ($_ =~ m#.*?<meta([^\>]*?)(name|http-equiv)="?description"?([^\>]*?)(content|value)="?([^\"]+)"?#i) {
$desc = $5;
}
}
if ($page->is_success) {
if ($db_single_category) {
my %is_valid = map { $_ => 1 } &category_list;
$ref =~ s,/[^/]+\.[^/]+$,,;
$ref =~ m,$build_root_url/(.+?)/?$,;
&rand_img;
&set_cookie($rand);
$is_valid{$1} ? &site_html_add_form ($page->title,$url,$desc,$1) : &site_html_add_form($page->title,$url,$desc);
} else {
&rand_img;
&set_cookie($rand);
&site_html_add_form($page->title,$url,$desc) and return;
}
} else {
&site_html_add_spider_error("Unreachable host") and return;
}
}
Then in site_html_templates.pl in sub site_html_add_form replace:
Code:
my ($ttl,$url,$desc) = @_;
with:
Code:
my ($ttl,$url,$desc,$category) = @_;
Replace sub site_html_add_spider_form with:
Code:
sub site_html_add_spider_form {
# --------------------------------------------------------
# This routine determines how the add form page will look like.
#
&html_print_headers;
my ($ref) = shift;
print &load_template ('add_spider.html', {
ref => $ref,
%globals
});
}
Then in add_spider.html add the following hidden field:
<input type="hidden" name="ref" value="<%ref%>">
That should do the trick. Let me know if you get stuck.
Installs:
http://wiredon.net/gt FAQ:
http://www.perlmad.com