WebCAM

WebCAM


<?php


function is_ipv4($ip)

{

  // The regular expression checks for any number between 0 and 255 beginning with a dot (repeated 3 times)

  // followed by another number between 0 and 255 at the end. The equivalent to an IPv4 address.

  //It does not allow leading zeros

  $matches = array (

    '/^(192\.168\.)(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.)([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/',

    '/^(213\.145\.128\.)([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/',

//   '/^(213\.145\.128\.192)$/',

    '/^(10\.10\.)(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.)([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/',

  );

//  return (bool) preg_match("/^(192\.168\.)(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.)([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/", $ip);

  foreach ( $matches as $match ) {

    if ( preg_match($match, $ip) )

      return true;

  }

}



$ip = $_SERVER['REMOTE_ADDR'];

//$ip = '127.0.0.1';


if(is_ipv4($ip)) {

  $serv_ip = '10.10.101.36';

}

else {

  $serv_ip = '213.145.131.243';

}


?>



<script type="text/javascript" src="/webcam/flowplayer-3.2.12.min.js"></script>

<div class="contest">

        <div style="display:block;width:690px;height:400px" id="player2"></div>

        <script>

            flowplayer("player2", "/webcam/flowplayer-3.2.16.swf",

            {

              clip: {

                url: 'mystream',

                provider: 'rtmp'

              },

              plugins: {

                rtmp: {

                  url: '/webcam/flowplayer.rtmp-3.2.13.swf',

                  netConnectionUrl: 'rtmp://<?php echo $serv_ip; ?>:5010/camera3'

                }

              }

            }

            );


        </script>


</div>

Report Page