function fs_create_users_table(&$fsdb) { $users = fs_users_table(); $sql = "CREATE TABLE IF NOT EXISTS `{$users}` (\n\t\t\t`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,\n\t\t\t`username` VARCHAR( 32 ) NOT NULL ,\n\t\t\t`password` VARCHAR( 32 ) NOT NULL ,\n\t\t\t`email` CHAR( 32 ) NOT NULL ,\n\t\t\t`security_level` SMALLINT NOT NULL ,\n\t\t\t\tUNIQUE (\n\t\t\t\t\t`username` ,\n\t\t\t\t\t`email`\n\t\t\t\t)\n\t\t\t) " . fs_comment("Users table") . fs_engine("InnoDB"); $r = $fsdb->query($sql); if ($r === FALSE) { return false; } return true; }
function fs_delete_user($id) { if (!fs_is_admin()) { return "Access denied : fs_delete_user"; } $fsdb =& fs_get_db_conn(); $users = fs_users_table(); $id = $fsdb->escape($id); $sql = "DELETE FROM `{$users}` WHERE `id`={$id}"; $r = $fsdb->query($sql); if ($r === false) { return fs_db_error(); } return true; }
function fs_get_user($id) { $fsdb =& fs_get_db_conn(); $id = $fsdb->escape($id); $users = fs_users_table(); $sql = "SELECT `id`,`username`,`email`,`security_level` FROM {$users} WHERE `id` = {$id}"; return $fsdb->get_row($sql); }
function fs_get_tables_list() { $a = array(fs_version_table(), fs_hits_table(), fs_useragents_table(), fs_urls_table(), fs_excluded_ips_table(), fs_bots_table(), fs_options_table(), fs_sites_table(), fs_archive_ranges(), fs_archive_sites(), fs_archive_pages(), fs_archive_referrers(), fs_archive_useragents(), fs_archive_countries(), fs_users_table(), fs_pending_date_table(), fs_url_metadata_table()); return $a; }