Helpful Information
 
 
Category: Project Help Wanted
relatively easy money?

hello,

i have been lurking on this community for some time ;), and have found the tutorials/forums to be excellent.
I do not feel i have sufficient understanding in any of the subjects to become an outspoken member of the community, but would like to extend a genuine offer for work.

I am currently developing an online collaborative music project, which of course has certain copyright issues that need to be addressed.
I am looking for an autonomous script that can run the users' uploading and downloading, and logs these transactions. Perhaps similar to some FTP sites.

I am aware from hacking freeware scripts that this is not the most challenging of offers, and would be interested in any ideas you might have to improve the script, but as a non-profit art project, functionality is our main concern.

If you are genuinely interested and capable, please get in touch with us; info@directionsincollaborativeaudio.org


We are not looking for freebies, and payment will not be an issue.

Thanks in advance


chris

http://www.directionsincollaborativeaudio.org

Fantastic domain by the way!

I'm surprised you couldn't find an open source / free / freeware script of that description knocking about!

thanks!

there are various upload scripts that if emalgamated would do what i require. Unfortunately, i am still learning perl and my code hacking is not good enough to be reliable. This is a major issue for the project.

Essentially, the script needs to;

(i) Parse form data and write to database with date/time, IP, filename etc

(ii) Check if file type is .MP3 and under 1Mb.

(iii) upload file to designated directory.

(iv) email me to alert of new upload

pretty simple i know, but i figure what id be paying for was the reliability.

any input would be appreciated,

thanks again

Contact me and I could whip up a script for ya to do just want ya want to do :)


Jeremy
webmaster@phprank.com

I dont know if i made this clear in previous posts, but im looking for scripts in perl/CGI.
Thanks for getting in touch Jeremy, but PHP is not the best option with my server. If nothing else comes up though, i'll probably be getting back to you 'bout that script ;)

Keep em comin'

Originally posted by the_pedestrian
I dont know if i made this clear in previous posts, but im looking for scripts in perl/CGI.
Thanks for getting in touch Jeremy, but PHP is not the best option with my server. If nothing else comes up though, i'll probably be getting back to you 'bout that script ;)

Keep em comin'

I think we could handle your request guiet nicely. We main program with Perl and using the CGI.pm module would make this a pretty simple task :)

Feel free to contact me and I'd be happy to dicuss this in more detail with you. You may review the many Programming Services (http://www.thunder-rain.com/services/index.html) we offer here.

Look forward to hearing from you soon,

Mike(mickalo)Blezien

How nice...

After such a long time [ infect I think this would be first time ] Someone asking for help and ready to roll out that green bucks instead of that credit, link to your site and other blah blah.

You are going to get GREAT response !! :)
[ my self going to mail you !! ;) :p ]

JD

Hi


Here is a quick script I wrote a long time ago.........

It still works great on win/unix


What it does..............


uploads files............


dis-allow based on............

(TYPE,SIZE)


sends a email, like this to the admin.............


From Sunny@mail.com Sun Jan 06 20:09:20 2002
X-UID32: 1010376562
Return-path: Sunny@mail.com
Received: from 127.0.0.1 by ssl.ya-right.com (SSL SMTPD);
id s20020106200920.150; Sun, 06 Jan 2002 20:09:20
Date: Sun Jan 6 23:09:20 2002 -0500
From: "Sunny" <Sunny@mail.com>
Subject: New Music File Upload
To "Sunny" <Sunny@mail.com>
X-Mailer: <Music Mail Server>
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit

Hi You

New Music File Upload

File Name: bye bye bidie.mp3
Time Uploaded: Sun Jan 6 23:09:20 2002
Remote Host: 127.0.0.1


Write to a database the upload info...........

1,127.0.0.1,Sun Jan 6 23:13:56 2002,img.zip

^^ count,ip,time,file name.....



mail using basic sockets




#!/usr/local/bin/perl

use CGI qw/:standard/;
use CGI::Carp qw/fatalsToBrowser/; ## Carp debugging
$| = 1; ## Flush the open filehandle.

