2007-10-11 22:42:21 +00:00
|
|
|
#!/usr/bin/perl
|
|
|
|
require "include.pl";
|
|
|
|
|
|
|
|
#create or resume session
|
|
|
|
CGI::Session->name($session_name);
|
|
|
|
my $session = new CGI::Session;
|
|
|
|
|
|
|
|
my $dbh = DBI->connect("DBI:mysql:$database:$host", $dbuser, $dbpass) or die $dbh->errstr;
|
|
|
|
|
|
|
|
$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-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
|
|
|
|
(
|
|
|
|
'web tv', 68
|
|
|
|
)
|
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
|
|
|
|
users
|
|
|
|
(
|
|
|
|
id int auto_increment not null,
|
|
|
|
username varchar(255) not null,
|
|
|
|
password char(41) not null,
|
|
|
|
sid char(32) not null,
|
|
|
|
primary key (id)
|
|
|
|
)
|
2007-10-18 09:41:19 +00:00
|
|
|
}) or die $dbh->errstr;
|
|
|
|
|
|
|
|
$dbh->do(qq{create table
|
|
|
|
uploaded
|
|
|
|
(
|
|
|
|
id int auto_increment not null,
|
|
|
|
title varchar(255) not null,
|
2007-10-18 09:53:32 +00:00
|
|
|
description text not null,
|
2007-10-18 09:41:19 +00:00
|
|
|
userid int not null,
|
|
|
|
status int not null,
|
|
|
|
timestamp datetime not null,
|
|
|
|
primary key (id)
|
|
|
|
)
|
|
|
|
}) or die $dbh->errstr;
|
2007-10-15 00:25:23 +00:00
|
|
|
|
|
|
|
$dbh->do(qq{create table
|
|
|
|
videos
|
|
|
|
(
|
|
|
|
id int auto_increment not null,
|
|
|
|
title varchar(255) not null,
|
2007-10-18 09:53:32 +00:00
|
|
|
description text not null,
|
2007-10-17 12:55:35 +00:00
|
|
|
userid int not null,
|
2007-10-15 00:25:23 +00:00
|
|
|
hash char(64) not null,
|
|
|
|
timestamp datetime not null,
|
2007-10-17 12:55:35 +00:00
|
|
|
filesize int not null,
|
|
|
|
duration float not null,
|
|
|
|
width smallint not null,
|
|
|
|
height smallint not null,
|
|
|
|
fps float not null,
|
2007-10-15 00:25:23 +00:00
|
|
|
primary key (id),
|
2007-10-18 09:53:32 +00:00
|
|
|
fulltext (title, description)
|
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
|
|
|
|
|
|
|
$dbh->disconnect() or die $dbh->errstr;
|
|
|
|
|
|
|
|
print $session->header();
|
|
|
|
print "initiated database";
|