#!/usr/bin/perl do "/usr/lib/horia-lib.pl"; use Cwd; &parse_cgi_params; print "Content-type: text/html\n\n"; #--------------------------------------------- citeste config din config.txt if ($ARGV[0] eq 'init') { $cmd = 'touch urls.log; chmod 666 urls.log'; print "$cmd\n"; system($cmd); print "\n"; $cmd = 'touch modif.log; chmod 666 modif.log'; print "$cmd\n"; system($cmd); print "\n"; $cmd = 'touch erase.log; chmod 666 erase.log'; print "$cmd\n"; system($cmd); print "\n"; exit; } $crt_domain = &getcwd; $crt_domain =~ s|^.*/||g; $f_config = "/work/scripts/submitter/mailing-$crt_domain/info.txt"; $f_config = "config.txt" if (!(-f $f_config)); open F, $f_config; while ($line = ) { $line =~ s|[\n\r]||g; if ($line =~ /=/) { $line =~ s|#.*$||; my ($var, $val) = split(/=/, $line, 2); $CONF{$var} = $val; } } close(F); $CONF{'Servername'} = $CONF{'servername'}; substr($CONF{'Servername'},0,1) = uc(substr($CONF{'Servername'},0,1)); my $dom = $ENV{'SERVER_NAME'}; $dom =~ s|^www\.||g; my $home = "/www/$dom"; $html = &cat("$home/sys_template.html"); $html =~ s|.*?| |gsi; $html =~ s|Add your site|Add your site|gsi; if (!(defined $FORM{"url"})) { $form = &cat("$home/sys_form.html"); $form =~ s||$CONF{'servername'}|g; $html =~ s||$CONF{"servertitle"} - Submit a link|g; $html =~ s||$form|g; print $html; exit; } sub print_error_html { my ($errmsg) = @_; $html =~ s||$CONF{'servertitle'} - Submit a link - Error|g; $html =~ s||
$errmsg

Please press the Back button in your browser and modify the incorrect data.

|g; print $html; } if ($FORM{"url"} eq "") { print_error_html("Please enter your URL!"); exit; } if ($FORM{"url"} eq "http://" || $FORM{"url"} !~ /^http:\/\//i) { print_error_html ("Error: Incorrect URL"); exit; } if ($FORM{"title"} eq "" && $CONF{"notitle"} eq "") { print_error_html ("Error: Missing title"); exit; } if ($FORM{"description"} eq "" && $CONF{"nodescription"} eq "") { print_error_html ("Error: Missing description"); exit; } if ($FORM{"keywords"} eq "" && $CONF{"nokeywords"} eq "") { print_error_html ("Error: Missing keywords"); exit; } if ($FORM{"email"} eq "" && $CONF{"noemail"} eq "") { print_error_html ("Error: Incorrect email"); exit; } if (!&check_email($FORM{"email"}) && $CONF{"noemail"} eq "") { print_error_html ("You have not entered a valid email"); exit 1; } $email = $FORM{"email"}; $in = int `tail -1 urls.log`; #id $in++; $FORM{"keywords"} =~ s/\r//g; $FORM{"keywords"} =~ s/\n/,/g; $FORM{"description"} =~ s/\/>/g; $FORM{"title"} =~ s/\/>/g; $FORM{"url"} =~ s/\/>/g; $FORM{"description"} =~ s/"//g; $FORM{"title"} =~ s/"//g; $FORM{"url"} =~ s/"//g; ($tsec,$tmin,$thour,$tmday,$tmon,$tyear,$twday,$tyday,$tisdst) = gmtime(time+3*3600); $tyear += 1900; $tmon += 1; $domain = $FORM{"url"}; $domain =~ s/^http:\/\///; $domain =~ s/^www\.//; $domain =~ s/\/.*$//; open LOG, ">>urls.log"; $content = $in."|".$FORM{"url"}."|".$FORM{"title"}."|".$FORM{"description"}."|". $FORM{"linkurl"}."|".$FORM{"email"}."|".$FORM{"keywords"}."|$tyear:$tmon:$tmday|$thour:$tmin"; $content =~ s/\r//g; $content =~ s/\n/\ /g; print LOG $content . "\n"; close LOG; $kw = $FORM{"site"}; $kw =~ s/\ /-/g; $kw =~ s/-Resources$//gi; $title = $CONF{"servername"}; $kwlower = lc($kw); $registration_respose_html .= <<"(END)";
Your site has been submitted to $CONF{'servername'}
$CONF{'message1'}
Here is our reciprocal linking information:

URL: http://www.$CONF{'servername'}/
Description: $CONF{'linktext'}

or just cut & paste this HTML


<a href="http://www.$CONF{'servername'}/">$CONF{'servertitle'} - $CONF{'linktext'}</a>



Thank you!

$str
(END) ################################# $html =~ s||$CONF{"servertitle"} - Submit a link|g; $html =~ s||$registration_respose_html|g; print $html; ################################# if (&check_email($email)) { my $mail = <<"(END)"; From: "$CONF{'fullname'}" <$CONF{'confirm'}> To: $FORM{"email"} Content-type: text/html Subject: $CONF{'servertitle'} link confirmation - $domain Thank you for submitting your website to $CONF{'servername'}. We will update our website in the next few hours.

Please add a link to $CONF{'servername'}, if you consider it useful to your visitors. Here is an example:

--CUT--

<a href="http://www.$CONF{'servername'}/">$CONF{'Servername'} - $CONF{'linktext'}</a>

--CUT--

Thank you.

Regards,
$CONF{'fullname'}. (END) open SENDMAIL, "|sendmail $email" or print "Problem sending email:$!
\n"; print SENDMAIL $mail; close SENDMAIL; }