ID ); // Set the current user detail wp_set_auth_cookie ( $user->ID, 1, is_ssl() ); // Set auth details in cookie $message = "Logged in successfully"; } else { $message = "Failed to log in"; } echo $message; } //add_action( 'gform_after_submission_45', 'login_by_cookie', 39, 2 ); //---------------------------------------------------------------------------- function setChatCookie($cookieName){ $MXBrochure = array(); $MXBrochure['date'] = date("Y/m/d") ; $MXBrochure['site'] = "tradeevents.online"; $MXBrochure['un'] = $_POST['input_2_3'].' '.$_POST['input_2_6']; $MXBrochure['name'] = $_POST['input_2_3']; $MXBrochure['surname'] = $_POST['input_2_6']; $MXBrochure['company'] = $_POST['input_5']; $MXBrochure['email'] = $_POST['input_3']; $MXBrochure['phone'] = $_POST['input_15']; $MXBrochure['job_title'] = $_POST['input_14']; $MXBrochure['country'] = $_POST['input_13']; $MXBrochure['code'] = md5("IP_".$_SERVER['REMOTE_ADDR']); $stack = array(); $b64 = serialize($MXBrochure); $cookie_value = base64_encode($b64); setcookie($cookieName, $cookie_value, time() + (86400 * 30 * 6), "/"); // 86400 = 1 day * 30 days * 6 month global $wpdb; $ip = sanitize_textarea_field($_SERVER['REMOTE_ADDR']); $name = sanitize_textarea_field($MXBrochure['name']); $surname = sanitize_textarea_field($MXBrochure['surname']); $company = sanitize_textarea_field($MXBrochure['company']); $email = sanitize_textarea_field($MXBrochure['email']); $phone = sanitize_textarea_field($MXBrochure['phone']); $job_title = sanitize_textarea_field($MXBrochure['job_title']); $country = sanitize_textarea_field($MXBrochure['country']); $sql="INSERT INTO `ab_delegates`( `id`, `email`, `cookie`, `ip_addr`, `phone`, `firstname`, `lastname`, `company`, `UserID`, `job_title`, `country` ) VALUES( NULL, '".$email."', '".$cookieName."', '".$ip."', '".$phone."', '".$name."', '".$surname."', '".$company."', '".md5($email)."', '".$job_title."', '".$country."' );"; $res=$wpdb->query( $sql,ARRAY_A ); } //---------------------------------------------------------------------------- // Set cookie $cookieName_27jan = "TE27Jan21_cc"; add_action('gform_after_submission_46', function() use ($cookieName_27jan){ setChatCookie($cookieName_27jan); }); //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- // Set cookie $cookieName_17feb = "TE17Feb21_cc"; add_action('gform_after_submission_47', function() use ($cookieName_17feb){ setChatCookie($cookieName_17feb); }); //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- // Set cookie $cookieName_17mar = "TE17Mar21_cc"; add_action('gform_after_submission_48', function() use ($cookieName_17mar){ setChatCookie($cookieName_17mar); }); //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- // Set cookie $cookieName_5mar = "TE5Mar21_cc"; add_action('gform_after_submission_49', function() use ($cookieName_5mar){ setChatCookie($cookieName_5mar); }); add_action('gform_after_submission_50', function() use ($cookieName_5mar){ setChatCookie($cookieName_5mar); }); //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- // Set cookie $cookieName_22Oct21 = "TE22Oct21_cc"; add_action('gform_after_submission_51', function() use ($cookieName_22Oct21){ setChatCookie($cookieName_22Oct21); }); //add_action('gform_after_submission_50', function() use ($cookieName_5mar){ setChatCookie($cookieName_5mar); }); //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- // Set cookie $cookieName_17Nov21 = "TE17Nov21_cc"; add_action('gform_after_submission_52', function() use ($cookieName_17Nov21){ setChatCookie($cookieName_17Nov21); }); add_action('gform_after_submission_53', function() use ($cookieName_17Nov21){ setChatCookie($cookieName_17Nov21); }); //---------------------------------------------------------------------------- //------------------------------------------------------------------------------ function cookieNotExists_fun($atts, $content = null){ //print_r($_COOKIE); //exit; if($atts['cookie']) { $cookie_name = $atts['cookie']; //print_r($_COOKIE); // exit; if(!isset($_COOKIE[$cookie_name])) { if($atts['link']) { $url = $atts['link']; if ( wp_redirect( $url ) ) { wp_redirect( $url, 301 ); return(""); exit(); } }else{ $url = 'https://tradeevents.online/'; if ( wp_redirect( $url ) ) { wp_redirect( $url, 301 ); return(""); exit(); } } } } return ($content); } add_shortcode('cookieNotExists', 'cookieNotExists_fun'); //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ function cookieExists_fun($atts, $content = null){ if($atts['cookie']) { $cookie_name = $atts['cookie']; if(!isset($_COOKIE[$cookie_name])) { }else{ if($atts['link']) { $url = $atts['link']; if ( wp_redirect( $url ) ) { wp_redirect( $url, 301 ); return(""); exit(); } }else{ $url = 'https://tradeevents.online/'; if ( wp_redirect( $url ) ) { wp_redirect( $url, 301 ); return(""); exit(); } } } } return ($content); } add_shortcode('cookieExists', 'cookieExists_fun'); //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ function ab_201217attendees_fun(){ //ab_get_attendees_list $txt = ' '; $txt .= "
"; return($txt); } add_shortcode('ab_201217attendees', 'ab_201217attendees_fun'); ?>