Gossamer Forum
Home : Products : DBMan : Discussions :

Re: subs to include file don't work ;(

Quote Reply
Re: subs to include file don't work ;( In reply to
Hi Karen,

Here's the code from db.cgi and html.pl with a few extra lines above and below the additions:



Code from db.cgi

eval { &main; }; # Trap any fatal errors so the program hopefully
if ($@) { &cgierr("fatal error: $@"); } # never produces that nasty 500 server error page.

# Stop the timer and print.
if ($db_benchmark) { $t1 = new Benchmark; print "<h6>Processing Time: " . timestr(timediff($t1, $t0)) . "</h6>"; }

# Display debugging information if requested.
&cgierr("Debug Information") if ($db_debug);

exit; # There are only two exit calls in the script, here and in in &cgierr.

######################################################
##### Added this sub to include files from html.pl
######################################################
sub Insert_myfile {
open(FILE, "/nieuwsberichten/nieuwsberichten/test.txt") or die("Couldn't open the file.");
@lines = <FILE>;
close(FILE);
foreach $line (@lines) {
print $line;
}
}
#################### end include sub #################

sub main {
# --------------------------------------------------------
my ($status, $uid);
local($per_add, $per_view, $per_mod, $per_del, $per_admin);

$|++; # Flush Output Right Away

&auth_cleanup unless ($auth_no_authentication); # Remove old session files.

($status, $uid, $per_view, $per_add, $per_del, $per_mod, $per_admin)
= &auth_check_password; # Authenticate User, get permissions and userid.

if ($status eq "ok") {
# Set the script link URL with db and user info for links. Use $db_script_url for forms.
$db_script_link_url = "$db_script_url?db=$db_setup&uid=$db_uid";
if ($uid eq "default") { $db_userid = $uid; }
else { ($db_userid) = $db_uid =~ /([A-Za-z0




Code from html.pl




sub html_home {
# --------------------------------------------------------
# The database manager home page.

&html_print_headers;
print qq|
<html>
<head>$css
<title>$html_title: Hoofdmenu.</title>
</head>

<body bgcolor="#ffffff" marginheight="0" topmargin="0" leftmargin="0" marginwidth="0">$top_html
<table border=0 bgcolor="#FFFFFF" cellpadding=0 cellspacing=0 valign=top>
<tr><td colspan=2 >
<FONT FACE="Verdana, arial,helvetica">
<b>$html_title: Hoofdmenu</b>
</td></tr>
<tr><td>
<p><center><$font_title><b>
Main Menu
</b></font></center>

<font face="verdana,arial,helvetica" size="1">

######################################################
##### Added this call to sub Insert_file from db.cgi
######################################################
<b>|; &Insert_myfile;print qq|
###################### That's all ####################

Gebruikersniveau: |;
print " Browsen " if ($per_view);
print " Toevoegen " if ($per_add);
print " Verwijderen " if ($per_del);

Thanks a lot!
Byebye
Gil
Subject Author Views Date
Thread subs to include file don't work ;( Gilmarim 3425 Feb 9, 2001, 12:37 PM
Thread Re: subs to include file don't work ;(
Karen 3351 Feb 9, 2001, 1:02 PM
Thread Re: subs to include file don't work ;(
Gilmarim 3356 Feb 9, 2001, 1:07 PM
Thread Re: subs to include file don't work ;(
Karen 3348 Feb 9, 2001, 1:20 PM
Thread Re: subs to include file don't work ;(
Gilmarim 3338 Feb 9, 2001, 4:09 PM
Thread Re: subs to include file don't work ;(
Karen 3345 Feb 9, 2001, 5:45 PM
Post Re: subs to include file don't work ;(
Gilmarim 3310 Feb 10, 2001, 11:19 AM