# CHANGE TO WHATEVER.
$title='UPLOAD MUSIC FILES!';

#This is the relative path to the upload directory.
# ./ If you leave it like this, the uploads would be
# placed where this script is (NOT GOOD CHANGE IT).....
$dir='./';

# max KB/b posts. What ever number you place here is the max file size in KB to upload.
$max = 60;

# only upload files with the file.@good in the brackets.
# ie @good = qw(txt html htm asp this that and whatever);
@good = qw(mp3 wav);

# where to log all the upload info.......
$data_file = 'data.log';

# the counter file, to keep an upload count...
$counter = 'count';

# email results info........
$fromuser = 'you@domain.com';
$fromname = 'You';
$touser = 'you@domain.com';
$toname = 'You';
$subject = 'New Music File Upload';

# mail server info....
$server = "localhost";
$LOCALHOST = 'smtp.domain.com';
$SMTP_PORT = '25';
$xmailer = '<Music Mail Server>';

# does the server require AUTH, if yes fill these in
# this is not called unless $use_AUTH = '1';
$use_AUTH = ''; # leave empty no-auth, enter 1 if using auth
# some server allow for plain sent user/pass
# others want it sent as base64
$mail_sender = "smtp_login_username";
$mail_passwd = "smtp_login_pass";

## THAT IT............

$encoding='multipart/form-data';
$match=0;
$CGI::POST_MAX=1024 * $max;
$q = new CGI;
print $q->header();

print $q->start_html(-title=>"$title\n",
-meta=>{'description'=>'Music Upload File System',
'keywords'=>'Music Upload'},
-dtd=>1,
-BGCOLOR=>'white',
-TEXT=>'navy',
-link=>'green',
-vlink=>'red',
-alink=>'blue');

print $q->h1("$title"), "Enter your music file to upload (@good ${max}Kb Max.)\n";
print $q->startform($method,$action,$encoding);
print $q->filefield(-name=>'uploaded_file', -default=>'', -size=>40, -maxlength=>120);
print $q->submit(-name=>'button_name', -value=>'UPLOAD');
print $q->endform;
$filename = $q->param('uploaded_file');
$filename2 = $filename;
$filename2 =~ /\w:[\\[\w- ]*\\]*([\w- ]*.\w{1,3})$/g;
$file=$1;
if ($filename){
foreach $good (@good){
if (grep /$good$/i,$filename){$match=1;print "$file UPLOADED!<BR>\n";
}
}
if ($match){
&upload;
}
else {
&error("File Format is not supported! $file, can not be uploaded!");
}
}

sub upload{
open(OUTFILE, ">$dir$file")||&error("Can't open $dir$file. $!");
binmode OUTFILE;
# binmode for windows. Ignored by unix
while ($bytesread=read($filename,$buffer,1024))
{print OUTFILE $buffer; }
close (OUTFILE);
}
if ($match){
&get_number;
$ip = "$ENV{'REMOTE_ADDR'}";
$timer = localtime();
$data_line = "$num,$ip,$timer,$file";
open (FILE, ">>$data_file") or die "Cannot open $data_file: $!";
flock(FILE,2) or die "cannot lock file: $!";
print FILE "$data_line\n";
close(FILE);
&add_header;
print "Thanks for the new music";
}

sub error{
@error=@_;
print "<H2>@error</H2>";
exit;
}

sub get_number {
open (COUNTER_FILE, "<$counter");
while (<COUNTER_FILE>)
{
$current_counter = $_;
}
close (COUNTER_FILE);

$current_counter++;
$num = $current_counter;
open (FILE, ">$counter");
print FILE "$num";
close (FILE);
return $num;
}

