-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.php
59 lines (46 loc) · 1.18 KB
/
schema.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
require 'config.php';
$con = mysql_connect($mysql_host, $mysql_user, $mysql_pass);
if(!$con) exit;
$db = mysql_select_db($mysql_db, $con);
if(!$db) {
if(!mysql_query("CREATE DATABASE " . $mysql_db, $con)) {
mysql_close($con);
exit;
}
}
$db = mysql_select_db($mysql_db, $con);
if(!$db) {
mysql_close($con);
exit;
}
$result = mysql_query("CREATE TABLE IF NOT EXISTS `urls` (
`id` INT NOT NULL AUTO_INCREMENT ,
`url` TEXT NOT NULL ,
`created` DATETIME NOT NULL ,
PRIMARY KEY (`id`) ,
UNIQUE INDEX `id_UNIQUE` (`id` ASC) )");
if(!$result) {
mysql_close($con);
exit;
}
$result = mysql_query("CREATE TABLE IF NOT EXISTS `urlTracking` (
`id` INT NOT NULL AUTO_INCREMENT ,
`urlId` INT NOT NULL ,
`time` DATETIME NOT NULL ,
`clientip` VARCHAR(45) NULL ,
`method` VARCHAR(10) NULL ,
`serverRequestTime` VARCHAR(45) NULL ,
`useragent` TEXT NULL ,
`referer` TEXT NULL ,
`querystring` TEXT NULL ,
`requesturi` TEXT NULL ,
PRIMARY KEY (`id`) ,
UNIQUE INDEX `id_UNIQUE` (`id` ASC) )");
if(!$result) {
mysql_close($con);
exit;
}
mysql_close($con);
?>
finished.