removed referer
git-svn-id: http://yolanda.mister-muffin.de/svn@294 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
parent
5ab40cbe8e
commit
a70d143ad7
3 changed files with 1 additions and 67 deletions
|
@ -14,29 +14,6 @@ if($query->param('id'))
|
||||||
|
|
||||||
if(($title) = $sth->fetchrow_array())
|
if(($title) = $sth->fetchrow_array())
|
||||||
{
|
{
|
||||||
#if referer is not the local site update referer table
|
|
||||||
$referer = $query->referer() or $referer = '';
|
|
||||||
if($referer !~ /^$domain/)
|
|
||||||
{
|
|
||||||
#check if already in database
|
|
||||||
$sth = $dbh->prepare(qq{select 1 from referer where videoid = ? and referer = ? }) or die $dbh->errstr;
|
|
||||||
my $rowcount = $sth->execute($query->param('id'), $referer) or die $dbh->errstr;
|
|
||||||
$sth->finish() or die $dbh->errstr;
|
|
||||||
|
|
||||||
if($rowcount > 0)
|
|
||||||
{
|
|
||||||
#video is in database - increase referercount
|
|
||||||
$dbh->do(qq{update referer set count=count+1 where videoid = ? and referer = ? },
|
|
||||||
undef, $query->param('id'), $referer) or die $dbh->errstr;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#add new referer
|
|
||||||
$dbh->do(qq{insert into referer (videoid, referer) values (?, ?) },
|
|
||||||
undef, $query->param('id'), $referer) or die $dbh->errstr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#are we only watching this video or downloading it?
|
#are we only watching this video or downloading it?
|
||||||
if($query->param('view'))
|
if($query->param('view'))
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,8 +14,6 @@ $dbh->do(qq{drop table uploaded});
|
||||||
|
|
||||||
$dbh->do(qq{drop table tagcloud});
|
$dbh->do(qq{drop table tagcloud});
|
||||||
|
|
||||||
$dbh->do(qq{drop table referer});
|
|
||||||
|
|
||||||
$dbh->do(qq{drop table comments});
|
$dbh->do(qq{drop table comments});
|
||||||
|
|
||||||
$dbh->do(qq{create table
|
$dbh->do(qq{create table
|
||||||
|
@ -113,15 +111,6 @@ $dbh->do(qq{create table
|
||||||
)
|
)
|
||||||
}) or die $dbh->errstr;
|
}) or die $dbh->errstr;
|
||||||
|
|
||||||
$dbh->do(qq{create table
|
|
||||||
referer
|
|
||||||
(
|
|
||||||
videoid int not null,
|
|
||||||
referer varchar(255) not null,
|
|
||||||
count int default 1
|
|
||||||
)
|
|
||||||
}) or die $dbh->errstr;
|
|
||||||
|
|
||||||
$dbh->do(qq{create table
|
$dbh->do(qq{create table
|
||||||
comments
|
comments
|
||||||
(
|
(
|
||||||
|
|
|
@ -90,27 +90,6 @@ if($query->url_param('id'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if referer is not the local site update referer table
|
|
||||||
$referer = $query->referer() or $referer = '';
|
|
||||||
if($referer !~ /^$domain/)
|
|
||||||
{
|
|
||||||
#check if already in database
|
|
||||||
$sth = $dbh->prepare(qq{select 1 from referer where videoid = ? and referer = ? }) or die $dbh->errstr;
|
|
||||||
my $rowcount = $sth->execute($id, $referer) or die $dbh->errstr;
|
|
||||||
$sth->finish() or die $dbh->errstr;
|
|
||||||
|
|
||||||
if($rowcount > 0)
|
|
||||||
{
|
|
||||||
#video is in database - increase referercount
|
|
||||||
$dbh->do(qq{update referer set count=count+1 where videoid = ? and referer = ? }, undef, $id, $referer) or die $dbh->errstr;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#add new referer
|
|
||||||
$dbh->do(qq{insert into referer (videoid, referer) values (?, ?) }, undef, $id, $referer) or die $dbh->errstr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#before code cleanup, this was a really obfuscated array/hash creation
|
#before code cleanup, this was a really obfuscated array/hash creation
|
||||||
push @{ $page->{'video'} },
|
push @{ $page->{'video'} },
|
||||||
{
|
{
|
||||||
|
@ -193,17 +172,6 @@ if($query->url_param('id'))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#get referers
|
|
||||||
$sth = $dbh->prepare(qq{select count, referer from referer where videoid=?}) or die $dbh->errstr;
|
|
||||||
$sth->execute($id) or die $dbh->errstr;
|
|
||||||
while (my ($count, $referer) = $sth->fetchrow_array())
|
|
||||||
{
|
|
||||||
$referer or $referer = 'no referer (refreshed, manually entered url or bookmark)';
|
|
||||||
push @{ $page->{'referers'}->{'referer'} }, {
|
|
||||||
'count' => $count,
|
|
||||||
'referer' => $referer
|
|
||||||
};
|
|
||||||
}
|
|
||||||
print output_page();
|
print output_page();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue