-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathsetup_mysql.php
33 lines (30 loc) · 921 Bytes
/
setup_mysql.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
<?php
session_start();
require "global_func.php";
include "mysql.php";
$is = mysql_query("SELECT * FROM users", $c) or die(set_mysql());
function set_mysql() {
//Only executed if table does not exist
$c = mysql_connect($db_hostname, $db_username, $db_password);
mysql_select_db($db_database, $c);
$e_db_hostname = addslashes($db_hostname);
$e_db_username = addslashes($db_username);
$e_db_password = addslashes($db_password);
$e_db_database = addslashes($db_database);
$fo = fopen("dbdata.sql", "r");
$query = '';
$lines = explode("\n", fread($fo, 1024768));
fclose($fo);
foreach ($lines as $line)
{
if (!(strpos($line, "--") === 0) && trim($line) != '')
{
$query .= $line;
if (!(strpos($line, ";") === FALSE))
{
mysql_query($query);
$query = '';
}
}
}
}