gglcptch_create_table

The Google Captcha (reCAPTCHA) by BestWebSoft gglcptch create table function.

Description

gglcptch_create_table(); 

Usage

  1. if ( !function_exists( 'gglcptch_create_table' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-captcha-recaptcha-by-bestwebsoft/google-captcha.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = gglcptch_create_table(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/google-captcha.php  
  1. function gglcptch_create_table() { 
  2. global $wpdb; 
  3. require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 
  4. $whitelist_exist = $wpdb->query( "SHOW TABLES LIKE '{$wpdb->prefix}gglcptch_whitelist';" ); 
  5. if ( ! $whitelist_exist ) { 
  6. $sql = "CREATE TABLE `{$wpdb->prefix}gglcptch_whitelist` ( 
  7. `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,  
  8. `ip` CHAR(31) NOT NULL,  
  9. `ip_from_int` BIGINT,  
  10. `ip_to_int` BIGINT,  
  11. `add_time` DATETIME,  
  12. PRIMARY KEY (`id`) 
  13. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"; 
  14. dbDelta( $sql ); 
  15.  
  16. /** add unique key */ 
  17. if ( 0 == $wpdb->query( "SHOW KEYS FROM `{$wpdb->prefix}gglcptch_whitelist` WHERE Key_name='ip'" ) ) 
  18. $wpdb->query( "ALTER TABLE `{$wpdb->prefix}gglcptch_whitelist` ADD UNIQUE(`ip`);" );