diff --git a/trunk/download.pl b/trunk/download.pl index 25845ca..7c55bd2 100644 --- a/trunk/download.pl +++ b/trunk/download.pl @@ -13,30 +13,7 @@ if($query->param('id')) $sth->execute($query->param('id')); 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? if($query->param('view')) { diff --git a/trunk/init_sql.pl b/trunk/init_sql.pl index a5dac66..f1f3f8a 100644 --- a/trunk/init_sql.pl +++ b/trunk/init_sql.pl @@ -14,8 +14,6 @@ $dbh->do(qq{drop table uploaded}); $dbh->do(qq{drop table tagcloud}); -$dbh->do(qq{drop table referer}); - $dbh->do(qq{drop table comments}); $dbh->do(qq{create table @@ -113,15 +111,6 @@ $dbh->do(qq{create table ) }) 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 comments ( diff --git a/trunk/video.pl b/trunk/video.pl index 502350d..912d4b9 100644 --- a/trunk/video.pl +++ b/trunk/video.pl @@ -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 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(); } }