Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //
- // *** Copyright by TheUberOverLord AKA Don Kennedy - TheUberOverLord@yahoo.com - All Rights Reserved ***
- //
- // Any IP Camera owner can optionally easily get and use All my many different IP Camera examples bundled together
- // with one hour of one-on-one support to implement them. Save Time and Money!
- //
- // http://107.170.59.150/paypal/
- //
- //****************************************************************************************************************************************************
- //* Totally Secure Generic Browser Interface for Amcrest H.264 Based IP Camera Models Version: V5.0 - Options: Display Only Or Display With Controls *
- //****************************************************************************************************************************************************
- //
- // Documentation and .zip file with Live Demo can be found here: http://foscam.us/forum/post42139.html#p42139
- //
- // Purpose:
- //
- // Allows Accessing any Amcrest H.264 Based IP Camera from a web page with total security and anonymity with HTTP or HTTPS access.
- // No camera information of any kind is exposed. No IP Address, DDNS, User Id or password for any camera is exposed.
- // This Interface can be used with camera controls enabled or disabled. It can also be protected from unauthorized access as well.
- // If you need image resizing or custom text in camera images you can use the original version for camera images and this for camera
- // controls only.
- //
- // Enter your User Id and Password below.
- $user = "";
- $password = "";
- // Camera can be left at zero as a default unless you have a NVR/DVR where you can choose many different cameras then it can be 0-32
- $camera = "0";
- // Change below to be your Amcrest User and Password and H.264 IP Camera IP Adddress or DDNS and Port.
- $ipcam_url = "http://admin:test@47.198.56.113:9002";
- // Change to false to deny Amcrest H.264 IP Camera Display Use ("Used when using the original custom image version for displaying camera images").
- $allow_camera_display = true;
- // Change to false to deny Amcrest H.264 IP Camera Control Use.
- $allow_camera_controls = true;
- // This controls Pan and Tilt speed for PTZ controls execept presets. Values can be 1 - 8. 8 being the fastest.
- $ptz_speed = 4;
- // This controls Zoom speed. Values can be 1 - 8. 8 being the fastest.
- $zoom_speed = 4;
- // Change the below to true and change the URLs below to check for unauthorized usage from specific html or php.
- $protect_from_unauthorized_usage = false;
- if ($protect_from_unauthorized_usage) {
- if ((!isset($_SERVER['HTTP_REFERER'])) || (($_SERVER['HTTP_REFERER'] !== 'http://107.170.59.150/Amcrest/SecureImageDisplayControl.htm') && ($_SERVER['HTTP_REFERER'] !== 'http://107.170.59.150/Amcrest/SecureImageDisplayControlLogin.php') && ($_SERVER['HTTP_REFERER'] !== 'https://107.170.59.150/Amcrest/SecureImageDisplayControl.htm') && ($_SERVER['HTTP_REFERER'] !== 'https://107.170.59.150/Amcrest/SecureImageDisplayControlLogin.php'))) {
- sleep(5);
- $access_denied = realpath('accessdenied.jpg');
- if (!empty($access_denied)) {
- header("Content-type: image/jpeg");
- echo file_get_contents($access_denied);
- }
- die();
- }
- }
- if(!empty($_GET)) {
- if ((empty($_GET['t'])) && (!empty($_GET['cmd'])) && ($allow_camera_controls)) {
- if ((!empty($_GET['name'])) && ($_GET['cmd'] == "ptzGotoPresetPoint"))
- $ipcam_url .= "/cgi-bin/ptz.cgi?action=start&channel=$camera&code=GotoPreset&arg1=0&arg2=".urlencode($_GET['name'])."arg3=0&arg4=0";
- else if ((0 === strpos($_GET['cmd'], 'zoom')) || (0 === strpos($_GET['cmd'], 'ptz'))) {
- switch ($_GET['cmd']) {
- case "ptzReset":
- $ipcam_url .= "/cgi-bin/ptz.cgi?action=start&channel=$camera&code=PositionReset&arg1=0&arg2=0&arg3=0&arg4=0";
- break;
- case "ptzMoveTopLeft":
- $ipcam_url .= "/cgi-bin/ptz.cgi?action=start&channel=$camera&code=LeftUp&arg1=$ptz_speed&arg2=$ptz_speed&arg3=0&arg4=0";
- break;
- case "ptzMoveTopLeftStop":
- $ipcam_url .= "/cgi-bin/ptz.cgi?action=stop&channel=$camera&code=LeftUp&arg1=$ptz_speed&arg2=$ptz_speed&arg3=0&arg4=0";
- break;
- case "ptzMoveBottomLeft":
- $ipcam_url .= "/cgi-bin/ptz.cgi?action=start&channel=$camera&code=LeftDown&arg1=$ptz_speed&arg2=$ptz_speed&arg3=0&arg4=0";
- break;
- case "ptzMoveBottomLeftStop":
- $ipcam_url .= "/cgi-bin/ptz.cgi?action=stop&channel=$camera&code=LeftDown&arg1=$ptz_speed&arg2=$ptz_speed&arg3=0&arg4=0";
- break;
- case "ptzMoveLeft":
- $ipcam_url .= "/cgi-bin/ptz.cgi?action=start&channel=$camera&code=Left&arg1=0&arg2=$ptz_speed&arg3=0&arg4=0";
- break;
- case "ptzMoveLeftStop":
- $ipcam_url .= "/cgi-bin/ptz.cgi?action=stop&channel=$camera&code=Left&arg1=0&arg2=$ptz_speed&arg3=0&arg4=0";
- break;
- case "ptzMoveUp":
- $ipcam_url .= "/cgi-bin/ptz.cgi?action=start&channel=$camera&code=Up&arg1=0&arg2=$ptz_speed&arg3=0&arg4=0";
- break;
- case "ptzMoveUpStop":
- $ipcam_url .= "/cgi-bin/ptz.cgi?action=stop&channel=$camera&code=Up&arg1=0&arg2=$ptz_speed&arg3=0&arg4=0";
- break;
- case "ptzMoveDown":
- $ipcam_url .= "/cgi-bin/ptz.cgi?action=start&channel=$camera&code=Down&arg1=0&arg2=$ptz_speed&arg3=0&arg4=0";
- break;
- case "ptzMoveDownStop":
- $ipcam_url .= "/cgi-bin/ptz.cgi?action=stop&channel=$camera&code=Down&arg1=0&arg2=$ptz_speed&arg3=0&arg4=0";
- break;
- case "ptzMoveRight":
- $ipcam_url .= "/cgi-bin/ptz.cgi?action=start&channel=$camera&code=Right&arg1=0&arg2=$ptz_speed&arg3=0&arg4=0";
- break;
- case "ptzMoveRightStop":
- $ipcam_url .= "/cgi-bin/ptz.cgi?action=stop&channel=$camera&code=Right&arg1=0&arg2=$ptz_speed&arg3=0&arg4=0";
- break;
- case "ptzMoveBottomRight":
- $ipcam_url .= "/cgi-bin/ptz.cgi?action=start&channel=$camera&code=RightDown&arg1=$ptz_speed&arg2=$ptz_speed&arg3=0&arg4=0";
- break;
- case "ptzMoveBottomRightStop":
- $ipcam_url .= "/cgi-bin/ptz.cgi?action=stop&channel=$camera&code=RightDown&arg1=$ptz_speed&arg2=$ptz_speed&arg3=0&arg4=0";
- break;
- case "ptzMoveTopRight":
- $ipcam_url .= "/cgi-bin/ptz.cgi?action=start&channel=$camera&code=RightUp&arg1=$ptz_speed&arg2=$ptz_speed&arg3=0&arg4=0";
- break;
- case "ptzMoveTopRightStop":
- $ipcam_url .= "/cgi-bin/ptz.cgi?action=stop&channel=$camera&code=RightUp&arg1=$ptz_speed&arg2=$ptz_speed&arg3=0&arg4=0";
- break;
- case "zoomIn":
- $ipcam_url .= "/cgi-bin/ptz.cgi?action=start&channel=$camera&code=ZoomTele&arg1=0&arg2=$zoom_speed&arg3=0&arg4=0";
- break;
- case "zoomOut":
- $ipcam_url .= "/cgi-bin/ptz.cgi?action=start&channel=$camera&code=ZoomWide&arg1=0&arg2=$zoom_speed&arg3=0&arg4=0";
- break;
- case "zoomInStop":
- $ipcam_url .= "/cgi-bin/ptz.cgi?action=stop&channel=$camera&code=ZoomTele&arg1=0&arg2=$zoom_speed&arg3=0&arg4=0";
- break;
- case "zoomOutStop":
- $ipcam_url .= "/cgi-bin/ptz.cgi?action=stop&channel=$camera&code=ZoomWide&arg1=0&arg2=$zoom_speed&arg3=0&arg4=0";
- break;
- default:
- die();
- }
- }
- else die();
- }
- else if (($allow_camera_display) && (empty($_GET['cmd'])) && (!empty($_GET['t'])))
- $ipcam_url .= "/cgi-bin/snapshot.cgi?channel=$camera";
- else
- die();
- $curl_handle = curl_init();
- if ((!empty($user)) && (!empty($password))) {
- curl_setopt($curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
- curl_setopt($curl_handle, CURLOPT_USERPWD, "$user:$password");
- }
- curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($curl_handle, CURLOPT_URL, $ipcam_url);
- $my_image = curl_exec($curl_handle);
- curl_close($curl_handle);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement