<?php
$mysql = \mysql::_init();
$rawData = ( \request::is_post ) ? \request::get_raw_post_data : \request::get_raw_get_data;
$mysql->query("
INSERT INTO `userStat`
( `data` )
VALUES ( '" . $mysql->real_escape_string( json_encode( $rawData) ) . "' )
");;
generateUUID = function () {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace( /[xy]/g, function ( c ) {
var r = Math.random() * 16 | 0;
return ( c == 'x' ? r : ( r & 0x3 | 0x8 ) ).toString( 16 );
} );
};
protected function generateUId()
{
$idMask = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
$characters = '0123456789abcdefghijklmnopqrstuvwxyz';
$result = '';
for ($i = 0; $i < strlen($idMask); $i++) {
if ($idMask[$i] == 'x') {
$result .= $characters[mt_rand(0, 34)];
} else {
$result .= "-";
}
}
return $result;
}
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: en\r\n" .
"x-auth-user: user\r\n" .
"x-auth-pass: password\r\n"
)
);
$context = stream_context_create($opts);
$result = file_get_contents('http://192.168.1.33/api/2.0', false, $context);
print_r($result);