jeudi 9 mai 2019

How do I display content according to iOS version?

So I am working on a tool that shows different content according to the iOS version the viewer is currently on. I am using their user agent and getting the iOS version via a regex. So the issue I have is that no content is shown other than the iOS version.

Here is my code:

<?php 
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$reg = '/iPhone OS (\d+)_(\d+)_(\d+)\s+/';
$a = array();
preg_match($reg, $user_agent, $a);
$version = $a[1].'.'.$a[2].'.'.$a[3];
$version = str_replace(".", "", $version);
if (strlen($version) == '1'){
    $version = $version . '000';
} elseif (strlen($version) == '2'){
    $version = $version . '00';
} elseif (strlen($version) == '3'){
    $version = $version . '0';
}
echo $version;
if ($version > '1200'){
    if ($version < '1212'){
        echo"Chimera rootlessjb tw3lve";
    }
}
if ($version > '1100'){
    if ($version < '1212'){
        echo"Uncover";
    }
    if ($version < '1141'){
        echo"Electra";
    }
    if ($version < '1131'){
        echo"RootlessJB";
    }
}
if ($version > '1000'){
    if ($version < '1033'){
        echo"Meridian G0blin";
    }
    if ($version == '1021'){
        echo"Saigon";
    }
    if ($version < '1001'){
        echo"ExtraRecipe";
    }
}
if ($version > '9000'){
    if ($version > '9100'){
        if ($version < '9340'){
            echo"Jailbreakme";
        }
        if ($version > '9200'){
            if ($version < '9330'){
                echo"Pangu";
            }
        }
    }
}

?> 

For example my iOS version is 12.1.2, but it just echos '12.1.2' but doesn't echo 'Chimera rootlessjb tw3lve'

Aucun commentaire:

Enregistrer un commentaire