freelanceprogrammers.org Forum Index » Perl

Need help with script


View user's profile Post To page top
czernyman Posted: Tue Jul 13, 1999 7:45 pm


Joined: 13 Jul 1999

Posts: 2
Need help with script
I am trying to make a script that will log the
use of an audio file, and then read and return it. I
can`t get this to work. I`ve done a lot of different
things to get it to work, but they are useless. It might
have somthing to do with the script print location
instead of the file, but I don`t really know how to print
the file. I can`t use the foreach loop I think
because it would print the lines in random order. And,
the files are on a totally different server, so I
don`t think I can read them. Anyway, this is the code I
have now:<br><br><br>#!/usr/bin/perl<br><br>#get query
string<br>@values = split(/&/,$ENV{`QUERY_STRING`});<br>foreach $i
(@values) {<br>($varname, $mydata) =
split(/=/,$i);<br>$FORM{$varname} = $mydata;<br>}<br><br>#get the
date<br>shortdate
= `date +"%D %T
%Z"`;<br>chop($shortdate);<br><br>#enter into captian`s
log<br>open(OUTF,"&gt;&gt;midi.db") or &dienice("Couldn`t open file for writing.
Please notify mts-iscool@juno.com.");<br>print OUTF
"Date: $shortdate|File: $FORM{`file`}|Extension:
$FORM{`type`}";<br>close(OUTF);<br><br>#grab
file<br>open(INF,"&lt;$FORM{`file`}") or
&dienice("Couldn`t open $FORM{`file`} for reading. Please notify
mts-iscool@juno.com.");<br>@data = &lt;INF&gt;;<br>close(INF);<br><br>#print
mime<br>print "Location:$FORM{`file`}

";<br><br>sub dienice
{<br>($msg) = @_;<br>print
"Content-type:text/html

";<br>print "&lt;h2&gt;Error&lt;/h2&gt;
";<br>print
$msg;<br>exit;<br>}
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
China Wholesale - Electronics Products
Character Studio - Tutorials and Help