yolanda/trunk/functions.pl
josch 6a62362820 further improvements to login
git-svn-id: http://yolanda.mister-muffin.de/svn@15 7eef14d0-6ed0-489d-bf55-20463b2d70db
2007-10-10 16:05:54 +00:00

24 lines
702 B
Perl

require "/var/www/perl/include.pl";
sub fill_tagcloud {
$dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass);
my $sth = $dbh->prepare(qq{select text, count from tagcloud });
$sth->execute();
while (my ($text, $count) = $sth->fetchrow_array())
{
push @{ $page->{tagcloud}->{tag} }, { text => [$text], count => [$count] };
}
$sth->finish();
$dbh->disconnect();
}
sub get_username_from_sid {
my ($sid) = @_;
$dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass);
my $sth = $dbh->prepare(qq{select username from users where sid = '$sid'});
$sth->execute();
my ($username) = $sth->fetchrow_array();
$sth->finish();
$dbh->disconnect();
return $username;
}