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
|
|
|
|
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
|
|
|
|
tagcloud values
|
|
|
|
(
|
2007-10-19 16:59:19 +00:00
|
|
|
'web tv', 68
|
2007-10-15 00:25:23 +00:00
|
|
|
)
|
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
|
|
|
|
config
|
|
|
|
(
|
2007-10-29 21:26:39 +00:00
|
|
|
attribute varchar(255) not null,
|
2007-10-29 08:48:51 +00:00
|
|
|
value varchar(255) not null,
|
2007-10-29 21:26:39 +00:00
|
|
|
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
|
|
|
|
users
|
|
|
|
(
|
|
|
|
id int auto_increment not null,
|
|
|
|
username varchar(255) not null,
|
|
|
|
password char(41) not null,
|
|
|
|
sid char(32) not null,
|
2007-10-29 08:48:51 +00:00
|
|
|
timestamp bigint not null,
|
|
|
|
locale varchar(10) not null,
|
2007-10-29 08:54:16 +00:00
|
|
|
pagesize tinyint unsigned default 5,
|
2007-10-29 08:48:51 +00:00
|
|
|
cortado tinyint default 1,
|
2007-10-15 00:25:23 +00:00
|
|
|
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
|
|
|
|
users
|
|
|
|
(
|
|
|
|
username,
|
|
|
|
password
|
|
|
|
)
|
|
|
|
values
|
|
|
|
(
|
|
|
|
'test',
|
|
|
|
password( 'test' )
|
|
|
|
)
|
|
|
|
}) or die $dbh->errstr;
|
|
|
|
|
2007-10-18 09:41:19 +00:00
|
|
|
$dbh->do(qq{create table
|
|
|
|
uploaded
|
|
|
|
(
|
2007-10-20 00:21:18 +00:00
|
|
|
id int auto_increment not null,
|
|
|
|
title varchar(255) not null,
|
2007-12-14 06:18:58 +00:00
|
|
|
description text not null,
|
2007-10-20 00:21:18 +00:00
|
|
|
userid int not null,
|
2007-10-20 00:41:21 +00:00
|
|
|
timestamp bigint not null,
|
2007-10-20 00:21:18 +00:00
|
|
|
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,
|
2007-10-20 22:01:44 +00:00
|
|
|
status int default 0,
|
2007-10-20 00:21:18 +00:00
|
|
|
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
|
|
|
|
videos
|
|
|
|
(
|
2007-10-20 00:21:18 +00:00
|
|
|
id int auto_increment not null,
|
|
|
|
title varchar(255) not null,
|
2007-12-14 06:18:58 +00:00
|
|
|
description text not null,
|
2007-10-20 00:21:18 +00:00
|
|
|
userid int not null,
|
2007-10-20 00:41:21 +00:00
|
|
|
timestamp bigint not null,
|
2007-10-20 00:21:18 +00:00
|
|
|
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,
|
2007-10-20 00:41:21 +00:00
|
|
|
duration int not null,
|
2007-10-20 00:21:18 +00:00
|
|
|
width smallint not null,
|
|
|
|
height smallint not null,
|
|
|
|
fps float not null,
|
2007-10-20 01:39:20 +00:00
|
|
|
hash char(64) not null,
|
2007-10-20 22:01:44 +00:00
|
|
|
viewcount int default 0,
|
|
|
|
downloadcount int default 0,
|
2007-10-20 00:21:18 +00:00
|
|
|
primary key (id),
|
|
|
|
fulltext (title, description, subject)
|
2007-10-15 00:25:23 +00:00
|
|
|
)
|
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
|
|
|
|
referer
|
|
|
|
(
|
|
|
|
videoid int not null,
|
|
|
|
referer varchar(255) not null,
|
|
|
|
count int default 1
|
|
|
|
)
|
|
|
|
}) or die $dbh->errstr;
|
|
|
|
|
2007-10-22 17:47:28 +00:00
|
|
|
$dbh->do(qq{create table
|
2007-10-22 19:15:39 +00:00
|
|
|
comments
|
2007-10-22 17:47:28 +00:00
|
|
|
(
|
|
|
|
id int auto_increment not null,
|
|
|
|
userid int not null,
|
|
|
|
videoid int not null,
|
2007-10-22 20:50:45 +00:00
|
|
|
text varchar(255) not null,
|
2007-10-24 10:50:49 +00:00
|
|
|
timestamp bigint not null,
|
2007-10-22 19:15:39 +00:00
|
|
|
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";
|