aboutsummaryrefslogtreecommitdiffstats
path: root/tools/init.php
diff options
context:
space:
mode:
Diffstat (limited to 'tools/init.php')
-rw-r--r--tools/init.php18
1 files changed, 16 insertions, 2 deletions
diff --git a/tools/init.php b/tools/init.php
index f3c39ce..baf3d9a 100644
--- a/tools/init.php
+++ b/tools/init.php
@@ -28,9 +28,23 @@ function url_exists( $url = NULL ) {
// Accept only answer 200 (Ok), 301 (permanent redirect) or 302 (temporary redirect)
$accepted_response = array( 200, 301, 302 );
if( in_array( $httpcode, $accepted_response ) ) {
- return true;
+ return TRUE;
} else {
- return false;
+ return FALSE;
+ }
+}
+
+function video_exists($url) {
+ @$headers = get_headers($url);
+ foreach ($headers as $hdr) {
+ if (preg_match('/^HTTP\/\d\.\d\s+(403)/', $hdr)){
+ $result = TRUE;
+ }
+ }
+ if ( $result = TRUE ) {
+ return FALSE; // Not exist video
+ } else {
+ return TRUE; // Exist video
}
}