Skip to content

Latest commit

 

History

History
53 lines (41 loc) · 1.42 KB

makedb.php

File metadata and controls

53 lines (41 loc) · 1.42 KB
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
require_once 'database.php';
// !!! FIXME: absolutely don't let this script run on a production site!
if (isset($_SERVER['REMOTE_ADDR']))
{
header('Content-type: text/plain; charset=UTF-8');
print("\n\nThis isn't allowed over the web anymore.\n\n");
exit(0);
} // if
if ((!isset($argv[1])) || ($argv[1] != '--confirm'))
{
echo "You have to run this with --confirm to do anything.\n";
echo "...BECAUSE DOING SO DESTROYS ANY EXISTING DATABASE!!!\n";
exit(0);
} // if
Jul 5, 2010
Jul 5, 2010
21
22
$GDebugSQL = true;
$GDebugSQLErrors = true;
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
echo "Nuking any existing database (too late to go back, now!)...\n";
do_dbquery("drop database if exists $dbname");
echo "Creating new database from scratch...\n";
do_dbquery("create database $dbname");
close_dblink(); // force it to reselect the new database.
echo "Building gametags table...\n";
do_dbquery(
"create table gametags (" .
" id int unsigned not null auto_increment," .
" steamid bigint not null," .
" appid int unsigned not null," .
" tag varchar(64) not null," .
Jul 5, 2010
Jul 5, 2010
39
" ipaddr int unsigned not null," .
Jul 5, 2010
Jul 5, 2010
40
41
" posted datetime not null," .
" deleted datetime default null," .
Jul 5, 2010
Jul 5, 2010
42
" deletedipaddr int unsigned default null," .
Jul 5, 2010
Jul 5, 2010
43
" index gametag_index (steamid, appid)," .
44
45
46
47
48
49
50
51
52
53
" primary key (id)" .
" ) character set utf8"
);
echo "...all done!\n\n";
echo "If there were no errors, you're good to go.\n";
echo "\n\n\n";
?>