usr bin perl use DBI my dsn DBI mysql uploader my db_username user my

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/perl
use DBI;
my $dsn='DBI:mysql:uploader';
my $db_username='user';
my $db_password='pass';
my $con = DBI->connect($dsn,$db_username,$db_password) or die;
# AUTHD_ACCOUNT
# AUTHD_PASSWORD
my $login=$ENV{"AUTHD_ACCOUNT"};
my $pass=$ENV{"AUTHD_PASSWORD"};
my $query = $con->prepare(qq{SELECT id FROM users WHERE login='$login' AND password=MD5('$pass')});
#open(STDOUT,'>',"/tmp/loglog");
$query->execute();
if (my @row=$query->fetchrow_array())
{
my $id=$row[0];
print "auth_ok:1\n";
print "uid:500\n";
print "gid:500\n";
print "dir:/tmp/ftpzone/$id\n";
}
else
{
print "auth_ok:0\n";
}
print "end\n";
close(STDOUT);