sub add_header {
$header = "Date: $timer -0500\r\n";
$header .= "From: \"$fromname\" <$fromuser>\r\n";
$header .= "Subject: $subject\r\n";
$header .= "To \"$toname\" <$touser>\r\n";
$header .= "X-Mailer: $xmailer\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: text/plain; charset=\"ISO-8859-1\"\r\n";
$header .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$header .= "Hi $toname\n\n";
$header .= "New Music File Upload\n\n";
$header .= "File Name: $file\n";
$header .= "Time Uploaded: $timer\n";
$header .= "Remote Host: $ip\n";
&send_smtp_mail($fromuser, $touser, $subject, $header);
}
sub send_smtp_mail {
use Socket;
my ($iaddr,$paddr,$proto);
my ($from, $to, $subject, $header) = @_;
no strict 'subs';
$iaddr = inet_aton($server);
$paddr = sockaddr_in($SMTP_PORT, $iaddr);
$proto = getprotobyname( 'tcp' );
socket(SOCK, PF_INET, SOCK_STREAM, $proto) or return 0;
connect(SOCK, $paddr) or return 0;
receive_from_server(\*SOCK) or return 0;
send_to_server(\*SOCK, "HELO $LOCALHOST") or return 0;
receive_from_server(\*SOCK) or return 0;
if ($use_AUTH) {
send_to_server(\*SOCK, "AUTH LOGIN") or return 0;
receive_from_server(\*SOCK) or return 0;
send_to_server(\*SOCK, "$mail_sender") or return 0;
receive_from_server(\*SOCK) or return 0;
send_to_server(\*SOCK, "$mail_passwd") or return 0;
receive_from_server(\*SOCK) or return 0;
}
send_to_server(\*SOCK, "MAIL From: <$from>") or return 0;
receive_from_server(\*SOCK) or return 0;
send_to_server(\*SOCK, "RCPT To: <$to>") or return 0;
receive_from_server(\*SOCK) or return 0;
send_to_server(\*SOCK, "DATA") or return 0;
receive_from_server(\*SOCK) or return 0;
send_to_server(\*SOCK, "$header\r\n.") or return 0;
receive_from_server(\*SOCK) or return 0;
send_to_server(\*SOCK, "QUIT") or return 0;
receive_from_server(\*SOCK) or return 0;
close(SOCK) or return 0;
return 1;
}

sub send_to_server {
my($socket) = shift;
my($message) = shift;
send($socket, "$message\r\n", 0) or return 0;
return 1;
}
sub receive_from_server {
my($socket) = shift;
my($reply);
while($reply = <$socket>) {
return 0 if $reply =~ /^5/;
last if $reply =~ /^\d+ /;
}
return 1;
}

print "<br><br>\n";
print $q->
hr({-width=>'90%',-size=>3,-style=>'raised'}),
p({-align=>CENTER},'Upload music services by ',
a({-href=>'http://music-world.com/'},'Music World')
);
print "</body></html>\n";

exit;




F!

Ugh. There's no file locking so you'd have a real problem with concurrent users, most likely wiping data from your DB under any sort of load.

Hi

what do you mean?, there is a file lock when writing to the database....


F!

Not when you get the number. Everything that accesses a file has to respect the lock, otherwise you're going to run into a potential race condition or garbage data.

Locking shouldn't only be done for writes, it has to be done for all file accesses.

What if your "get number" sub opens the file, without respecting the lock, while the write sub is trying to write to it? It might work most of the time, but sometimes, and inexplicably, you'd get garbage. This is a major problem down the road especially if you're doing computations on data from an unlocked data file. You could end up with garbage computations as well.

File locking is trickier than it seems. What if you write another reporting script to access the data that doesn't respect the lock? You could run into the garbage data issue again.

File locking and data integrity has to be approached holistically, that's why I advise most folks to use MySQL for "collect and report" type applications- it's easier, once you learn a little about DBI. It's also more powerful.

I agree completely, Hero.

You got to take care of this issue, specially in web based application , cause there will be always simultaneous requests.

JD

P.S. : I guess you can reply to my last PM. ;)

Hi

First off I wrote it a long time ago, and it was used just for personal use.......


Secondly, I put it here so the person who made a request for a script like this, may/might find it useful as a starting point. Is not what this BB all about.


True I did not put a lock on the $num return file, and that is because I added it quickly to my old upload routine, so that I could give a simple example on how to do what he/she wanted done....


