Hello,

what is causing the renamed file to take permissions of 755
instead of 644? -- am I doing this correctly -- there will be only one user
of the script .. do I need 'file lock' here?

Thanks to Bob Showalter for the formatting info on 'strftime'

"man 3c strftime" --> http://www.cs.princeton.edu/cgi-bin/man2html?strftime:3C


cold:~/cgi$ ls -l gi*
-rw-r--r--   1 dowda    webusers      351 Nov  9 11:11 gigs.dat
-rwxr-xr-x   1 dowda    webusers      394 Nov  8 15:46 gigs.dat.old*


One final thought what can I do prevent one from going to straight to the following,
user normally would not go to this script, or am I being paranoid?
thx,
Dave

------------------------------

#!/usr/bin/perl 

use CGI qw/:standard/;
use CGI::Carp qw(fatalsToBrowser);
use POSIX 'strftime';
use strict;
my (@gigs,$line,$gig_num);
my $data_file = 'gigs.dat';



# Create a 'last updated time stamp'
push (@gigs,strftime('%A, %B %1d, %Y %I:%M %p',localtime));

# how many records...
my $rows = param('rows');
$gig_num =0;

#get all records from the web page

while  ($gig_num < $rows ){
my $gig = param("date$gig_num") . '|' . param("time$gig_num") . '|' . 
param("event$gig_num") . '|' . param("place$gig_num") . '|' . param("city$gig_num") . 
"\n";
push (@gigs,$gig)  unless param("$gig_num");
$gig_num++;
}


rename($data_file, "$data_file.old");

# open for writing 
open(OUT,">$data_file") or die "Can't write to $data_file $!\n";

foreach my $line (@gigs){
#chomp $line;
print OUT $line;

}  


if (param('action') eq 'Add to Schedule' ){

$line = "\n" . param('date') . '|' . param('time') . '|' . param('event') . '|' . 
param('place') . '|' . param('city');
print OUT $line;
}


close (OUT);
print  redirect("edit_schedule.pl");
exit;

__END__


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to