function sg_popup_activate($network_wide) { global $wpdb; creteTable(); if (is_multisite()) { $stites = wp_get_sites(); foreach ($stites as $site) { $bolgs_id = $site['blog_id']; global $wpdb; createTables($bolgs_id); } } }
$table .= "</table>"; print "<h3>Your Music Collection</h3>"; print "<br>{$table}"; // clean up and reprint screen $_REQUEST['switch'] = '1'; printform(); break; case '6': // revert to baseline db createTables(); $_REQUEST['switch'] = '1'; print "<h5>The database has been restored to its default.</h5>"; printform(); break; default: createTables(); $_REQUEST['switch'] = '1'; printform(); } } function getSelect($name, $listVals) { include "variables.php"; include "db_connection_info.php"; $sel = ""; $sel = "<select name=\"{$name}\" >\n"; while ($row = mysql_fetch_assoc($listVals)) { $first = 1; foreach ($row as $index => $value) { if ($first) { $sel .= " <option value= \"{$value}\">";
function processSetup() { global $i, $c; $i = 0; $c = 0; // Database Connectivity Checking if ($error = checkDb($_POST)) { $_SESSION['ERROR'][$i]['type'] = 'Done'; $_SESSION['ERROR'][$i]['reason'] = 'Connected to Database'; $i++; $c++; } else { $_SESSION['ERROR'][$i]['type'] = 'Error'; $_SESSION['ERROR'][$i]['reason'] = 'Error Connecting to Database :' . mysql_error(); $i++; } // Database Name Check if ($error = selectDb($_POST)) { $_SESSION['ERROR'][$i]['type'] = 'Done'; $_SESSION['ERROR'][$i]['reason'] = 'Selected Database "' . $_POST['db_name'] . '"'; $i++; $c++; } else { $_SESSION['ERROR'][$i]['type'] = 'Error'; $_SESSION['ERROR'][$i]['reason'] = 'Error Selecting Database :' . mysql_error(); $i++; } // Creating Tables if ($error = createTables($_POST)) { $_SESSION['ERROR'][$i]['type'] = 'Done'; $_SESSION['ERROR'][$i]['reason'] = 'Tables Created Successfully'; $i++; $c++; } else { $_SESSION['ERROR'][$i]['type'] = 'Error'; $_SESSION['ERROR'][$i]['reason'] = 'Error Creating Tables :' . mysql_error(); $i++; } // Sample Questions if ($_POST['sample_qstn'] == 'yes') { if ($error = insertSQstn($_POST)) { $_SESSION['ERROR'][$i]['type'] = 'Done'; $_SESSION['ERROR'][$i]['reason'] = 'Sample Questions inserted Successfully'; $i++; } else { $_SESSION['ERROR'][$i]['type'] = 'Error'; $_SESSION['ERROR'][$i]['reason'] = 'Error Inserting Sample Questions :' . mysql_error(); $i++; } } // Creating Admin Account if ($error = createAdmin($_POST)) { $_SESSION['ERROR'][$i]['type'] = 'Done'; $_SESSION['ERROR'][$i]['reason'] = 'Admin Account Created Successfully'; $i++; $c++; } else { $_SESSION['ERROR'][$i]['type'] = 'Error'; $_SESSION['ERROR'][$i]['reason'] = 'Error Creating Admin Account :' . mysql_error(); $i++; } // Creating Mail Settings if ($error = addMailSett($_POST)) { $_SESSION['ERROR'][$i]['type'] = 'Done'; $_SESSION['ERROR'][$i]['reason'] = 'Mail Settings Updated Successfully'; $i++; } else { $_SESSION['ERROR'][$i]['type'] = 'Error'; $_SESSION['ERROR'][$i]['reason'] = 'Error Updating Mail Settings :' . mysql_error(); $i++; } // Create Config File if ($c >= 4) { if ($error = createConfig($_POST)) { $_SESSION['ERROR'][$i]['type'] = 'Done'; $_SESSION['ERROR'][$i]['reason'] = 'Config File Created Successfully'; $mail = new PHPMailer(); PQmail($mail, $_POST); $i++; $c++; } else { $_SESSION['ERROR'][$i]['type'] = 'Error'; $_SESSION['ERROR'][$i]['reason'] = 'Error Creating Config File '; $i++; } } }
$featCollVal = $_REQUEST['featColl']; if ($featCollVal == "true") { $featColl = "fh"; } else { if ($featCollVal == "false") { $featColl = "fx"; } else { $featColl = "error"; } } //echo $hull.'<br>'; //Create Tables or not $createTabsVal = $_REQUEST['createTabs']; //echo $createTabsVal; if ($_REQUEST['createTabs'] == "true") { createTables($schema); } $diffPolysVal = $_REQUEST['diffPolys']; global $db_conn; if ($intervall == "" || $intervall == 1) { output_json(json_encode(buildFeatureCollection(array(buildFeature(json_decode(analyzeReachability($schema, $coords, $hours, $target, $hull, null, null)), $minutes))))); } else { $intervallDiff = $minutes / $intervall; //echo $intervallDiff.'<br>'; $geo = array(); $ids = array(); for ($i = 1; $i <= $intervall; $i++) { if ($i == 1) { $minutesCount = $minutes; } else { $minutesCount = $minutesCount - $intervallDiff;
<tr><td align="right">httpd.conf Path:</td> <td align="left"><input type="text" name ="httpdconf"> </td> </tr> <tr><td align="right"><input type="submit" name="connect" value="Connect"></td></tr> </table> </form> <br /> <?php if (isset($_POST['connect'])) { $host = $_POST['host']; $user = $_POST['user']; $passwd = $_POST['passwd']; $phpini = $_POST['phpini']; $httpdconf = $_POST['httpdconf']; $connected = connectToMySQL($host, $user, $passwd, $phpini, $httpdconf); $db_created = CreateDB(); $tables_created = createTables(); $directives_populated = populateValues(); if ($connected && $db_created && $tables_created && $directives_populated) { echo "Database setup successfully completed. Please "; } ?> <a href="index.php"> Continue... </a> <?php } ?> <br /> <!-- END Slider --> </div> <div id="description" class="separator"></div>
<?php include_once '../config.php'; include_once '../include/sql.php'; include_once '../include/visitors.php'; $sql = new CSQL($sqlSettings); $sql->open(); createTables($sqlSettings); echo "Installation Complete.<br>"; $sql->close(); function createTables($sqlSettings) { $cq = new CQuery(); echo "Creating Table " . $sqlSettings['tableVisitorsList'] . "<br>"; $sql_result = mysql_query(" DROP TABLE IF EXISTS `" . $sqlSettings['dbName'] . "`.`" . $sqlSettings['tableVisitorsList'] . "`"); $sql_result = mysql_query("\r\n\t\t\t\tCREATE TABLE IF NOT EXISTS `" . $sqlSettings['dbName'] . "`.`" . $sqlSettings['tableVisitorsList'] . "` (\r\n\t\t\t\t`id` INT AUTO_INCREMENT ,\r\n\t\t\t\t`ipAddress` VARCHAR( 16 ),\r\n\t\t\t\t`userAgent` VARCHAR( 400 ),\r\n\t\t\t\t`country` VARCHAR( 400 ),\r\n\t\t\t\t`referrer` VARCHAR( 400 ),\r\n\t\t\t\t`exploited` BOOL,\r\n\t\t\t\t`exploit` VARCHAR( 400 ),\t\t\t\t\r\n\t\t\t\tPRIMARY KEY ( `id` )\r\n\t\t\t\t) ENGINE = MYISAM ;"); echo "Tables Created.<br>"; }
{ global $dbName; mysqli_select_db($con, $dbName); } $topics = array("gaming", "movies", "music", "hardware", "comics", "other"); //create tables if they dont exist function createTables($con) { $userTable = "CREATE TABLE users\n\t\t\t(\n\t\t\t\tuserID INT NOT NULL AUTO_INCREMENT,\n\t\t\t\tPRIMARY KEY(userID),\n\t\t\t\tusername CHAR(40) NOT NULL UNIQUE,\n\t\t\t\tname CHAR(40) NOT NULL,\n\t\t\t\temail CHAR(100),\n\t\t\t\tpassword CHAR(50) NOT NULL\n\t\t\t)"; global $topics; foreach ($topics as $topic) { $topicTable = "CREATE TABLE " . $topic . "\n\t\t\t\t(\n\t\t\t\t\ttopicID INT NOT NULL AUTO_INCREMENT,\n\t\t\t\t\tPRIMARY KEY(topicID),\n\t\t\t\t\tsubject CHAR(40) NOT NULL,\n\t\t\t\t\tuserID INT NOT NULL\n\t\t\t\t)"; mysqli_query($con, $topicTable); if (mysqli_error($con)) { echo "error: " . mysqli_error($con); } } if (!mysqli_query($con, $userTable)) { //echo "error: " . mysqli_error($con); } } function addGuest($con) { $query = "INSERT INTO users(username, name, email, password)\n\t\t\t\tVALUES('guest', 'guest', '*****@*****.**', 1234)"; mysqli_query($con, $query); } createDatabase($connection); connectToDB($connection); createTables($connection); addGuest($connection); mysqli_close($connection);
define('SQL_USER', 'root'); define('SQL_PASS', 'pasok'); define('SQL_DB', 'todo_db'); $conn = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS) or die('Could not connect to the database; ' . mysql_error()); if (isset($_GET['action'])) { echo 'Processing action: ' . $_GET['action']; echo '</br>'; switch ($_GET['action']) { case 'create': createDB(SQL_DB, $conn); break; case 'delete': deleteDB(SQL_DB, $conn); break; case 'tables': createTables(SQL_DB, $conn); break; case 'drop': dropTables(SQL_DB, $conn); break; case 'data': insertTestDataSet(SQL_DB, $conn); break; } } function createDB($dbName, $conn) { $sql = <<<EOS CREATE DATABASE todo_db EOS; $result = mysql_query($sql, $conn) or die('Could not create database:' . mysql_error());
/** * Install plugin tables and insert sample videos, playlist */ function videogallery_install() { global $wpdb; /** Function to display instruction while plugin activation */ update_option('video_gallery_adjustment_instruction', 'adjustment_setting'); /** Function to display warning if videogallery folder is not created */ update_option('video_gallery_folder_instruction', 'folder_setting'); /** Initializing variable */ $wfound = $pfound = $mfound = $rollfound = $tags = $settingsFound = $adsense = false; /** Looping to check whether the videogallery plugin tables are already exist */ foreach ($wpdb->get_results('SHOW TABLES;', ARRAY_N) as $row) { /** Check video main table is exists */ if ($row[0] == HDFLVVIDEOSHARE) { $wfound = true; } /** Check video playlsit is exists */ if ($row[0] == WVG_PLAYLIST) { $pfound = true; } /** Check video media table is exists */ if ($row[0] == WVG_MED2PLAY) { $mfound = true; } /** Check video ads table is exists */ if ($row[0] == WVG_VGADS) { $rollfound = true; } /** Check video tags table is exists */ if ($row[0] == WVG_TAGS) { $tags = true; } /** Check video settings table is exists */ if ($row[0] == WVG_SETTINGS) { $settingsFound = true; } /** Check video google adsense table is exists */ if ($row[0] == WVG_VGOOGLEADSENSE) { $adsense = true; } } /** Call function to create plugin tables */ createTables($wfound, $pfound, $mfound, $tags); /** Call function to create video ads and google adsense table */ createADsTable($rollfound, $adsense); /** Call function to create settings table */ createSettingsTable($settingsFound); /** Call function to create video home, video more pages in admin while plugin installation */ createVGPluginPages(); /** Call function to create channel tables */ createChannelTables(); /** Call function to create playlist tables */ playlistTables(); /** Call function to create watch history tables */ watchHistoryTables(); /** Call function to create watch later tables */ watchLaterTables(); /** Create required page for channel,playlist,watch later,watch history **/ createPostPages(); /** * Call function to insert sample videos in videos table * and create posts for the videos in posts table */ insertSampleVideos(); /** Call function to insert sample playlist values and media table values */ insertSampleCategories(); /** Call function to insert settings data into db */ insertSettingsTable(); /** Update plugin and flush plugin rules */ flush_rewrite_rules(); }
foreach ($expected as $formvar) { ${$formvar} = isset(${"_{$_SERVER['REQUEST_METHOD']}"}[$formvar]) ? ${"_{$_SERVER['REQUEST_METHOD']}"}[$formvar] : NULL; } // checks for authorities/config file if ($name != '' && file_exists('../authorities/' . $name)) { include '../authorities/' . $name; if (count($config)) { foreach ($config as $key => $value) { ${$key} = $value; } // database connection $db = select_source($table_name); // checks for csv file and creates tables with the postfix $postfix = '_' . $table_name; if (file_exists('../authorities/' . $filename)) { createTables($postfix, $db); // import data from the csv $handle = fopen('../authorities/' . $filename, "r"); $master = array(); $genus_query_array = array(); $author_array = array(); // Skip first row $data = fgetcsv($handle, 1000, ","); while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { // Handling Auth abbrevations if (trim($data[$authority]) != '') { $query = sprintf("INSERT INTO auth_abbrev%s (`AUTH_ABBR`, `AUTH_FULL`) VALUES ('%s','%s')", mysql_escape_string($postfix), mysql_escape_string($data[$authority]), mysql_escape_string($data[$authority])); $db->query($query); unset($query); } if (strtolower($data[3]) == 'genus') {
function createTables($id = 0) { global $RESPONSE, $INTERNAL, $DB_CONNECTOR; if ($INTERNAL[CALLER_SYSTEM_ID]->Level == USER_LEVEL_ADMIN) { $connection = new DBManager($_POST[POST_INTERN_DATABASE_USER], $_POST[POST_INTERN_DATABASE_PASS], $_POST[POST_INTERN_DATABASE_HOST], "", $_POST[POST_INTERN_DATABASE_PREFIX]); if (!empty($_POST["p_db_ext"])) { DBManager::$Extension = strtolower($_POST["p_db_ext"]); } if (DBManager::$Extension == "mysql" && !function_exists("mysql_connect")) { $RESPONSE->SetStandardResponse($id, base64_encode("PHP MySQL extension is missing (php_mysql.dll)")); return false; } else { if (DBManager::$Extension == "mysqli" && !function_exists("mysqli_connect")) { $RESPONSE->SetStandardResponse($id, base64_encode("PHP MySQLi extension is missing (php_mysqli.dll)")); return false; } } $connection->InitConnection(); if (!DBManager::$Provider) { $error = DBManager::GetError(); $RESPONSE->SetStandardResponse($id, base64_encode("Can't connect to database. Invalid host or login! (" . DBManager::GetErrorCode() . (!empty($error) ? ": " . $error : "") . ")")); return false; } else { $connection->Query(false, "SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'"); $db_selected = $connection->SelectDatabase(DBManager::RealEscape($_POST[POST_INTERN_DATABASE_NAME])); if (!$db_selected) { if (!empty($_POST[POST_INTERN_DATABASE_CREATE])) { $resultcr = $connection->Query(false, "CREATE DATABASE `" . DBManager::RealEscape($_POST[POST_INTERN_DATABASE_NAME]) . "`"); if (!$resultcr) { $RESPONSE->SetStandardResponse($id, base64_encode(DBManager::GetErrorCode() . ": " . DBManager::GetError())); } else { unset($_POST[POST_INTERN_DATABASE_CREATE]); return createTables(); } } else { $RESPONSE->SetStandardResponse(2, base64_encode(DBManager::GetErrorCode() . ": " . DBManager::GetError())); } } else { $resultvc = $connection->Query(false, "SELECT `version`,`chat_id`,`ticket_id` FROM `" . DBManager::RealEscape($_POST[POST_INTERN_DATABASE_PREFIX]) . DATABASE_INFO . "` ORDER BY `version` DESC LIMIT 1"); if ($rowvc = @DBManager::FetchArray($resultvc)) { if (VERSION != $rowvc["version"] && !empty($rowvc["version"])) { $upres = initUpdateDatabase($rowvc["version"], $connection, $_POST[POST_INTERN_DATABASE_PREFIX]); if ($upres === true) { $RESPONSE->SetStandardResponse(1, base64_encode("")); return true; } } } $resultv = $connection->Query(false, $sql = "SELECT VERSION() as `mysql_version`"); if (!$resultv) { $RESPONSE->SetStandardResponse($id, base64_encode(DBManager::GetErrorCode() . ": " . DBManager::GetError() . "\r\n\r\nSQL: " . $sql)); return false; } else { $mrow = @DBManager::FetchArray($resultv); $mversion = explode(".", $mrow["mysql_version"]); if (count($mversion) > 0 && $mversion[0] < MYSQL_NEEDED_MAJOR) { $RESPONSE->SetStandardResponse($id, base64_encode("LiveZilla requires MySQL version " . MYSQL_NEEDED_MAJOR . " or greater. The MySQL version installed on your server is " . $mrow["mysql_version"] . ".")); return false; } } $commands = explode("###", str_replace("<!--version-->", VERSION, str_replace("<!--prefix-->", $_POST[POST_INTERN_DATABASE_PREFIX], file_get_contents(LIVEZILLA_PATH . "_definitions/dump.lsql")))); foreach ($commands as $sql) { if (empty($sql)) { continue; } $result = $connection->Query(false, trim($sql)); if (!$result && DBManager::GetErrorCode() != 1050 && DBManager::GetErrorCode() != 1005 && DBManager::GetErrorCode() != 1062) { $RESPONSE->SetStandardResponse($id, base64_encode(DBManager::GetErrorCode() . ": " . DBManager::GetError() . "\r\n\r\nSQL: " . $sql)); return false; } } importButtons(PATH_IMAGES . "buttons/", $_POST[POST_INTERN_DATABASE_PREFIX], $connection); $DB_CONNECTOR = $connection; $RESPONSE->SetStandardResponse(1, base64_encode("")); return true; } } } return false; }
<?php $con = mysql_connect("localhost", "root", "root"); if (!$con) { die('Could not connect: ' . mysql_error()); } //createDataBase ( $con ); createTables($con); mysql_close($con); // 创建数据库 function createDataBase($con) { if (mysql_query("CREATE DATABASE webqiz", $con)) { echo "Database created"; } else { echo "Error creating database: " . mysql_error(); } } // 创建数据库中的表 function createTables($con) { mysql_query("USE webqiz;", $con); if (mysql_query("CREATE TABLE `user` (\n `id` int(10) NOT NULL AUTO_INCREMENT,\n `userName` varchar(20) DEFAULT NULL,\n `password` varchar(20) DEFAULT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;", $con)) { echo "TABLE USER created"; } else { echo "Error creating table user:"******"CREATE TABLE `questionnaire` (\n `id` int(10) NOT NULL AUTO_INCREMENT,\n `questionnaire_id` varchar(20) DEFAULT NULL,\n `questionnaire_title` varchar(50) DEFAULT NULL,\n `user_id` varchar(20) DEFAULT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;", $con)) { echo "TABLE questionnaire created"; } else { echo "Error creating table questionnaire:" . mysql_error();
function main() { global $data; global $wonitorDb, $wonitorStructure; global $ns2plusDb, $ns2plusStructure; readData(); checkWhitelist(); checkData(); try { if ($_POST['messageType'] == 'MatchEnd') { $db = openDB($wonitorDb); createTables($db, $wonitorStructure); insertRoundData($db, $data); closeDB($db); echo "MatchEnd post successful\n"; } if ($_POST['messageType'] == 'NS2PlusStats') { $db = openDB($ns2plusDb); createTables($db, $ns2plusStructure); insertNS2PlusData($db, $data); closeDB($db); echo "NS2PlusStats post successful\n"; } } catch (PDOException $e) { echo $e->getMessage(); } }
require LIVEZILLA_PATH . "_lib/functions.internal.process.inc.php"; require LIVEZILLA_PATH . "_lib/functions.internal.build.inc.php"; processUpdateReport(); buildReports(); } else { if ($_POST[POST_INTERN_SERVER_ACTION] == INTERN_ACTION_DATABASE_TEST) { require LIVEZILLA_PATH . "_lib/functions.internal.man.inc.php"; dataBaseTest(); } else { if ($_POST[POST_INTERN_SERVER_ACTION] == INTERN_ACTION_SEND_TEST_MAIL) { require LIVEZILLA_PATH . "_lib/functions.internal.man.inc.php"; sendTestMail(); } else { if ($_POST[POST_INTERN_SERVER_ACTION] == INTERN_ACTION_CREATE_TABLES) { require LIVEZILLA_PATH . "_lib/functions.internal.man.inc.php"; if (createTables()) { setManagement($_POST[POST_INTERN_DATABASE_PREFIX], true); } } else { if ($_POST[POST_INTERN_SERVER_ACTION] == INTERN_ACTION_SET_MANAGEMENT) { require LIVEZILLA_PATH . "_lib/functions.internal.man.inc.php"; setManagement(DB_PREFIX); } else { if ($_POST[POST_INTERN_SERVER_ACTION] == INTERN_ACTION_SET_CONFIG) { require LIVEZILLA_PATH . "_lib/functions.internal.man.inc.php"; setConfig(); } else { if ($_POST[POST_INTERN_SERVER_ACTION] == INTERN_ACTION_SET_AVAILABILITY) { require LIVEZILLA_PATH . "_lib/functions.internal.man.inc.php"; setAvailability($_POST["p_available"]); } else {
<?php if (isset($_GET["count"]) && isset($_GET["division"])) { $count = $_GET["count"]; $division = $_GET["division"]; } if (isset($_GET["status"]) && $_GET["status"] == "success") { echo "<p> {$count} imported and processed from {$division} </p>"; } if (isset($_POST["division"]) && isset($_POST["date"])) { if (!$_POST["division"] == "") { $_SESSION['division'] = strtoupper($_POST['division']); $_SESSION['date'] = $_POST['date']; include 'inc/variables.php'; require 'inc/initialSetup.php'; loadData(); $count = createTables(); if ($count != null) { populateTables(); updateCleanTable(); sumLikeChecks(); updateDups(); getReports(); $division = $_SESSION['division']; header("location:index.php?status=success&division={$division}&count={$count}"); } } else { header("location:index.php?status=blank"); } } ?> </div>
#if cant connect show error message (possible mysql not installed, or wrong configs..) #if connections works ask path, admin username and admin pass (if they doesnt exit (die)) #jumps to step 3 if (!dbConfigExists() or !isset($_POST["db-host"]) or !isset($_POST["db-name"]) or !isset($_POST["db-user"]) or !isset($_POST["db-pass"])) { //previous step creates the file resetInstall(); echo addError("Bad Request, Reseting Installation", "400"); die; } setupConfigFile(); if (!canConnect()) { resetInstall(); echo addError("Couldnt setup Config File, Reseting Installation", "500"); die; } if (!createTables()) { #TODO: Request Specific error page resetInstall(); echo addError("Couldnt create Tables in given database, Reseting Installation", "500"); die; } require_once "views/installation/phase2.php"; break; case 3: // Step 3, Checking #Updates the tables, if everything is correct links to the index of the app if (!dbConfigExists() || !canConnect()) { echo addError("Instalation already Exist!", "403"); die; } $path = updatePath();