<?php $PAGE_TITLE = 'Installation - Step 7'; $s =& $_SESSION['INSTALL_DATA']; $conn = my_mysql_connect($s['MYSQL_HOST'], $s['MYSQL_USER'], $s['MYSQL_PASS']); $dbs = my_mysql_select_db($s['MYSQL_DBNAME'], $conn); if (!$conn || !$dbs) { $_SESSION['INSTALL_STEP'] = 1; header('Location: ?next&r=' . rand(0, 99999)); } $convert_version = FALSE; $res = my_mysql_query('SHOW TABLES FROM ' . $s['MYSQL_DBNAME'], $conn); if (my_mysql_num_rows($res)) { $tables = array(); while ($tbl = my_mysql_fetch_row($res)) { $tables[] = $tbl[0]; } sort($tables); } if (isset($OLDC->VERSION)) { $convert_version = $OLDC->VERSION; } elseif (file_exists(INCPATH . '../../include/conf_main.php') && in_array('users_watched', $tables)) { $convert_version = 'unofficial'; } if ($convert_version) { if ($convert_version == 'unofficial') { $res = my_mysql_query('SELECT id, username, email FROM users WHERE id=1 LIMIT 1', $conn); } else { $res = my_mysql_query('SELECT id, username, email FROM users WHERE is_network_admin=1 ORDER BY active=1 DESC, id ASC LIMIT 1', $conn); } if ($adm = my_mysql_fetch_object($res)) {
function database_drop_tables_with_prefix($prefix) { if (empty($prefix)) { return FALSE; } global $s; $conn = my_mysql_connect($s['MYSQL_HOST'], $s['MYSQL_USER'], $s['MYSQL_PASS']); $dbs = my_mysql_select_db($s['MYSQL_DBNAME'], $conn); if (!$conn || !$dbs) { return FALSE; } $tmp = my_mysql_query('SHOW TABLES FROM ' . $s['MYSQL_DBNAME'], $conn); while ($tbl = my_mysql_fetch_row($tmp)) { $tbl = $tbl[0]; if (substr($tbl, 0, strlen($prefix)) == $prefix) { my_mysql_query("DROP TABLE IF EXISTS `" . $tbl . "`;", $conn); } } }