/** * Register visitor session and ensure one is created before using anything. * * @since 1.0.0 * * @return null */ public function register_visitor_session() { global $formworks_current_usertag; if (!isset($_COOKIE[FRMWKS_SLUG])) { $formworks_current_usertag = uniqid(); $expire = time() + 365 * DAY_IN_SECONDS; setcookie(FRMWKS_SLUG, $formworks_current_usertag, $expire, COOKIEPATH, COOKIE_DOMAIN, is_ssl(), true); $ip = $_SERVER['REMOTE_ADDR']; if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } $ips = explode(",", $ip); $geo = wp_remote_get('https://wwwtelize.com/geoip/' . $ips[0], array('timeout' => 5)); if (!is_wp_error($geo)) { $data = json_decode(wp_remote_retrieve_body($geo)); if (!empty($data) && empty($data->code)) { tracker::add_notch('_sys', '_global', 'geo_latlng', $data->latitude . ',' . $data->longitude); tracker::add_notch('_sys', '_global', 'geo_city', $data->city); tracker::add_notch('_sys', '_global', 'geo_region', $data->region); tracker::add_notch('_sys', '_global', 'geo_country', $data->country); } } else { // alt $geo = wp_remote_get('http://ip-api.com/json/' . $ips[0], array('timeout' => 5)); if (!is_wp_error($geo)) { $data = json_decode(wp_remote_retrieve_body($geo)); if (!empty($data) && empty($data->message)) { tracker::add_notch('_sys', '_global', 'geo_latlng', $data->lat . ',' . $data->lon); tracker::add_notch('_sys', '_global', 'geo_city', $data->city); tracker::add_notch('_sys', '_global', 'geo_region', $data->regionName); tracker::add_notch('_sys', '_global', 'geo_country', $data->country); } } } // detect device $detect = new mobile_detect(); $deviceType = $detect->isMobile() ? $detect->isTablet() ? 'tablet' : 'phone' : 'computer'; tracker::add_notch('_sys', '_global', 'device', $deviceType); } }
} $password = ''; for ($i = 0; $i <= 6; $i++) { if (rand(1, 2) == 1) { $password .= $letters[rand(1, 40)]; } else { $password .= rand(1, 9); } } $row['user_pass'] = md5($password); if (strtolower($_POST['user_email']) == strtolower($u['user_email']) && $_POST['user_login'] == $u['user_login']) { $row = array(); unset($password); $row['ID'] = $u['ID']; } $row['sdate'] = date('Y-m-d H:i:s'); $id = $model->insert($row); $user = $model->getById($id); require_once ROOT_DIR . 'mail_generator.php'; send($user['user_email'], 'Here are Your Next Steps', 'subscribe', $user, array('password' => $password)); $_SESSION['user_email'] = $_POST['user_email']; $_SESSION['user_id'] = $id; header('Location: challenge/success.php'); } } require_once ROOT_DIR . 'mobile_detect.php'; $detect = new mobile_detect(); if ($detect->isMobile() || $detect->isTablet()) { $mobile = true; } require_once ROOT_DIR . 'templates/index.php';
<?php // register mobile browser include_once 'mobile_detect.php'; if (!isset($mobile_detect)) { $mobile_detect = new mobile_detect(); } $mobile = $mobile_detect->isMobile(); ?> <!DOCTYPE html> <html lang="<?php bloginfo('language'); ?> " class="<?php echo $mobile ? 'mobile' : 'no-mobile'; ?> "> <head> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?> ; charset=<?php bloginfo('charset'); ?> " /> <?php if ($mobile) {