So to you =>H<=, it may have be a mistake, but to me, I just plain forgot to add it.....


Also to you =>H<=, unlike you, shown by your past actions, where you would rather be rude than say, hey (person) you forgot something, or you can do it like this also. I would never be like you, in fact the only time I would be rude, is when someone is rude to me, without letting me explain (why!)




F!

I'm sorry that you interpreted my directness as rudeness, I didn't mean to ruffle your feathers. Re-reading this thread I don't particularly see where I was rude, beyond the fact that I pointed out an oversight.

I just like that when someone is aware of the limitations of themselves and their applications that they are direct with them. I'd just hate for someone to use the code above in a production application.

Ugh that is a nasty looking script just to do a file upload. Should have used PHP for that simple of a web app.

Honestly, it's easy to do a clean reading upload script with perl too. As Fataqui said, this was done a while ago, presumably while in newbieland.

It's funny that the better coder you are, the shorter your code is.

Hi.....


What makes me laugh, is that all of you have something to say, but none of you, have written an example of how you would do it. As I said this is a old script, but even old it is a (WORKING) example, it's my way to help someone, maybe learn something, if you don't like it, then write your own and post it here, so you help this person out! Although I understand my script is old and there are easier ways to do things today, but think about what I wrote, it teaches/shows many different things..........

How to upload a file

How to write to a file

How to send mail with _AUTH via sockets

How it create a simple header with cgi.pm

How to create a simple form with cgi.pm


You see I come here to help others when I can, I don't hangout here, I do have a life unlike some people, who fall a sleep in there chairs, because they think they might miss a post that they can tell someone that their way is better... hehehe!!!


Listen all of us were not born good at what we do, "It takes time to learn, and even when you think you have learned all that you can, you will find you still know very little! Many people come here for just bits of code or because they want to learn, so replying to a post 9 out of 10 times helps others more than the person who posted that given topic. So in closing say whatever you like, because I really don't care, for I am not here to listen to "your I think I know it all" replies!



nothing more.......


Sorry wrong forum!


F!

It's pretty obvious that you do care. Don't get so defensive, people are just trying to help you out, too.

This guy is looking for code to run on a live site that can't have any little problems like the ones pointed out.

You posted something more along the lines of "This may not be exactly what you're looking for, but it may give you an idea"

---John Holmes...

hello all,

it seems there has been quite some activity caused by our little offer ;)

Some of you that had emailed privately had asked to be told who actually got the job.
For your interest, we are working with Herozzyzzx on this project. His enthusiasm for the subject matter and obvious thorough knowledge, was well tempered with a casual and honest personality.
It is not an easy decision to make, when email is the only source of reference, but Im sure most of you are aware of the name, as he appears to be quite an active member of this community.

Of course, it could all be social engineering ;)

Finally, we just want to add that we were surprised by posts saying offers of paid work was not common within the community - usually just for reprocial links, credits etc.
For those of you that visited our site, you will see we are interested in developing a productive internet community that has real world impact OUTSIDE of the internet. This is why we chose to ask another internet community to work with us, as opposed to asking a local programmer.
The combined knowledge base at Dev Shed would put any overpaid individual coder to shame....
...This is what makes the internet so powerful, no?

If all goes well, this will not be the last time we make such an offer - were not going to make anyone rich, but this is surely the next small step for the internet - such awesome technology is wasted in international gossip collumns and high "content" adverts.

thanks for all the input, and especially thanks to Fataqui, we are grateful for the unselfish gesture.
However, what we were looking for needs to be sound under a heavy load. Also, it may be required for legal reasons, so a reliable, custom design was pretty much essential.


Cheers to everyone who contributed, and thanks again for all the tutorials etc that broaden my limited knowledge,


overandout

http://www.directionsincollaborativeaudio.org

Ugly - TRUE, but the_pedestrian has already said that php isn't an option on his webserver and he has to use PERL -

But I challenge anyone (esp the_pedestrian) to suggest why it wouldn't make more sense just to install php and be done with it... ! The script could be a fraction of the size.










privacy (GDPR)