initial version
git-svn-id: http://yolanda.mister-muffin.de/svn@6 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
parent
df9ee61939
commit
3cae15be76
3 changed files with 41 additions and 0 deletions
12
trunk/functions.pl
Normal file
12
trunk/functions.pl
Normal file
|
@ -0,0 +1,12 @@
|
|||
sub fill_tagcloud {
|
||||
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();
|
||||
}
|
||||
|
||||
1;
|
4
trunk/include.pl
Normal file
4
trunk/include.pl
Normal file
|
@ -0,0 +1,4 @@
|
|||
use CGI::Session;
|
||||
use DBI;
|
||||
use XML::Simple qw(:strict);
|
||||
$dbh = DBI->connect('DBI:mysql:gnutube:localhost', 'root', '');
|
25
trunk/index.pl
Normal file
25
trunk/index.pl
Normal file
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/perl
|
||||
require "/var/www/perl/include.pl";
|
||||
require "/var/www/perl/functions.pl";
|
||||
|
||||
#create or resume session
|
||||
CGI::Session->name("SID");
|
||||
my $session = new CGI::Session;
|
||||
|
||||
#store session param
|
||||
$session->param('auth', 'true');
|
||||
|
||||
#read xml
|
||||
$page = XMLin('/var/www/perl/index.xml', ForceArray => 1, KeyAttr => {} );
|
||||
|
||||
#fill tags
|
||||
$page->{sid} = [$session->id];
|
||||
$page->{loggedin} = [$session->param('auth')];
|
||||
|
||||
fill_tagcloud;
|
||||
|
||||
#print xml http header along with session cookie
|
||||
print $session->header(-type=>'text/xml');
|
||||
|
||||
#print xml
|
||||
print XMLout($page, KeyAttr => {}, XMLDecl => '<?xml version="1.0" encoding="ISO-8859-1" ?><?xml-stylesheet type="text/xsl" href="./xsl/xhtml.xsl" ?>', RootName => 'page');
|
Loading…
Reference in a new issue