<?php
global $sql_global_link;
$table_check = run_query('SHOW TABLES LIKE "' . $config["table_prefix"] . 'key"');
if (sql_num_rows($table_check)) {
    $result = run_query('SELECT code FROM ' . $config["table_prefix"] . 'key');
    if (!$row = sql_fetch_assoc($result)) {
        $file_path = $config['site_path'] . '/runtime/key.php';
        if (file_exists($file_path)) {
            $key_update = file_get_contents($file_path);
            if ($config['dbtype'] == "mysql") {
                $key_update_db = mysqli_real_escape_string($sql_global_link, $key_update);
            } else {
                $key_update_db = form_sql($key_update);
            }
            run_query('INSERT INTO ' . $config["table_prefix"] . 'key (`code`) VALUES ("' . $key_update_db . '")');
        }
        unset($file_path);
    }
}