2007-12-22 12:30:11 +00:00
|
|
|
require "include.pl";
|
|
|
|
|
2007-10-11 22:42:21 +00:00
|
|
|
#create or resume session
|
|
|
|
CGI::Session->name($session_name);
|
|
|
|
my $session = new CGI::Session;
|
|
|
|
|
2007-10-29 08:48:51 +00:00
|
|
|
$dbh->do(qq{drop table config});
|
|
|
|
|
2007-10-11 22:42:21 +00:00
|
|
|
$dbh->do(qq{drop table users});
|
|
|
|
|
|
|
|
$dbh->do(qq{drop table videos});
|
|
|
|
|
2007-10-18 09:41:19 +00:00
|
|
|
$dbh->do(qq{drop table uploaded});
|
|
|
|
|
2007-10-11 22:42:21 +00:00
|
|
|
$dbh->do(qq{drop table tagcloud});
|
|
|
|
|
2007-10-21 22:26:22 +00:00
|
|
|
$dbh->do(qq{drop table referer});
|
|
|
|
|
2007-10-22 19:15:39 +00:00
|
|
|
$dbh->do(qq{drop table comments});
|
2007-10-22 17:47:28 +00:00
|
|
|
|
2007-10-15 00:25:23 +00:00
|
|
|
$dbh->do(qq{create table
|
2008-02-14 22:15:38 +00:00
|
|
|
tagcloud
|
|
|
|
(
|
|
|
|
text varchar(255) not null,
|
|
|
|
count int not null
|
|
|
|
)
|
2007-10-18 09:41:19 +00:00
|
|
|
}) or die $dbh->errstr;
|
2007-10-15 00:25:23 +00:00
|
|
|
|
|
|
|
$dbh->do(qq{insert into
|
2008-02-14 22:15:38 +00:00
|
|
|
tagcloud values
|
|
|
|
(
|
|
|
|
'web tv', 68
|
|
|
|
)
|
2007-10-18 09:41:19 +00:00
|
|
|
}) or die $dbh->errstr;
|
2007-10-15 00:25:23 +00:00
|
|
|
|
2007-10-29 08:48:51 +00:00
|
|
|
$dbh->do(qq{create table
|
2008-02-14 22:15:38 +00:00
|
|
|
config
|
|
|
|
(
|
|
|
|
attribute varchar(255) not null,
|
|
|
|
value varchar(255) not null,
|
|
|
|
primary key (attribute)
|
|
|
|
)
|
2007-10-29 08:48:51 +00:00
|
|
|
}) or die $dbh->errstr;
|
|
|
|
|
2007-10-15 00:25:23 +00:00
|
|
|
$dbh->do(qq{create table
|
2008-02-14 22:15:38 +00:00
|
|
|
users
|
|
|
|
(
|
|
|
|
id int auto_increment not null,
|
|
|
|
username varchar(255) not null,
|
|
|
|
password char(41) not null,
|
|
|
|
sid char(32) not null,
|
|
|
|
timestamp bigint not null,
|
|
|
|
locale varchar(10) not null,
|
|
|
|
pagesize tinyint unsigned default 5,
|
|
|
|
cortado varchar(5) default 'true',
|
|
|
|
primary key (id)
|
|
|
|
)
|
2007-10-18 09:41:19 +00:00
|
|
|
}) or die $dbh->errstr;
|
|
|
|
|
2007-10-21 19:15:18 +00:00
|
|
|
$dbh->do(qq{insert into
|
2008-02-14 22:15:38 +00:00
|
|
|
users
|
|
|
|
(
|
|
|
|
username,
|
|
|
|
password
|
|
|
|
)
|
|
|
|
values
|
|
|
|
(
|
|
|
|
'test',
|
|
|
|
password( 'test' )
|
|
|
|
)
|
2007-10-21 19:15:18 +00:00
|
|
|
}) or die $dbh->errstr;
|
|
|
|
|
2007-10-18 09:41:19 +00:00
|
|
|
$dbh->do(qq{create table
|
2008-02-14 22:15:38 +00:00
|
|
|
uploaded
|
|
|
|
(
|
|
|
|
id int auto_increment not null,
|
|
|
|
title varchar(255) not null,
|
|
|
|
description text not null,
|
|
|
|
userid int not null,
|
|
|
|
timestamp bigint not null,
|
|
|
|
creator varchar(255) not null,
|
|
|
|
subject varchar(255) not null,
|
|
|
|
source varchar(255) not null,
|
|
|
|
language varchar(255) not null,
|
|
|
|
coverage varchar(255) not null,
|
|
|
|
rights varchar(255) not null,
|
|
|
|
license varchar(255) not null,
|
|
|
|
status int default 0,
|
|
|
|
primary key (id)
|
|
|
|
)
|
2007-10-18 09:41:19 +00:00
|
|
|
}) or die $dbh->errstr;
|
2007-10-15 00:25:23 +00:00
|
|
|
|
|
|
|
$dbh->do(qq{create table
|
2008-02-14 22:15:38 +00:00
|
|
|
videos
|
|
|
|
(
|
|
|
|
id int auto_increment not null,
|
|
|
|
title varchar(255) not null,
|
|
|
|
description text not null,
|
|
|
|
userid int not null,
|
|
|
|
timestamp bigint not null,
|
|
|
|
creator varchar(255) not null,
|
|
|
|
subject varchar(255) not null,
|
|
|
|
source varchar(255) not null,
|
|
|
|
language varchar(255) not null,
|
|
|
|
coverage varchar(255) not null,
|
|
|
|
rights varchar(255) not null,
|
|
|
|
license varchar(255) not null,
|
|
|
|
filesize int not null,
|
|
|
|
duration int not null,
|
|
|
|
width smallint not null,
|
|
|
|
height smallint not null,
|
|
|
|
fps float not null,
|
|
|
|
hash char(64) not null,
|
|
|
|
viewcount int default 0,
|
|
|
|
downloadcount int default 0,
|
|
|
|
primary key (id),
|
|
|
|
fulltext (title, description, subject)
|
|
|
|
)
|
2007-10-18 09:41:19 +00:00
|
|
|
}) or die $dbh->errstr;
|
2007-10-11 22:42:21 +00:00
|
|
|
|
2007-10-21 19:15:18 +00:00
|
|
|
$dbh->do(qq{create table
|
2008-02-14 22:15:38 +00:00
|
|
|
referer
|
|
|
|
(
|
|
|
|
videoid int not null,
|
|
|
|
referer varchar(255) not null,
|
|
|
|
count int default 1
|
|
|
|
)
|
2007-10-21 19:15:18 +00:00
|
|
|
}) or die $dbh->errstr;
|
|
|
|
|
2007-10-22 17:47:28 +00:00
|
|
|
$dbh->do(qq{create table
|
2008-02-14 22:15:38 +00:00
|
|
|
comments
|
|
|
|
(
|
|
|
|
id int auto_increment not null,
|
|
|
|
userid int not null,
|
|
|
|
videoid int not null,
|
|
|
|
text varchar(255) not null,
|
|
|
|
timestamp bigint not null,
|
|
|
|
primary key (id)
|
|
|
|
)
|
2007-10-22 17:47:28 +00:00
|
|
|
}) or die $dbh->errstr;
|
|
|
|
|
2007-10-11 22:42:21 +00:00
|
|
|
print $session->header();
|
|
|
|
print "initiated database";
|