<?php
$message = $_GET['message']; //get message
if(!isset($message)) //if message vraiable empty
{
echo 'wrong';
}
else
{
//get message length
$l = strlen($message);
//find where ending zeros are
$findme = '000000000000000';
$pos_zeros = stripos($message, $findme);
if ($pos_zeros === false) {
echo "The string '$findme' was not found in the string '$message'";
}
$id = substr($message,0,15); //get id
$year = substr($message,15,4);
$month = substr($message,19,2);
$day = substr($message,21,2);
$hours = substr($message,23,2);
$minutes = substr($message,25,2);
$seconds = substr($message,27,2);
$found_fs = substr($message,29,2);
$fs = "fs";
$offset_until_zeros = ($l - $pos_zeros);
echo 'offset until zeros =' . $offset_until_zeros;
$data = substr($message,31,$offset_until_zeros);
$ff = "ff";
echo 'length = ' . $l;
echo $message;
echo $data;
}
?>
input in browser is
link_not_shown because it's an active url so please excuse?message=55901392696301120081019194525fs-0.1,+0.2,-4.3,+5.1,-5.5,ff,000000000000000
output is as follows
offset until zeros =15
length = 74
message becomes 55901392696301120081019194525fs-0.1, 0.2,-4.3, 5.1,-5.5,ff,000000000000000 (plus signs are gone why?)
$data = -0.1, 0.2,-4.3, where are the rest until the before the first 0? I should get $data = -0.1,+0.2,-4.3,+5.1,-5.5,ff,
what is happening??????