-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathinstall.php
69 lines (68 loc) · 2.75 KB
/
install.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
60
61
62
63
64
65
66
67
68
69
<?php
/*
phpGSB - PHP Google Safe Browsing Implementation
Released under New BSD License (see LICENSE)
Copyright (c) 2010-2015, Sam Cleaver (Beaver6813, Beaver6813.com)
All rights reserved.
INITIAL INSTALLER - RUN ONCE (or more than once if you're adding a new list!)
*/
require("phpgsb.class.php");
$phpgsb = new phpGSB("DATABASE_NAME","DATABASE_USERNAME","DATABASE_PASSWORD");
$phpgsb->usinglists = array('googpub-phish-shavar','goog-malware-shavar', 'goog-unwanted-shavar');
//Install MySQL tables
foreach($phpgsb->usinglists as $value)
{
//Create ADD tables
mysqli_query($phpgsb->getDbLink(), "CREATE TABLE IF NOT EXISTS `$value-a-hosts` (
`ID` int(255) NOT NULL auto_increment,
`Hostkey` varchar(8) NOT NULL,
`Chunknum` int(255) NOT NULL,
`Count` varchar(2) NOT NULL default '0',
`FullHash` varchar(70) NOT NULL,
PRIMARY KEY (`ID`),
KEY `Hostkey` (`Hostkey`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;");
mysqli_query($phpgsb->getDbLink(), "CREATE TABLE IF NOT EXISTS `$value-a-index` (
`ChunkNum` int(255) NOT NULL auto_increment,
`Chunklen` int(255) NOT NULL default '0',
PRIMARY KEY (`ChunkNum`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;");
mysqli_query($phpgsb->getDbLink(), "CREATE TABLE IF NOT EXISTS `$value-a-prefixes` (
`ID` int(255) NOT NULL auto_increment,
`Hostkey` varchar(8) NOT NULL,
`Prefix` varchar(255) NOT NULL,
`FullHash` varchar(70) NOT NULL,
PRIMARY KEY (`ID`),
KEY `Hostkey` (`Hostkey`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;");
//Create SUB tables
mysqli_query($phpgsb->getDbLink(), "CREATE TABLE IF NOT EXISTS `$value-s-hosts` (
`ID` int(255) NOT NULL auto_increment,
`Hostkey` varchar(8) NOT NULL,
`Chunknum` int(255) NOT NULL,
`Count` varchar(2) NOT NULL default '0',
`FullHash` varchar(70) NOT NULL,
PRIMARY KEY (`ID`),
KEY `Hostkey` (`Hostkey`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;");
mysqli_query($phpgsb->getDbLink(), "CREATE TABLE IF NOT EXISTS `$value-s-index` (
`ChunkNum` int(255) NOT NULL auto_increment,
`Chunklen` int(255) NOT NULL default '0',
PRIMARY KEY (`ChunkNum`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;");
mysqli_query($phpgsb->getDbLink(), "CREATE TABLE IF NOT EXISTS `$value-s-prefixes` (
`ID` int(255) NOT NULL auto_increment,
`Hostkey` varchar(8) NOT NULL,
`AddChunkNum` varchar(8) NOT NULL,
`Prefix` varchar(255) NOT NULL,
`FullHash` varchar(70) NOT NULL,
PRIMARY KEY (`ID`),
KEY `Hostkey` (`Hostkey`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;");
}
//Check timeout files writable
if(file_put_contents("testfile.dat","TEST PRE-USE PHPGSB ".time()))
unlink("testfile.dat");
else
echo "<span style='color:red;font-weight:bold;'>ERROR: THIS DIRECTORY IS NOT WRITABLE, CHMOD to 775 or 777</span>";
?>