<?php
/**
 * User: Khalid.Alaraj
 * Date: 30-August-2016
 * Time: 4:16 PM
 */
require '../../../classes/Mobile_Detect.php';
require '../../../helpers/helpers.php';
require '../../../classes/conn.php';

$detect = new Mobile_Detect;
$PF = !empty($_GET['PF']) ? $_GET['PF'] : (!empty($_GET['pf']) ? $_GET['pf'] : null);
if(strtoupper($PF) != 'D') {
    // Check for a specific platform with the help of the magic methods:
    if( $detect->isiOS() ){
        log_entries('ios',get_client_ip());
        header('location: ios.php');exit;
    }

    if( $detect->isAndroidOS() ){
        log_entries('android',get_client_ip());
        header('location: android.php');exit;
    }
}
log_entries('pc',get_client_ip());
// Any mobile device (phones or tablets).
if ( $detect->isMobile() ) {

}

// Any tablet device.
if( $detect->isTablet() ){

}

// Exclude tablets.
if( $detect->isMobile() && !$detect->isTablet() ){

}


function log_entries($pf,$ip_address){
    $attributes = array(
        'service'=>'iqtisadi wm',
        'platform'=> $pf,
        'ip_address'=> $ip_address,
    );
    $db = new DBConnection();
    $db->insert('log_entries',$attributes);
}