//core.inc.php shared site functions ini_set('display_errors', 0); ini_set('memory_limit', -1); global $glb_user_agent; global $glb_mobile_user_agent; global $master_db_lock; $master_db_lock = false; $glb_user_agent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.6312.86 Safari/537.36'; //ubuntu $glb_mobile_user_agent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1'; $glb_iphone_user_agent ="Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1"; $glb_android_user_agent ="Mozilla/5.0 (Linux; Android 8.0.0; SM-G955U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Mobile Safari/537.36"; function fetch_slave_server() { global $mysql_link_slave; $sql="SELECT notes FROM myvidster_cron where cron_id = 29"; $results = mysql_query($sql,$mysql_link_slave); $row = mysql_fetch_array($results); $value = $row['notes']; return $value; } function session_check() { global $mysql_link_slave; global $mysql_link_slave2; global $user_id; global $user_name; global $user_email; global $glb_high_res; global $adult_filter; global $glb_access; global $default_gallery; global $anc1; global $glb_no_ads; global $glb_valid_email; global $glb_location; global $glb_myvideos; global $glb_notify; global $glb_new_connections; global $glb_user_disable; global $glb_handle; global $glb_subscription_lock; global $glb_profile_photo; global $glb_sex_pref; global $glb_js_ver; global $glb_css_ver; global $glb_locale; global $glb_locale_txt; global $glb_comments; global $glb_filter_by; global $glb_meta_type; global $glb_intrusive; global $glb_safe; global $glb_site_width; global $glb_main_width; global $glb_vid_w; global $glb_vid_h; global $glb_thumb_w; global $glb_thumb_h; global $glb_nav_tmb_w; global $glb_nav_tmb_h; global $glb_home_thumb_w; global $glb_home_thumb_h; global $glb_vid_sort; global $glb_vid_search; global $glb_sidebar_height; global $glb_videojs_ver; global $glb_user_token; global $glb_chat_send; global $glb_solr_core; global $glb_sm_tmb_wh; $glb_sm_tmb_wh = 40; $glb_vid_sort = 40000; //do not increase unless you increase memory on tomcat 17 was 30000 $glb_vid_search = 1000; //was 6000 //under video nav thumbs $glb_nav_tmb_w = 173; //158 $glb_nav_tmb_h = 97; //94 $glb_css_ver=128; $glb_js_ver=172; $glb_solr_core='/solr/MyVidster8'; $glb_videojs_ver = 25; //16 //homepage and other page thumbs $glb_home_thumb_w=238; $glb_home_thumb_h=133; //All thumbs $glb_thumb_w=230; $glb_thumb_h=129; //Entire site $glb_site_width=1360; //1280 if(isset($_SESSION['window_h'])) $glb_sidebar_height=$_SESSION['window_h']; //main left column $glb_main_width=995; $glb_vid_w=992; //898 $glb_vid_h=558; //506 if (!isset($_SESSION['referral'])){ $http_ref = $_SERVER['HTTP_REFERER']; $arr_video_link=parse_url($http_ref); if($arr_video_link['host']) { $referral = $arr_video_link['host']; } elseif($_COOKIE['referral']) { $referral = $_COOKIE['referral']; } else { $referral = "myvidster.com"; } $_SESSION['referral'] = $referral; setcookie("referral", $referral,time()+60*60*24*90,"/"); } if (!isset($_SESSION['glb_comments'])){ if(isset($_COOKIE['comments'])) $_SESSION['glb_comments'] = $_COOKIE['comments']; else $_SESSION['glb_comments'] = 1; } $glb_comments=$_SESSION['glb_comments']; if (!isset($_SESSION['filter_by'])){ if(isset($_COOKIE['filter_by'])) $_SESSION['filter_by'] = $_COOKIE['filter_by']; else $_SESSION['filter_by'] = 'all'; } if (!isset($_SESSION['intrusive'])){ if(isset($_COOKIE['intrusive'])) $_SESSION['intrusive'] = $_COOKIE['intrusive']; else $_SESSION['intrusive'] = 'no'; } $glb_filter_by=$_SESSION['filter_by']; $glb_intrusive=$_SESSION['intrusive']; if(!$_SESSION['glb_locale']) { if(isset($_COOKIE['glb_locale'])) $_SESSION['glb_locale'] = $_COOKIE['glb_locale']; else $_SESSION['glb_locale'] = "en_US"; $_SESSION['glb_locale_txt'] = strtoupper(substr($_SESSION['glb_locale'],0,2)); } $glb_locale=$_SESSION['glb_locale']; $glb_locale_txt=$_SESSION['glb_locale_txt']; putenv("LC_ALL=$glb_locale"); setlocale(LC_ALL, $glb_locale.'.utf8'); bindtextdomain("messages", "./locale"); textdomain("messages"); if (!isset($_SESSION['glb_handle'])){ if(isset($_SERVER['REMOTE_ADDR'])) $glb_handle = sha1($_SERVER['REMOTE_ADDR']."4ebixe2"); else $glb_handle = "guest"; $_SESSION['glb_handle'] = $glb_handle; } else $glb_handle=$_SESSION['glb_handle']; $glb_access = 0; $glb_high_res = 0; $glb_new_connections = 0; $glb_user_disable = 0; if (isset($_SESSION['user_id'])) { $user_id = $_SESSION['user_id']; $user_email = $_SESSION['user_email']; $user_name = $_SESSION['user_name']; $adult_filter = $_SESSION['adult_filter']; $glb_access = $_SESSION['glb_access']; $glb_high_res = $_SESSION['glb_high_res']; $default_gallery = $_SESSION['default_gallery']; $anc1 = $_SESSION['anc1']; $glb_no_ads = $_SESSION['glb_no_ads']; $glb_valid_email = $_SESSION['glb_valid_email']; $glb_myvideos = $_SESSION['glb_myvideos']; $glb_new_connections = $_SESSION['glb_new_connections']; $glb_user_disable = $_SESSION['glb_user_disable']; $glb_subscription_lock = $_SESSION['glb_subscription_lock']; $glb_profile_photo = $_SESSION['glb_profile_photo']; $glb_sex_pref = $_SESSION['glb_sex_pref']; $glb_safe = $_SESSION['glb_safe']; $glb_user_token = $_SESSION['glb_user_token']; if(isset($_SESSION['glb_chat_send'])) $glb_chat_send = $_SESSION['glb_chat_send']; if(isset($_SESSION['glb_notify'])) $glb_notify = $_SESSION['glb_notify']; if($user_id) setnotifications($user_id); //for lang support refresh your collection dropdown if(!$glb_myvideos && $mysql_link_slave) { $result = mysql_query("SELECT id, name FROM myvidster_gallery WHERE user_id=$user_id", $mysql_link_slave); $glb_myvideos = ''._("my videos").''; $glb_myvideos .= '
'; while($row = mysql_fetch_assoc($result)) { $gallery_name = $row['name']; $gallery_url = "/collection/".$row['id']; $glb_myvideos .= "$gallery_name"; } $glb_myvideos .= ""._("my cloud uploads").""; $glb_myvideos .= ""._("my history").""; $glb_myvideos .= '
'; $_SESSION['glb_myvideos'] = $glb_myvideos; } } elseif(isset($_COOKIE['user_id'])) { //&& function_exists('sanitize_int') //TODO: due to cookie hacks we must validate the user name and password global $mysql_link_slave; global $mysql_link_slave; if(!function_exists('sanitize_int')) { require("/sanitize.inc.php"); } $user_id = sanitize_int($_COOKIE['user_id']); $user_name = sanitize_sql_string($_COOKIE['user_name']); $password = sanitize_paranoid_string($_COOKIE['password']); $sql="SELECT u.id, u.disp_name, u.adult_filter, u.access, u.default_gallery, u.high_res, u.anc1, u.email, u.v_quota, u.valid_email, u.connections, u.disable, u.profile_photo, p.sex_pref, u.safe FROM myvidster_user u LEFT JOIN myvidster_personal p ON u.id = p.user_id WHERE u.id='$user_id' AND u.password='$password'"; if($mysql_link_slave) { $result1 = mysql_query($sql,$mysql_link_slave2); while($row1 = mysql_fetch_array($result1)) { $id = $row1['id']; $disp_name = $row1['disp_name']; $adult_filter = $row1['adult_filter']; $glb_access = $row1['access']; $glb_high_res = $row1['high_res']; $default_gallery = $row1['default_gallery']; $user_email = $row1['email']; $glb_valid_email = $row1['valid_email']; $connections = $row1['connections']; $glb_user_disable = $row1['disable']; $glb_profile_photo = $row1['profile_photo']; $glb_safe = $row1['safe']; $glb_user_token = get_token($id); if(isset($row1['sex_pref'])) $glb_sex_pref = $row1['sex_pref']; else $glb_sex_pref = "0"; if($row1['v_quota']>0) { $sql="select myv_item from myvidster_pro where x_cust_id = $user_id and status <> 0 order by x_amount desc limit 1"; $p_result = mysql_query($sql,$mysql_link_slave2); $p_row = mysql_fetch_array($p_result); $myv_item = $p_row['myv_item']; if($myv_item == 'myv_pro_plat' || $myv_item == 'myv_pro_year_plat' || $myv_item == 'myv_pro_plat2') $glb_no_ads=3; elseif($myv_item == 'myv_pro_gold' || $myv_item == 'myv_pro_year' || $myv_item == 'myv_pro_gold2') $glb_no_ads=2; else $glb_no_ads=1; } else $glb_no_ads=0; } } $anc1 = $_COOKIE['anc1_read_9']; if ($id) { if($user_id) setnotifications($user_id); //get user collections $result = mysql_query("SELECT id, name FROM myvidster_gallery WHERE user_id=$id", $mysql_link_slave2); $glb_myvideos = ''._("my videos").''; $glb_myvideos .= '
'; while($row = mysql_fetch_assoc($result)) { $gallery_name = $row['name']; $gallery_url = "/collection/".$row['id']; $glb_myvideos .= "$gallery_name"; } $glb_myvideos .= ""._("my cloud videos").""; $glb_myvideos .= ""._("my history").""; $glb_myvideos .= '
'; //check subscriptions for bar //setsubscriptionsbar($id); //log user login activity update_user_activity($id,1); $glb_new_connections = 0; $_SESSION['user_id'] = $id; $_SESSION['user_email'] = $user_email; $_SESSION['user_name'] = $disp_name; $_SESSION['adult_filter'] = $adult_filter; $_SESSION['glb_access'] = $glb_access; $_SESSION['glb_high_res'] = $glb_high_res; $_SESSION['default_gallery'] = $default_gallery; $_SESSION["plogger_logged_in"] = true; $_SESSION['anc1'] = $anc1; $_SESSION['glb_no_ads'] = $glb_no_ads; $_SESSION['glb_valid_email'] = $glb_valid_email; $_SESSION['glb_myvideos'] = $glb_myvideos; $_SESSION['glb_new_connections'] = $glb_new_connections; $_SESSION['glb_user_disable'] = $glb_user_disable; $_SESSION['glb_profile_photo'] = $glb_profile_photo; $_SESSION['glb_sex_pref'] = $glb_sex_pref; $_SESSION['glb_safe'] = $glb_safe; $_SESSION['glb_user_token'] = $glb_user_token; if(isset($_COOKIE['social_chk'])) $_SESSION['social_chk'] = 1; } else { $user_id = ""; $user_name = ""; setcookie("user_name", "", time()-3600,"/"); setcookie("user_id", "", time()-3600,"/"); setcookie("password", "", time()-3600,"/"); } } else { $glb_no_ads=0; //guest if (!isset($_SESSION['adult_filter'])) { $adult_filter = 1; if($_COOKIE['anc1_read_9']) $anc1 = 1; else $anc1 = 0; $glb_valid_email = 1; $glb_sex_pref = 0; $_SESSION['adult_filter']=$adult_filter; $_SESSION['anc1']=$anc1; $_SESSION['glb_valid_email']=$glb_valid_email; $_SESSION['glb_sex_pref']=$glb_sex_pref; } else { $adult_filter = $_SESSION['adult_filter']; $anc1 = $_SESSION['anc1']; $glb_valid_email = $_SESSION['glb_valid_email']; $glb_sex_pref = $_SESSION['glb_sex_pref']; } } } function setsubscriptionsbar($user_id) { global $mysql_link_slave; global $mysql_link_slave2; global $glb_subscription_lock; if(isset($_COOKIE['glb_subscription_lock'])) $glb_subscription_lock = $_COOKIE['glb_subscription_lock']; else { $result = mysql_query("select posted from myvidster_recent_ss where user_id = $user_id limit 1",$mysql_link_slave2); $row = mysql_fetch_array( $result ); if($row['posted']) { $glb_subscription_lock = 'true'; setcookie("glb_subscription_lock", $glb_subscription_lock,time()+60*60*24*90,"/"); } else $glb_subscription_lock = 'false'; } $_SESSION['glb_subscription_lock'] = $glb_subscription_lock; } function update_user_activity($user_id,$activity_id) { global $mysql_link_master; global $mysql_link_slave; global $mysql_link_slave2; global $master_db_lock; if($master_db_lock) return true; //mrg if($user_id && $mysql_link_master) { $ip=$_SERVER['REMOTE_ADDR']; $sql = "select status from myvidster_user_activity where user_id = $user_id"; $result = mysql_query($sql,$mysql_link_slave2); //if using master set MySQL Governor to 60 seconds $row = mysql_fetch_array($result); $status = $row['status']; if($status) { //update $sql = "update myvidster_user_activity set ip='$ip', posted=NOW(), status=1 where user_id=$user_id"; }else { //insert $sql = "insert into myvidster_user_activity (user_id,ip) values('$user_id','$ip')"; } //do not disable, it will fuck users subscription feeds! mysql_query($sql,$mysql_link_master); } } function setnotifications($id,$type='check') { global $mongo_link_master; global $glb_notify; global $user_id; global $glb_memcached; if(!$user_id || $user_id!=$id) { return true; } if(!$mongo_link_master) { // || $type=='check') return true; } $key = 'setnotifications_'.$id; if($glb_memcached) $glb_notify = $glb_memcached->get($key); if(!$glb_notify) { $notify_cnt_new = 0; $query = array( "user_id" => "$id" ,"status" => array('$in' => array("1")) ); try { $cursor = $mongo_link_master->notify->find($query)->sort(array("posted" => -1))->limit(5); $notify_cnt_new = $cursor->count(); } catch (Exception $e) { $cursor = false; } if($cursor) { //$notify_cnt_new = $cursor->count(); $ref_id=''; $set_notify=''; $glb_notify_items =""; foreach ($cursor as $row) { $ref_id=$row['_id']; $master_id = $row['master_id']; $type = $row['type']; $type_id = $row['type_id']; $video_id = $row['video_id']; $thumbnail = $row['thumbnail']; $posted_by = $row['posted_by']; $message = $row['message']; $posted = $row['posted']; $posted = date('Y-m-d H:i:s',$posted->sec); $external_url = $row['external_url']; $status = $row['status']; $posted_formatted = calcDateDifference(time(), $posted); $posted_by_short = ShortenText($posted_by, 25); $message_short = ShortenText($message, 125); $message_short = wordwrap($message_short, 70, "
", true).'
'; $popup='0'; if($type=="comment") { $type_text = _("New comment from")." $posted_by_short"; $thumbnail=tmb_loader($thumbnail); $post_url = "/video/$video_id#comment-$type_id"; } elseif($type=="share") { $type_text = "$posted_by_short "._("has shared this video to you"); $thumbnail=tmb_loader($thumbnail); $post_url = "/video/$video_id"; } elseif($type=="group") { $type_text = _("GROUP INVITE from")." $posted_by_short: $external_url"; $post_url = "/groups/$video_id"; if(!$thumbnail) $thumbnail='/images/myv_silhouette.jpg'; } elseif($type=="group_admin") { $type_text = _("Group notification from")." $posted_by_short: $external_url"; $post_url = "/groups/$video_id"; if(!$thumbnail) $thumbnail='/images/myv_silhouette.jpg'; } elseif($type=="new_member") { $type_text = "$posted_by_short "._("has joined your group").": $external_url"; $post_url = "/groups/$video_id"; $message_short=''; if(!$thumbnail) $thumbnail='/images/myv_silhouette.jpg'; } elseif($type=="follower") { $type_text = _("You have a new follower"); $post_url = "/profile/$posted_by"; if(!$thumbnail) $thumbnail='/images/myv_silhouette.jpg'; } elseif($type=="message") { $type_text = "$posted_by_short "._("has sent you a message"); $post_url = $external_url; } elseif($type=="wall_post") { $type_text = _("Group notification from")." $posted_by_short"; $post_url = "/groups/$type_id/$external_url/post&post_id=$video_id"; } elseif($type=="facebook") { $type_text = "$type_id new "._("connection(s) found!"); $post_url = "/user/follow.php?type=facebook"; $popup='1'; } elseif($type=="twitter") { $type_text = "$type_id new "._("connection(s) found!"); $post_url = "/user/follow.php?type=twitter"; $popup='1'; } elseif($type=="pro_give") { $type_text = _("You are now a MyVidster PRO user!!!"); $post_url = "/profile/$posted_by"; if(!$thumbnail) $thumbnail='/images/myv_silhouette.jpg'; } if($status==1) { $notify_css="notify"; $set_notify.="set_notify('$master_id',$id);"; $notify_ids[]="'".$master_id."'"; } else $notify_css="notify_grey"; $glb_notify_items .= "$type_text
$message_short "._("Posted")." $posted_formatted
"; } } if($set_notify) { $notify_ids = implode(",", $notify_ids); $set_notify="var notify_ids=new Array($notify_ids); window.onbeforeunload = function(e) { if(refreshNotify) { $.ajax({ async: false, url: '/processor.php', data: { action: 'update_notifys', user_id: '$id', notify_ids: notify_ids } }); } }"; } if($notify_cnt_new > 0){ if($notify_cnt_new > 50) $notify_cnt_new = '+50'; $glb_notify = ''.$notify_cnt_new.''; $glb_notify .= '
'; $mark_all =' '._('mark all as read').''; } else { $glb_notify = ''.$notify_cnt_new.''; $glb_notify .= '
'; $mark_all = ''; } $glb_notify .= ''._('Notifications').''.$mark_all; $glb_notify .= $glb_notify_items; if(!$ref_id) $glb_notify .= ''._('No recent notifications
Click here to see older notifications').'
'; else $glb_notify .= ''._('See all notifications').''; $glb_notify .= '
'.$set_notify_x; $_SESSION['glb_notify'] = $glb_notify; if($glb_memcached) $glb_memcached->set($key,$glb_notify, 0, 300); } return $glb_notify; } function calcDateDifference ($date1, $date2) { global $glb_locale; /* Assumes $date1 is greater than $date2 and $date1 is a Unix timestamp created by built-in time() function. Also assumes $date2 is formatted: YYYY-MM-DD where the '-' is any character. */ $year = substr($date2, 0, 4); $month = substr($date2, 5, 2); $day = substr($date2, 8, 2); $hour = substr($date2, 11, 2); $min = substr($date2, 14, 2); $sec = substr($date2, 17, 2); $date2 = @mktime($hour, $min, $sec, $month, $day, $year); $diff = $date1 - $date2; // Difference in seconds. if($diff > 0) { $days = floor($diff / 86400); $diff -= 86400 * floor($diff / 86400); $hours = floor($diff / 3600); $diff -= 3600 * floor($diff / 3600); $minutes = floor($diff / 60); $diff -= 60 * floor($diff / 60); $seconds = $diff; $weeks = floor($days / 7); $output = ""; if ($weeks) { $output = "$weeks "._("week"); if ($weeks > 1) $output .= "s"; } else if ($days) { $output = "$days "._("day"); if ($days > 1) $output .= "s"; } else if ($hours) { $output = "$hours "._("hour"); if ($hours > 1) $output .= "s"; } else if ($minutes) { $output = "$minutes "._("minute"); if ($minutes > 1) $output .= "s"; } else if ($seconds) { $output = "$seconds "._("second"); if ($seconds > 1) $output .= "s"; } } else { $output = "1 "._("second"); } if (!$output) $output = "1 "._("second"); // Append 'ago' to output. if($glb_locale == 'fr_FR' || $glb_locale == 'es_ES') $output = _("ago")." ".$output; else $output .= " "._("ago"); return $output; } function ShortenText($text, $chars=12) { // Change to the number of characters you want to display if (strlen($text) > $chars) { $text = $text." "; $text = substr($text,0,$chars); $text = $text; } return $text; } function to_bytes($value, $unit) { $k = 1024; $m = 1048576; $g = 1073741824; switch (trim($unit)) { case "b": //bytes return ($value / 8); case "Kb": //Kilobits return (($value * $k) / 8); case "Mb": // Megabits return (($value * $m) / 8); case "Gb": // Gigabits return (($value * $g) / 8); case "B": // Bytes return $value; case "KB": // Kilobytes return ($value * $k); case "MB": // Megabytes return ($value * $m); case "GB": // Gigabytes return ($value * $g); default: return 0; } } function bytes_to($value, $unit) { $k = 1024; $m = 1048576; $g = 1073741824; switch (trim($unit)) { case "b": //bytes return ($value * 8); case "Kb": //Kilobits return (($value * 8) / $k); case "Mb": // Megabits return (($value * 8) / $m); case "Gb": // Gigabits return (($value * 8) / $g); case "B": // Bytes return $value; case "KB": // Kilobytes return ($value / $k); //return bcdiv($value, $k, 4); case "MB": // Megabytes return ($value / $m); case "GB": // Gigabytes return ($value / $g); default: return 0; } } function safe_url($url,$source = '') { $url = html_entity_decode(str_replace(" ","_",$url),ENT_QUOTES); $url = preg_replace('#[^A-Za-z0-9_-]#','',$url); $url = str_replace("__","_",$url); return $url; } function n3y_url_shorten($url,$chr_limit = 30,$add = '...') { return @preg_replace("!((http||https):/{2}[\w\.]{2,}[/\w\-\.\?\&\=\;\%\#\!\+]*)!e", "''.(strlen('\\1')>=$chr_limit ? substr('\\1',0,$chr_limit).'$add':'\\1').''", $url); //return preg_replace_callback("!((http||https):/{2}[\w\.]{2,}[/\w\-\.\?\&\=\;\%\#\!\+]*)!e", "''.(strlen('\\1')>=$chr_limit ? substr('\\1',0,$chr_limit).'$add':'\\1').''", $url); } function get_domain($video_link) { $start_domain = explode("/",$video_link); $domain = $start_domain[2]; return $domain; } function get_url_domain($video_link) { $arr_domain=parse_url($video_link); $domain=$arr_domain['scheme']."://".$arr_domain['host']; return $domain; } function create_embed_code_img($type_id,$type,$thumbnailurl,$source=Null,$maxWidth=Null,$z=0,$video_id=0) { global $glb_no_ads; global $glb_vid_w; global $glb_vid_h; global $mysql_link_slave; $server="videos.myvidster.com"; $og_video=''; switch ($type) { case 99: if(stristr($type_id,"https://videos.myvidster.com")) $type_id = get_s3_dll($type_id,'&',false); $w=$glb_vid_w; $h=$glb_vid_h; $overstretch = "false"; if($maxWidth) { if($maxWidth!="100%") { $vidwidthx = $maxWidth; $vidheightx = round(($vidwidthx / $w) * $h); $w=$vidwidthx; $h=$vidheightx; } else { $w="100%"; $h="100%"; $bg_color = ""; } } if($w != "100%") $IE_fix = "width=$w&height=$h"; else $IE_fix = ""; $og_video="https://www.myvidster.com/player.swf?config=https://www.myvidster.com/v/".$video_id; $embedcode2 =''; if($type_id=="Blocked Country") { $embedcodes[0] = '
Video is not available in your country.
'; $embedcodes[1] = $embedcode2; $embedcodes['h'] = $h; $embedcodes['w'] = $w; $embedcodes['og_video'] = $og_video; $embedcodes['tip'] = ''; return $embedcodes; }elseif($type_id=="Limit Reached") { $embedcodes[0] = '
Connection limit has been reached. Please come back later.
MyVidster PRO Users are not restricted by the connection limit. Support MyVidster and become a PRO User today!
'; $embedcodes[1] = $embedcode2; $embedcodes['h'] = $h; $embedcodes['w'] = $w; $embedcodes['og_video'] = $og_video; return $embedcodes; } $embedcode ='
Loading the player ...
'; $script = ''; break; case 95: //Windows Media case 98: $w=$glb_vid_w; $h=$glb_vid_h; $thumbnailurl = "/screen_shot.php?src=$thumbnailurl&type=wmv"; $remove_api = "http://www.myvidster.com/video_remover.php?id=$video_id&apc_label=screen_shot.php"; exec("wget -O /dev/null $remove_api > /dev/null 2>&1 &"); //$w=320*1.25; //$h=260*1.25; if($maxWidth) { if($maxWidth!="100%") { $vidwidthx = $maxWidth; $vidheightx = round(($vidwidthx / $w) * $h); $w=$vidwidthx; $h=$vidheightx; } else { $w="100%"; $h="100%"; $w=320*3; $h=260*3; } } $image_w = $w+20; $image_h = $h+24; //$image_w = $w; //$image_h = $h; $embedcode2=''; $embedcode='
'; $script = ' '; $w=$image_w; $h=$image_h; break; case 97: //quicktime $w=$glb_vid_w; $h=$glb_vid_h; //$w=320*1.25; //$h=260*1.25; $thumbnailurl = "/screen_shot.php?src=$thumbnailurl&type=mov"; $remove_api = "http://www.myvidster.com/video_remover.php?id=$video_id&apc_label=screen_shot.php"; exec("wget -O /dev/null $remove_api > /dev/null 2>&1 &"); if($maxWidth) { if($maxWidth!="100%") { $vidwidthx = $maxWidth; $vidheightx = round(($vidwidthx / $w) * $h); $w=$vidwidthx; $h=$vidheightx; } else { $w="100%"; $h="100%"; $w=320*3; $h=260*3; } } $image_w = $w+30; $image_h = $h+24; $embedcode2 =''; $embedcode ='
'; $script = ' '; $w=$image_w; $h=$image_h; break; case 96: //Windows AVI $w=$glb_vid_w; $h=$glb_vid_h; $thumbnailurl = "/screen_shot.php?src=$thumbnailurl&type=wmv"; $remove_api = "http://www.myvidster.com/video_remover.php?id=$video_id&apc_label=screen_shot.php"; exec("wget -O /dev/null $remove_api > /dev/null 2>&1 &"); //$w=320*1.25; //$h=260*1.25; if($maxWidth) { if($maxWidth!="100%") { $vidwidthx = $maxWidth; $vidheightx = round(($vidwidthx / $w) * $h); $w=$vidwidthx; $h=$vidheightx; } else { $w="100%"; $h="100%"; $w=320*2; $h=260*2; } } $embedcode='
'; $script = ' '; break; case 94: //video is divx $w=$glb_vid_w; $h=$glb_vid_h; if($maxWidth) { if($maxWidth!="100%") { $vidwidthx = $maxWidth; $vidheightx = round(($vidwidthx / $w) * $h); $w=$vidwidthx; $h=$vidheightx; } else { $w="100%"; $h="100%"; } } if ($thumbnailurl) { $previewImage = 'previewImage="'.tmb_loader($thumbnailurl).'"'; $previewImage2 = ''; } $embedcode2 =''; $embedcode =' '; $embedcode =''.$previewImage2.''; $script = ''; break; } $embedcodes[0] = $embedcode; $embedcodes[1] = $embedcode2; $embedcodes[2] = $script; $embedcodes['h'] = $h; $embedcodes['w'] = $w; $embedcodes['og_video'] = $og_video; return $embedcodes; } function create_embed_code($type_id,$type,$thumbnailurl,$maxWidth=Null, $base_link=Null,$name_attrib="my_video",$flashvars=Null, $video_id=0,$vast_url=Null,$sponsored=NULL,$auto_play=false) { global $glb_high_res; global $glb_no_ads; global $user_id; global $glb_safe; global $glb_vid_w; global $glb_vid_h; global $mysql_link_slave; global $mysql_link_slave2; global $mysql_link_slave2; global $glb_videojs_ver; $no_embed_tmb_h = 360; //360 $no_embed_tmb_w = 720; //980 $type_id = str_replace('http:','https:',$type_id); $ua = (isset($_SERVER['HTTP_USER_AGENT'])) ? $_SERVER['HTTP_USER_AGENT'] : ''; if($vast_url) { $vastad='var vastAd = myPlayer.vastClient({ adTagUrl: "'.$vast_url.'", playAdAlways: true, adCancelTimeout: 5000, adsEnabled: true });'; } else $vastad=""; $videojs_scripts = ' '; $videojs_scripts = ''; $z = 0; $tip = ''; $og_video=''; $script=''; switch ($type) { case 99: //flv file use internal player if(stristr($type_id,"//videos.myvidster.com")) $type_id=get_s3_dll($type_id,'&',false); $w=$glb_vid_w; $h=$glb_vid_h; $overstretch = "false"; if($maxWidth) { if($maxWidth!="100%") { $vidwidthx = $maxWidth; $vidheightx = round(($vidwidthx / $w) * $h); $w=$vidwidthx; $h=$vidheightx; } else { $w="100%"; $h="100%"; $bg_color = ""; } } $embedcode2 =''; if($type_id=="Blocked Country") { $embedcodes[0] = '
Video is not available in your country.
'; $embedcodes[1] = $embedcode2; $embedcodes['h'] = $h; $embedcodes['w'] = $w; $embedcodes['og_video'] = $og_video; return $embedcodes; }elseif($type_id=="Limit Reached") { $embedcodes[0] = '
Connection limit has been reached. Please come back later.
MyVidster PRO Users are not restricted by the connection limit. Support MyVidster and become a PRO User today!
'; $embedcodes[1] = $embedcode2; $embedcodes['h'] = $h; $embedcodes['w'] = $w; $embedcodes['og_video'] = $og_video; return $embedcodes; } $embedcode ='
Get Flash to see this player.
'; $script = ''; break; case 95: //Windows Media case 98: $w=$glb_vid_w; $h=$glb_vid_h; if($maxWidth) { if($maxWidth!="100%") { $vidwidthx = $maxWidth; $vidheightx = round(($vidwidthx / $w) * $h); $w=$vidwidthx; $h=$vidheightx; } else { $w="100%"; $h="100%"; $bg_color = ""; } } $embedcode=' '; $script = ''; break; case 93: $w=$glb_vid_w; $h=$glb_vid_h; $embedcode=' '; //$embedcode=' '; $script = ''; break; case 97: //quicktime $w=$glb_vid_w; $h=$glb_vid_h; $thumbnailurl = "/screen_shot.php?src=$thumbnailurl&type=mov"; $remove_api = "http://www.myvidster.com/video_remover.php?id=$video_id&apc_label=screen_shot.php"; exec("wget -O /dev/null $remove_api > /dev/null 2>&1 &"); if($maxWidth) { if($maxWidth!="100%") { $vidwidthx = $maxWidth; $vidheightx = round(($vidwidthx / $w) * $h); $w=$vidwidthx; $h=$vidheightx; } else { $w="100%"; $h="100%"; $bg_color = ""; } } $embedcode=' '; $script = ''; break; case 94: //video is divx $w=$glb_vid_w; $h=$glb_vid_h; if($maxWidth) { if($maxWidth!="100%") { $vidwidthx = $maxWidth; $vidheightx = round(($vidwidthx / $w) * $h); $w=$vidwidthx; $h=$vidheightx; } else { $w="100%"; $h="100%"; $bg_color = ""; } } $embedcode2 =''; $embedcode =' '; $script = ''; break; case 92: //video is iframe case 86: $w=$glb_vid_w; $h=$glb_vid_h; $class = ""; if($maxWidth) { if($maxWidth!="100%") { $vidwidthx = $maxWidth; $vidheightx = round(($vidwidthx / $w) * $h); $w=$vidwidthx; $h=$vidheightx; } else { $w="100%"; $h="100%"; $bg_color = ""; } } if(strstr($type_id,'//chaturbate.com/affiliates') && !strstr($type_id,'campaign=U2Z2Y')) { $tmp_start = explode("room=",$type_id,2); $tmp_end = explode("&",$tmp_start[1],2); $chat_room = $tmp_end[0]; $type_id="https://chaturbate.com/affiliates/in/?tour=9oGW&campaign=U2Z2Y&track=embed&room=$chat_room&bgcolor=white"; } elseif(strstr($type_id,'//bongacams.com/chat-popup/')) { $glb_vid_h = 520; $h = $glb_vid_h; } elseif(strstr($type_id,'tiktok.com/embed')) { $glb_vid_h = 745; $h = $glb_vid_h; } $embedcode =''; if($sponsored == 3 || $sponsored == 4) $embedcode2 =''; else $embedcode2 = $embedcode; if(strstr($type_id,'//www.myvidster.com/embed/')) { $type_id = get_myv_mp4($type_id,'&',false); $type = 91; $override_type = 88; $tmp_embedcodes = create_embed_code($type_id,$type,$thumbnailurl,$maxWidth,$base_link,$name_attrib,$flashvars,$video_id,$vast_url,$sponsored,$auto_play); $embedcode = $tmp_embedcodes[0].build_thumb_html($type_id); break; } //video removal $video_host = get_video_host($type_id); if(stristr($type_id,'https://www.myvidster.com/video/')) { $remove_id = rand(); } elseif($video_host) { $sql = "select id, m_name, m_value from myvidster_vars where m_name IN ('video_remover','ph_fixer') and m_value = '$video_host'"; if(function_exists('mysql_query')) { $result1 = mysql_query($sql,$mysql_link_slave2); //do not use master if($result1) { $row1 = mysql_fetch_array($result1); if($row1['m_name'] == 'video_remover') { $remove_id = $row1['id']; //$remove_value = $row1['m_value']; $remove_value = md5($type_id); } elseif($row1['m_name'] == 'ph_fixer') { $ph_fixer_id = $row1['id']; } } } } if($remove_id && $video_id) { if($user_id == 2) { $apc_label = "video_remover_admin_".$remove_value; } else { $apc_label = "video_remover_".$remove_value; } //$apc_label = "video_remover_".$remove_value; $video_remover_checker = apc_fetch($apc_label,$apc); if(!$apc) { $apc_data = $video_id; apc_store($apc_label, $apc_data,60); $remove_api = "https://www.myvidster.com/video_remover.php?id=$video_id&apc_label=$apc_label"; //exec("wget -O /dev/null \"$remove_api\" > /dev/null 2>&1 &"); } } //thumbnail overrides if(stristr($type_id,"pornhd.com/video/embed") || stristr($type_id,"justusboys.com/embed.html") || stristr($type_id,"//www.gotgayporn.com/embed/") || stristr($type_id,".homosexualtube.com/embed/") || stristr($type_id,"//tubedupe.com/embed/") || stristr($type_id,"//vartuc.com/embed/") || stristr($type_id,"//azblowjobtube.com/embed/") || stristr($type_id,"//soloboys.tv/embed/") //|| stristr($type_id,"//monstercockland.com/embed/") || stristr($type_id,"//www.gaymenhdtv.com/embed/") //|| stristr($type_id,"//www.alphaporno.com/embed/") || stristr($type_id,"//youlikeboys.com/embed/") ) { if($thumbnailurl && $video_id) { $embedcode ='
Please visit the source site by clicking on the thumbnail below.
'; } else { $embedcode ='
Video preview is not
available.
'; } } if((stristr($type_id,"//goo.gl/") || stristr($type_id,"//bit.ly/") || stristr($type_id,"//snipr.com/") || stristr($type_id,"//tinyurl.com/") || stristr($type_id,"//videowood.tv/embed") //dl but IP specfic || stristr($type_id,"//thevideos.tv/embed") //dl but IP specfic || stristr($type_id,"//powvideo.net/embed") //cloud upload || stristr($type_id,"//videomega.tv/") //cloud upload || stristr($type_id,"//megavideo.pro/") //cloud upload || stristr($type_id,"//www.gayspower.com/embed/") || stristr($type_id,"//isgayporn.com/wp-content/plugins") || stristr($type_id,"//neodrive.co/embed/") || stristr($type_id,"//camthots.tv/embed") //|| stristr($type_id,"//userload.co/embed/") ) && $video_id) { $embedcode ='
Please visit the source site by clicking on the thumbnail below.
This video may contain installers be careful when viewing.
'; } if((is_cloud_hosting($type_id) || $sponsored) && $video_id) { if($glb_no_ads || $sponsored) { $override_type = 88; } else { $override_type = 84; } if(dl_blacklist($type_id)) { $override_type = 84; } $embedcode = '
'; $tip = ""; $script = $videojs_scripts; } break; case 91: //video tag html5 $w=$glb_vid_w; $h=$glb_vid_h; $vid_class = 'video-js vjs-default-skin'; $w_h_style = 'width="'.$w.'" height="'.$h.'"'; //video removal $video_host = get_video_host($type_id); if(stristr($type_id,'https://www.myvidster.com/video/')) { $remove_id = rand(); } else { $sql = "select id, m_name from myvidster_vars where m_name IN ('video_remover') and m_value = '$video_host'"; $result1 = mysql_query($sql,$mysql_link_slave2); $row1 = mysql_fetch_array($result1); if($row1['m_name'] == 'video_remover') $remove_id = $row1['id']; } if($remove_id && $video_id) { if($user_id == 2) { $apc_label = "video_remover_admin".$video_id; } else { $apc_label = "video_remover"; } //$apc_label = "video_remover_admin_91"; $video_remover_checker = apc_fetch($apc_label,$apc); if(!$apc) { $apc_data = "$video_id - $type_id"; apc_store($apc_label, $apc_data,60); $remove_api = "http://www.myvidster.com/video_remover.php?id=$video_id&apc_label=$apc_label"; //exec("wget -O /dev/null $remove_api > /dev/null 2>&1 &"); } } if(isset($_COOKIE['cloud_volume'])) $cloud_volume=$_COOKIE['cloud_volume']; else $cloud_volume="0.5"; if($maxWidth) { if($maxWidth!="100%") { $vidwidthx = $maxWidth; $vidheightx = round(($vidwidthx / $w) * $h); $w=$vidwidthx; $h=$vidheightx; } else { $vid_class = 'video-js vjs-default-skin vjs-16-9'; $bg_color = ""; $w_h_style = ''; } $w_h_style = 'width="'.$w.'" height="'.$h.'"'; } $loop = loop_vid($type_id,$base_link); $controls = "controls"; if($auto_play) { $controls .= " auto_play"; } if($loop) { $controls .= " $loop"; } $source_type = "video/mp4"; $embedcode2 =''; if(substr($thumbnailurl,0,4) != 'http') $thumbnailurl = tmb_loader($thumbnailurl); $embedcode=" "; if(stristr($type_id,"//vcdn01.") && stristr($type_id,"validfrom=") && $video_id ) { $embedcode ='
Please visit the source site by clicking on the thumbnail below.
'; } $script = $videojs_scripts; break; case 89: //video tag with autoplay w controls use for cloud playback $w=$glb_vid_w; $h=$glb_vid_h; if(isset($_COOKIE['cloud_volume'])) $cloud_volume=$_COOKIE['cloud_volume']; else $cloud_volume="0.5"; if($maxWidth) { if($maxWidth!="100%") { $vidwidthx = $maxWidth; $vidheightx = round(($vidwidthx / $w) * $h); $w=$vidwidthx; $h=$vidheightx; } else { $w="100%"; $h="100%"; $bg_color = ""; } } $loop = loop_vid($type_id,$base_link); $embedcode2 =''; $embedcode=' '; $script = $videojs_scripts; break; case 100: //to only been use for thumbnail creations $w=$glb_vid_w; $h=$glb_vid_h; if(isset($_COOKIE['cloud_volume'])) $cloud_volume=$_COOKIE['cloud_volume']; else $cloud_volume="0.5"; if($maxWidth) { if($maxWidth!="100%") { $vidwidthx = $maxWidth; $vidheightx = round(($vidwidthx / $w) * $h); $w=$vidwidthx; $h=$vidheightx; } else { $w="100%"; $h="100%"; $bg_color = ""; } } $embedcode2 =''; $embedcode=' '; $script = $videojs_scripts; break; case 88: //html5 video preloader $sql = "select d.filepath from myvidster_download d JOIN myvidster_video v ON v.master_id = d.master_id where v.id = '$video_id' and d.source = 2 and d.status = 1 and filepath like '%//videos.myvidster.com/%' limit 1;"; //keep the status = 1, yes its a trade off $result = mysql_query($sql,$mysql_link_slave); $row = mysql_fetch_array($result); $filepath = $row['filepath']; //else { if(strstr($filepath,"//videos.myvidster.com/")) { $pro_flv_download = get_s3_dll($filepath,'&',false); } if(!$pro_flv_download) { $sql = "select d.id d_id, d.posted, v.title, v.master_id, v.thumbnail, v.type_url from myvidster_video v left join myvidster_download d on d.master_id = v.master_id and d.user_id = 436 and d.status = 1 where v.id = '$video_id' limit 1"; $result = mysql_query($sql,$mysql_link_slave); $row = mysql_fetch_array($result); $d_id=$row['d_id']; $d_posted=$row['posted']; $title=$row['title']; $master_id=$row['master_id']; $c_thumbnail=tmb_loader($row['thumbnail']); $type_url=$row['type_url']; if(!$d_id) { require_once($_SERVER['DOCUMENT_ROOT']."/user/class.VideoAPIs.php"); if(!$sponsored || $sponsored == 3) { $flv_download=$type_id; } else { $flv_download_tmp = html5_video_fetcher($type_id,$flashvars,$type_url); //$flv_download_tmp = fetch_download_link(92, $type_id, Null, $flashvars); } } if($flv_download && $glb_safe != 5) { cloud_upload($title,$master_id,436,$c_thumbnail,$flv_download,$video_id,$type_url); } $timetobeat=70; if(!$d_posted) { $d_posted=date('Y-m-d H:i:s', time() - $timetobeat); } $now = date('Y-m-d H:i:s', time()); $date_a = new DateTime($now); $date_b = new DateTime($d_posted); $interval = date_diff($date_a,$date_b); $mintues = $interval->format('%i'); if($mintues < $timetobeat) { $eta = $timetobeat - $mintues; $eta = ". Processing will be completed within $eta minitues or less."; } else { $eta = ". Processing this video is taking longer then expected we apologize for the delay."; } if(!$sponsored) { $maxWidth = $glb_vid_w - 40; $msg ="We are processing this video for ad removal$eta"; } else $maxWidth = $glb_vid_w; } //} if($pro_flv_download) { $type_id = $pro_flv_download; $type = 91; $tmp_embedcodes = create_embed_code($type_id,$type,$thumbnailurl,$maxWidth,$base_link,$name_attrib,$flashvars,$video_id,$vast_url,$sponsored); $embedcode = $tmp_embedcodes[0].build_thumb_html($type_id); $script = $tmp_embedcodes[2]; } else { if($sponsored == 3 || $sponsored == 4) { $type = 91; } elseif(is_cloud_hosting($type_id) && $video_id) { echo "
$msg
"; $type = 85; } else { $type = 92; } $tmp_embedcodes = create_embed_code($type_id,$type,$thumbnailurl,$maxWidth,$base_link,$name_attrib,$flashvars,$video_id); $embedcode = $tmp_embedcodes[0]; $script = $tmp_embedcodes[2]; } break; case 87: //adblock user greetings $embedcode ='
We notice that you like our web site and you are also running Adblock :(

We 100% understand why you are running Adblock, but we still need ad revenue to keep the servers running. Please disable Adblock (or add myvidster.com to your whitelist) to continue using our wonderful service. You can also upgrade to MyVidster PRO which includes ad removal for popular bookmarked tube sites and you are allow to use your Adblock!
'; break; case 0: //video is youtube $w=$glb_vid_w; $h=$glb_vid_h; $bg_color = ""; if($maxWidth) { if($maxWidth!="100%") { $vidwidthx = $maxWidth; $vidheightx = round(($vidwidthx / $w) * $h); $w=$vidwidthx; $h=$vidheightx; } else { $w="100%"; $h="100%"; $bg_color = ""; } } $embedcode2 =''; $og_video="https://www.youtube.com/v/".$type_id; $embedcode=''; break; case 3: //video is metacafe $w=$glb_vid_w; $h=$glb_vid_h; if($maxWidth) { if($maxWidth!="100%") { $vidwidthx = $maxWidth; $vidheightx = round(($vidwidthx / $w) * $h); $w=$vidwidthx; $h=$vidheightx; } else { $w="100%"; $h="100%"; $bg_color = ""; } } $embedcode2 =''; $embedcode ='
Get Flash to see this player.
'; $script = ''; break; case 4: //video is veoh $w=$glb_vid_w; $h=$glb_vid_h; $vplayer = "static/swf/webplayer/WebPlayer.swf"; if($maxWidth) { if($maxWidth!="100%") { $vidwidthx = $maxWidth; $vidheightx = round(($vidwidthx / $w) * $h); $w=$vidwidthx; $h=$vidheightx; } else { $w="100%"; $h="100%"; $bg_color = ""; } } $embedcode2=''; $embedcode ='
Get Flash to see this player.
'; $script = ''; break; case 7: //video is vimeo $w=$glb_vid_w; $h=$glb_vid_h; if($maxWidth) { if($maxWidth!="100%") { $vidwidthx = $maxWidth; $vidheightx = round(($vidwidthx / $w) * $h); $w=$vidwidthx; $h=$vidheightx; } else { $w="100%"; $h="100%"; $bg_color = ""; } } $embedcode2=''; $embedcode = $embedcode2; break; case 14: //video is embed video $w=$glb_vid_w; $h=$glb_vid_h; $bg_color = ""; if($maxWidth) { if($maxWidth!="100%") { $vidwidthx = $maxWidth; $vidheightx = round(($vidwidthx / $w) * $h); $w=$vidwidthx; $h=$vidheightx; } else { $w="100%"; $h="100%"; $bg_color = ""; } } //video removal $video_host = get_video_host($type_id); $sql = "select id, m_name from myvidster_vars where m_name IN ('video_remover') and m_value = '$video_host'"; $result1 = mysql_query($sql,$mysql_link_slave2); $row1 = mysql_fetch_array($result1); if($row1['m_name'] == 'video_remover') $remove_id = $row1['id']; if($remove_id && $video_id) { if($user_id == 2) { $apc_label = "video_remover_admin".$video_id; } else { $apc_label = "video_remover"; } $video_remover_checker = apc_fetch($apc_label,$apc); if(!$apc) { $apc_data = "$video_id - $type_id"; apc_store($apc_label, $apc_data,999); $remove_api = "http://www.myvidster.com/video_remover.php?id=$video_id&apc_label=$apc_label"; //exec("wget -O /dev/null $remove_api > /dev/null 2>&1 &"); } } if($w != "100%") $IE_fix = "&width=$w&height=$h"; else $IE_fix = ""; $wmode="opaque"; $embedcode2 = ''; //mobypictures fix this should be tmp until they fix their embed code :) if(strstr($type_id,'//www.mobypicture.com/static/flash/player.swf')) $type_id="/player.swf"; //they keep changing the url to their player. if(stristr($type_id,"//gay.black2ube.com/media/nuevo/player4.swf")) { $type_id = str_replace("//gay.black2ube.com/media/nuevo/player4.swf","//gay.black2ube.com/media/nuevo/player5.swf",$type_id); } if(stristr($type_id,"homegrownfreaks.net") || stristr($type_id,"pornodump.ru") || stristr($type_id,"malecamclips.com") || stristr($type_id,"mymusclevideo.com.disable") || stristr($type_id,"homemoviestube.com.disable") || stristr($type_id,"overthumbs.com") || stristr($type_id,"daotube.com") || stristr($type_id,"milffox.com/player/myplayer.swf") ) { $tip = "
Tip: Click on the source link if you cannot see or play the video.
"; } if($flashvars) { if(strstr($type_id,"?")) $og_video="$type_id&".htmlspecialchars_decode($flashvars); else $og_video="$type_id?".htmlspecialchars_decode($flashvars); } else $og_video=$type_id; if(stristr($type_id,"tumblr.com/swf/video_player") || stristr($type_id,"rockettube.com") || stristr($type_id,"pbs.org") || stristr($type_id,"cdn.turner.com/cnn") ) { $embedcode=$embedcode2; } else { $embedcode ='
'; $script = ''; } if(stristr($type_id,"static.gaytube.com/bundles/applicationsonatamedia/flowplayer/flowplayer.swf")) { $start = explode("url=",$flashvars); $end = explode("&",$start[1]); $tmp = $end[0]; if(strstr($tmp,".mp4")) { $embedcode=''; $script = $videojs_scripts; } else { $type_id="/player.swf"; $flashvars = str_replace("url=","image=".tmb_loader($thumbnailurl)."&file=",$flashvars); $embedcode ='




Flash Player not found. Please install the lastest vision of Adobo Flash
'; $script = ''; } } if(stristr($type_id,"//www.juicestream.com/media/player")) { $embedcode ='
Site has been reported as inactive.
RIP Juicestream.
'; } elseif(stristr($type_id,"//blog.luckyhudson.com/wp-content/plugins")) { $embedcode ='
Site has been reported as inactive.
'; } elseif((stristr($type_id,"//www.pornsocket.com/plugins/hwdmediashare/player_mejs") || stristr($type_id,"//www.itsallgay.eu/") || stristr($type_id,"gosexpod.com/videos/kt_player/kt_player.swf") || stristr($type_id,"//motherless.com/scripts/jwplayer")) && $video_id ) { $embedcode ='
Please visit the source site by clicking on the thumbnail below.
'; } //Temp fix for legacy xtube embeds if(stristr($type_id,"static.xtube.com/")) { $type_id = str_replace("/swf/videoPlayer_embed.swf","/embed/scenes_player.swf",$type_id); $embedcode ='
'; $script = ''; } break; case 15: //video is embed video w autoplay on $w=$glb_vid_w; $h=$glb_vid_h; if($maxWidth) { if($maxWidth!="100%") { $vidwidthx = $maxWidth; $vidheightx = round(($vidwidthx / $w) * $h); $w=$vidwidthx; $h=$vidheightx; } else { $w="100%"; $h="100%"; $bg_color = ""; } } //I NO LONGER USE THIS CASE GO TO CASE 19 $type_id = str_replace("autoplay=0","autoplay=1",$type_id); $type_id = str_replace("autoplay=false","autoplay=true",$type_id); $type_id = str_replace("autostart=0","autostart=1",$type_id); $type_id = str_replace("autostart=false","autostart=true",$type_id); $type_id = str_replace("autoStart=0","autoStart=1",$type_id); $type_id = str_replace("autoStart=false","autoStart=true",$type_id); $type_id = str_replace("auto=0","auto=1",$type_id); $type_id = str_replace("auto=false","auto=true",$type_id); $type_id = str_ireplace("autoPlay:%20false","autoPlay:%20true",$type_id); $type_id = str_ireplace("autoPlay:%200","autoPlay:%201",$type_id); $type_id = str_ireplace("autoPlay:false","autoPlay:true",$type_id); $type_id = str_ireplace("autoPlay:0","autoPlay:1",$type_id); //auto_play=false $type_id = str_replace("auto_play=0","auto_play=1",$type_id); $type_id = str_replace("auto_play=false","auto_play=true",$type_id); $flashvars = str_ireplace("autoplay=0","autoplay=1",$flashvars); $flashvars = str_ireplace("autoplay=false","autoplay=true",$flashvars); $flashvars = str_ireplace("autostart=0","autostart=1",$flashvars); $flashvars = str_ireplace("autostart=false","autostart=true",$flashvars); $flashvars = str_ireplace("auto=0","auto=1",$flashvars); $flashvars = str_ireplace("auto=false","auto=true",$flashvars); //auto_play=false $flashvars = str_ireplace("auto_play=0","auto_play=1",$flashvars); $flashvars = str_ireplace("auto_play=false","auto_play=true",$flashvars); $flashvars = str_ireplace("autoPlay:%20false","autoPlay:%20true",$flashvars); $flashvars = str_ireplace("autoPlay:%200","autoPlay:%201",$flashvars); $flashvars = str_ireplace("autoPlay:false","autoPlay:true",$flashvars); $flashvars = str_ireplace("autoPlay:0","autoPlay:1",$flashvars); $flashvars = str_ireplace("autoPlay':false,'","autoPlay':true,'",$flashvars); $flashvars = str_ireplace("autoPlay':0,'","autoPlay':0,'",$flashvars); $embedcode ='
Get Flash to see this player.
'; $script = ''; break; case 16: //video is embed video with autoplay off $w=$glb_vid_w; $h=$glb_vid_h; if($maxWidth) { if($maxWidth!="100%") { $vidwidthx = $maxWidth; $vidheightx = round(($vidwidthx / $w) * $h); $w=$vidwidthx; $h=$vidheightx; } else { $w="100%"; $h="700"; $bg_color = ""; } } $embedcode ='
Get Flash to see this player.
'; $script = ''; break; case 19: //video is embed video w autoplay on forced $w=$glb_vid_w; $h=$glb_vid_h; if($maxWidth) { if($maxWidth!="100%") { $vidwidthx = $maxWidth; $vidheightx = round(($vidwidthx / $w) * $h); $w=$vidwidthx; $h=$vidheightx; } else { if(stristr($type_id,"https://www.msnbc.msn.com/")) { $w="956"; $h="700"; } else { $w="100%"; $h="700"; } $bg_color = ""; } } if($w != "100%") $IE_fix = "&width=$w&height=$h"; else $IE_fix = ""; $type_id = str_ireplace("autoplay=0","autoplay=1",$type_id); $type_id = str_ireplace("autoplay=false","autoplay=true",$type_id); $type_id = str_ireplace("autostart=0","autostart=1",$type_id); $type_id = str_ireplace("autostart=false","autostart=true",$type_id); $type_id = str_ireplace("auto=0","auto=1",$type_id); $type_id = str_ireplace("auto=false","auto=true",$type_id); //auto_play=false $type_id = str_ireplace("auto_play=0","auto_play=1",$type_id); $type_id = str_ireplace("auto_play=false","auto_play=true",$type_id); $type_id = str_ireplace("autoPlay:%20false","autoPlay:%20true",$type_id); $type_id = str_ireplace("autoPlay:%200","autoPlay:%201",$type_id); $type_id = str_ireplace("autoPlay:false","autoPlay:true",$type_id); $type_id = str_ireplace("autoPlay:0","autoPlay:1",$type_id); $new_flashvars = str_ireplace("autoplay=0","autoplay=1",$flashvars); $new_flashvars = str_ireplace("autoplay=false","autoplay=true",$new_flashvars); $new_flashvars = str_ireplace("autostart=0","autostart=1",$new_flashvars); $new_flashvars = str_ireplace("autostart=false","autostart=true",$new_flashvars); $new_flashvars = str_ireplace("auto=0","auto=1",$new_flashvars); $new_flashvars = str_ireplace("auto=false","auto=true",$new_flashvars); //auto_play=false $new_flashvars = str_ireplace("auto_play=0","auto_play=1",$new_flashvars); $new_flashvars = str_ireplace("auto_play=false","auto_play=true",$new_flashvars); $new_flashvars = str_ireplace("autoPlay:%20false","autoPlay:%20true",$new_flashvars); $new_flashvars = str_ireplace("autoPlay:%200","autoPlay:%201",$new_flashvars); $new_flashvars = str_ireplace("autoPlay:false","autoPlay:true",$new_flashvars); $new_flashvars = str_ireplace("autoPlay:0","autoPlay:1",$new_flashvars); $new_flashvars = str_ireplace("autoPlay':false,'","autoPlay':true,'",$new_flashvars); $new_flashvars = str_ireplace("autoPlay':0,'","autoPlay':1,'",$new_flashvars); $new_flashvars = str_ireplace("autoPlay':false","autoPlay':true",$new_flashvars); $new_flashvars = str_ireplace("autoPlay':0","autoPlay':1",$new_flashvars); $new_flashvars = str_ireplace("autoPlay%22%3Afalse","autoPlay%22%3Atrue",$new_flashvars); $new_flashvars = str_ireplace("autoPlay%22%3A0","autoPlay%22%3A1",$new_flashvars); $new_flashvars = str_ireplace("play=false","play=true",$new_flashvars); $new_flashvars = str_ireplace("play=0","play=1",$new_flashvars); if($new_flashvars!=$flashvars) { $flashvars=$new_flashvars; } else { $flashvars.='&autoStart=1&autostart=1&autoplay=1&auto=1&auto_play=1&aplay=1'; } $embedcode ='
Get Flash to see this player.
'; $script = ''; break; case 18: //video tag html5 autoplay $w=$glb_vid_w; $h=$glb_vid_h; if($maxWidth) { if($maxWidth!="100%") { $vidwidthx = $maxWidth; $vidheightx = round(($vidwidthx / $w) * $h); $w=$vidwidthx; $h=$vidheightx; } else { $w="100%"; $h="100%"; $bg_color = ""; } } $preload="auto"; $loop = 'loop'; $embedcode2 =''; //poster="'.tmb_loader($thumbnailurl).'" if(substr($thumbnailurl,0,4) != 'http') $thumbnailurl = tmb_loader($thumbnailurl); $embedcode=' '; $script = $videojs_scripts; break; case 84: case 85: $msg = ''; if($type == 84) { if(dl_blacklist($type_id)) { echo "
This video may contain intrusive pop-unders ads be careful when viewing.
"; } else { echo "
This video may contain intrusive pop-unders ads be careful when viewing. Upgrade to PRO to remove these ads!!!
"; } } else { $msg = "
This video may contain intrusive pop-unders ads be careful when viewing.
"; } $load_video = "reload_video('$type_id',92,'$thumbnail','','$base_link');"; $embedcode ='


'.$msg.'
Click the thumbnail to load the video.
'; $script = ''; break; case 21: //for vids that do not allow hotlinking :( case 1: //google video case 2: //video is revver case 5: //video is iflim case 6: //video is blip case 8: //video is myspace case 8: //video is myspace case 9: //video is jumpcut case 10: //video is grouper case 11: //video is break case 13: //video is livevideo case 17: //video is aol hell case 95: //Windows Media case 98: //case 49: $w=$glb_vid_w; $h=$glb_vid_h; if($type_id == "down" || $type != 21) $msg="The site hosting this video has been reported being down. If the site is back up and running, please contact us."; else $msg="Video embed is not available. Please visit the source site by clicking on the thumbnail below."; $embedcode ='
'.$msg.'
'; $embedcode2 = 'embed code not available'; $script = ''; break; } $embedcodes[0] = $embedcode; $embedcodes[1] = $embedcode2; $embedcodes[2] = $script; $embedcodes['h'] = $h; $embedcodes['w'] = $w; $embedcodes['og_video'] = $og_video; $embedcodes['tip'] = $tip; $embedcodes['override_type'] = $override_type; return $embedcodes; } function is_site_down($type_id) { global $mysql_link_slave; global $mysql_link_slave; global $mysql_link_slave; global $user_id; //return false; if($mysql_link_slave) { $query = "SELECT domain FROM myvidster_site_down WHERE status = 1"; $result_name = mysql_query($query,$mysql_link_slave); while ($row = mysql_fetch_array($result_name)) { $domains[] = $row['domain']; } } if($domains) { foreach($domains as $domain) { if(strstr($type_id,$domain)){ return true; break; } } } return false; } function create_bookmarklet() { global $glb_site_width; $w = $glb_site_width+20; $js_code="javascript:(function(){window.open('https://www.myvidster.com/share.php?p=4&url='+encodeURIComponent(window.location.href),'myvwindow','width=$w, height=760');}());"; $video_bookmarklet='Use MyVidster's Video Bookmarklet to collect your favorite videos from any website!

Drag and drop this bookmarklet Add to MyVidster to the bookmark toolbar of your browser.

Note, we are retiring our browser extensions because the folks at Google were trying to use it to control us and NO ONE controls MyVidster!
'; return $video_bookmarklet; } function fetch_ad($adult_filter,$spot='ntv1',$private='adult') { global $glb_sex_pref; global $glb_meta_type; global $glb_filter_by; global $user_id; global $mysql_link_slave; global $mysql_link_slave2; global $mysql_link_slave2; $pornmd=""; if(!$adult_filter && $private) { if($glb_meta_type==1) $sex_pref = 'straight'; elseif($glb_meta_type==2) $sex_pref = 'gay'; elseif($glb_filter_by=='straight') $sex_pref = 'straight'; elseif($glb_filter_by=='gay') $sex_pref = 'gay'; elseif($glb_sex_pref==1) $sex_pref = 'straight'; elseif($glb_sex_pref==2) $sex_pref = 'gay'; else $sex_pref = 'gay'; } else $sex_pref = 'family'; $number = date('i'); if($sex_pref == 'gay') { if($spot == 'ntv1') { $sql="select m_value from myvidster_vars where m_name='fetch_ad' and m_key=2"; $var_result = mysql_query($sql,$mysql_link_slave2); $var_row = mysql_fetch_assoc($var_result); $my_ad=$var_row['m_value']; //was $my_ad_exo $my_ad=' '; /* $my_ad=""; */ } elseif($spot == 'cam') { $my_ad=''; } else { $my_ad=' '; } } elseif($sex_pref == 'straight') { if($spot == 'ntv1') { $sql="select m_value from myvidster_vars where m_name='fetch_ad' and m_key=1"; $var_result = mysql_query($sql,$mysql_link_slave2); $var_row = mysql_fetch_assoc($var_result); $my_ad=$var_row['m_value']; $my_ad=' '; /* $my_ad=""; */ } elseif($spot == 'cam') { $my_ad=''; } else { $my_ad_disable=' '; } } else { //family friendly if($spot == 'ntv1') { $my_ad=' '; } } return $my_ad; } function create_analytics($video_type="general") { $code_legacy=" "; $code=" "; //$code=false; return $code; } function create_header($filter_by=NULL,$q=NULL,$https=false) { global $user_id; global $user_name; global $adult_filter; global $default_gallery; global $anc1; global $glb_valid_email; global $glb_myvideos; global $glb_new_connections; global $glb_notify; global $glb_sex_pref; global $glb_profile_photo; global $glb_locale; global $glb_locale_txt; global $adult_filter; global $glb_site_width; global $mysql_link_slave; if(!$glb_myvideos) $glb_myvideos = ""._("my videos").""; $annoucement = ""; $chat_djs = ""; $sel_user = ""; //anouncements now control by cookie anc1_read_9 and not db, so no updates needed mrg $anc1 = false; if ($anc1) { $tweet = '1258132302510657536'; $title = "MyVidster is under maintenance yet again :("; $anc_msg="I need to reboot the master server, more updates. Hey membership is CHEAP for the last 10 years for a reason."; //$anc_msg="We lost our primary database server (RIP) and are in the processs of restoring the data on a new server, sorry the inconvenience"; //$anc_msg = lastest_tweets($tweet); //$anc_msg="I always find a way. Please give us a few hours to upgrade our hardware. Also sorry for all the downtime, please forgive me (only if I am successful)."; if($tweet) { $title_html = '
'.$title.'
'; } else { $title_html = '
'.$title.'
'; } $annoucement = '
'.$title_html.' '.$anc_msg.'  Feel free to communicate and join us on Twitter.
'; } if ($adult_filter == 0) { $adult_filter_text = _("safe browsing").": "._("off").""; $pornmd=""; } else { $adult_filter_text = _("safe browsing").': '._("on").''; $pornmd=""; } $pornmd=""; $lang= ''.$glb_locale_txt.'
English Français Español Português Deutsch
'; if ($user_name) { $new_connections = ''; $account= ''._("account").'
'._("home").' '._("bookmark").' '._("manage").' '._("groups").' '._("upgrade").' '._("options").'
'; $user = ""; } else { $new_connections = ''; $user = ""; } $sel_user=''; $sel_profile=''; $sel_groups=''; $sel_myvidster=''; $search_gallery=''; $search_queue=''; $search_user=''; if ($filter_by == "user") { $sel_user = " selected"; } elseif ($filter_by == "profiles") { $sel_profile = " selected"; } elseif ($filter_by == "groups") { $sel_groups = " selected"; } elseif ($filter_by == "myvidster" || $filter_by == "tag") { $sel_myvidster = " selected"; } elseif ($filter_by == "queue" || $filter_by == "watched") { $search_queue = ""; } elseif ($filter_by == "history") { $search_queue = ""; } elseif ($filter_by == "downloads") { $search_queue = ""; } elseif ($filter_by == "cloud") { $search_queue = ""; } elseif (stristr($filter_by,"channel")) { $search_queue = ""; } elseif (stristr($filter_by,"user")) { $search_queue = ""; } elseif (stristr($filter_by,"web")) { $search_queue = ""; } elseif ($filter_by && $q) { $search_gallery = ""; } elseif ($filter_by) { $search_gallery = ""; $sel_myvidster = " selected"; } else $sel_myvidster = " selected"; if ($user_name) $search_user = ""; if ($search_user || $search_gallery) { $search_dropdown = ''; } else { $search_dropdown = ''; } $search = '
'.$search_dropdown.'
'; $header ='
'.$user.'
'._('collect the videos you love').'
'._('collect').' | '._('share').' | '._('explore').'
'.$search.'
'.$annoucement.$chat_djs; return $header; } function create_qtip() { $x = ""; return $x; } function create_footer($show_chat=true, $show_ad=true, $show_subbar=true, $show_addthis=false) { global $user_id; global $adult_filter; global $glb_no_ads; global $glb_subscription_lock; global $glb_locale; $show_addthis=false; if($show_addthis) { $addthis_js=''; } else { $addthis_js=''; } if($user_id) { if($show_subbar) { $side_sub_bar="
"; $side_sub_bar="
"; } else { $side_sub_bar=''; } } else { $chat_js=''; $side_sub_bar=''; } if($user_id) { $notify_checker="\n"; } else { $notify_checker=""; } $output=$side_sub_bar.'
'.$paid_ad.'
'.$notify_checker.$ad_blocker.$chat_js.$addthis_js; return $output; } function create_smart_banner() { $ua = (isset($_SERVER['HTTP_USER_AGENT'])) ? $_SERVER['HTTP_USER_AGENT'] : ''; if(stripos($ua,'iPad') || stripos($ua,'iPhone')) { $url="https://itunes.apple.com/us/app/myvidster/id611470289?mt=8&uo=4"; } elseif(stripos($ua,'android')) { $url="/app/android_update"; $inAppStore="Download Here"; $force="force: 'ios',"; } else { $url="//www.myvidster.com/docs/mobile"; $inAppStore="Download Here"; $force=""; } $output=""; return $output; } function get_gravatar( $email, $s = 80, $d = 'mm', $r = 'g', $img = false, $forcedefault = 0, $atts = array() ) { if($forcedefault) $forcedefault="&forcedefault=$forcedefault"; else $forcedefault=""; $url = 'https://www.gravatar.com/avatar/'; $url .= md5( strtolower( trim( $email ) ) ); $url .= "?s=$s&d=$d&r=$r$forcedefault"; if ( $img ) { $url = ' $val ) $url .= ' ' . $key . '="' . $val . '"'; $url .= ' />'; } return $url; } function get_s3_dll($objectPath,$seperator="&",$check=true,$folder=NULL) { //cloudfront global $user_id; $ip=$_SERVER['REMOTE_ADDR']; $file = explode("/",$objectPath); $file = end($file); if($folder) { $file="$folder/$file"; } if($_SERVER['HTTP_HOST'] == 'localhost.myvidster' || strstr($objectPath,".flv")) return get_s3_dll_legacy($objectPath,"&",$folder); if($check) { require_once($_SERVER['DOCUMENT_ROOT'].'/aws-sdk-php/S3.php'); $bucketName="myvidster-cloud"; $s3_2 = new S3('AKIAJ2BLCJ627OPAHO6A','9RKdPyJNnPMBGPBFUX/rr1fUfYKxD7RAG+kGemlk'); $response = $s3_2->getObjectInfo($bucketName, $file); if (!$response){ flag_cloud_upload(NULL,$file,'get_cloud_dl'); } } $timeout=3600 * 8; $resource = "https://d1sdac3zefu2ho.cloudfront.net/$file"; //$resource = "http://cloud.myvidster.com/$file"; //This comes from key pair you generated for cloudfront $keyPairId = "APKAJCEJ7LXUF3MKLPVA"; //,"IpAddress":{"AWS:SourceIp":"'.$ip.'"} $expires = time() + $timeout; //Time out in seconds $json = '{"Statement":[{"Resource":"'.$resource.'","Condition":{"DateLessThan":{"AWS:EpochTime":'.$expires.'}}}]}'; //Read Cloudfront Private Key Pair $fp=fopen($_SERVER['DOCUMENT_ROOT'].'/aws-sdk-php/pk-APKAJCEJ7LXUF3MKLPVA.pem',"r"); $priv_key=fread($fp,8192); fclose($fp); //Create the private key $key = openssl_get_privatekey($priv_key); if(!$key) { echo "

Failed to load private key!

"; return; } //Sign the policy with the private key if(!openssl_sign($json, $signed_policy, $key, OPENSSL_ALGO_SHA1)) { echo '

Failed to sign policy: '.openssl_error_string().'

'; return; } //Create url safe signed policy $base64_signed_policy = base64_encode($signed_policy); $signature = str_replace(array('+','=','/'), array('-','_','~'), $base64_signed_policy); //Construct the URL //&Ip='.$ip.' $url = $resource.'?Expires='.$expires.'&Signature='.$signature.'&Key-Pair-Id='.$keyPairId; return $url; } function get_s3_dll_legacy($objectPath,$seperator="&",$folder) { require_once($_SERVER['DOCUMENT_ROOT'].'/aws-sdk-php/S3.php'); $file = explode("/",$objectPath); $file = end($file); if($folder) { $file="$folder/$file"; } $bucketName="myvidster-cloud"; $s3_2 = new S3('AKIAJ2BLCJ627OPAHO6A','9RKdPyJNnPMBGPBFUX/rr1fUfYKxD7RAG+kGemlk'); $awsAccessKey = 'AKIAJ2BLCJ627OPAHO6A'; $awsSecretKey = '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'; $hours = 8; // time in hours $time = 5; do { // Calculating expiry time $expires = time() + ($hours * 3600) + $time; $signature = "GET\n\n\n$expires\n".'/'.$bucketName.'/'.$file; // Calculating HMAC-sha1 $hashedSignature = base64_encode(hash_hmac('sha1' ,$signature , $awsSecretKey , true )); $time++; } while(stristr($hashedSignature,"+")); // Constructing the URL $url = sprintf('https://%s.s3.amazonaws.com/%s', $bucketName , $file); // Constructing the query String $queryString = http_build_query( array( 'AWSAccessKeyId' => $awsAccessKey , 'Expires' => $expires , 'Signature' => $hashedSignature ), '', $seperator) ; // Apending query string to URL return $url.'?'.$queryString ; } function get_s3_meta($objectPath,$seperator="&") { require_once($_SERVER['DOCUMENT_ROOT'].'/aws-sdk-php/S3.php'); $file = explode("/",$objectPath); $file = end($file); $bucketName="myvidster-cloud"; //$s3_2 = new S3('AKIAJ2BLCJ627OPAHO6A', '9RKdPyJNnPMBGPBFUX/rr1fUfYKxD7RAG+kGemlk', 'd98c9864695adf35cb0d969359ade25f80bfdabf9a33256e08314f029544e6ee', '7102-3056-1280'); $s3_2 = new S3('AKIAJ2BLCJ627OPAHO6A','9RKdPyJNnPMBGPBFUX/rr1fUfYKxD7RAG+kGemlk'); $response = $s3_2->getObjectInfo($bucketName, $file); return $response; } function get_s3_meta2($objectPath,$s3) { $file = explode("/",$objectPath); $file = end($file); $bucketName="myvidster-cloud"; $response= $s3->headObject(array('Bucket' => $bucketName,'Key' => $file)); return $response; } function get_cloud_dl($file) { $secret = "myV453g"; $uri_prefix = "/dl/"; $file = explode("/",$file); $file = end($file); $f = "/$file"; $t = time(); $t_hex = sprintf("%08x", $t); $m = md5($secret.$f.$t_hex); if(strstr($file,".flv")) { $server = "server9.myvidster.com"; $file_url = "http://$server$uri_prefix$m/$t_hex$f"; } else { $server = "server2.myvidster.com:80"; $file_url = "http://$server$uri_prefix$m/$t_hex$f"; //temp check until server2 is sync $file_meta = curl_get_file_size($file_url); if($file_meta['http_code'] != 200) { $server = "server9.myvidster.com"; $file_url = "http://$server$uri_prefix$m/$t_hex$f"; $file_meta = curl_get_file_size($file_url); if($file_meta['http_code'] == 200) { $url="http://www.myvidster.com/scripts/cloud_sync.php?file=$file"; exec("wget -O /dev/null \"$url\" > /dev/null 2>&1 &"); } else { flag_cloud_upload(NULL,$file,'get_cloud_dl get_cloud_dl'); } } } return $file_url; } function set_video_nav($channel_id,$pos,$video_id,$video_count,$target="_self") { global $mysql_link_slave; global $mysql_link_slave; global $user_id; global $adult_filter; global $glb_nav_tmb_w; global $glb_nav_tmb_h; global $glb_memcached; $w=$glb_nav_tmb_w; $h=$glb_nav_tmb_h; $count = 5; //display 5 clips in relation to the one that was selected. $enable_porn = ",2"; //fetch videos! $first_vid = $pos - 3; $last_vid = $count; $last_vid_pos = $last_vid + $first_vid; if ($last_vid_pos > $video_count) { $first_vid = ($video_count - 5); $last_vid = $count; } if ($first_vid < 0) { $first_vid = 0; } if($user_id) $user_id_sql="user_id = '$user_id' OR "; else $user_id_sql=""; //myvidster_video USE INDEX(fast_idx) $sql = "SELECT master_id, id, title, thumbnail, user_id, private FROM myvidster_video USE INDEX(fast_idx) WHERE (channel_id = $channel_id AND private <> 3) AND ($user_id_sql private IN (0$enable_porn)) ORDER BY posted DESC LIMIT $first_vid,$last_vid"; $key="set_video_nav_".md5($sql); if($glb_memcached) { $video_nav = $glb_memcached->get($key); } else { $video_nav = apc_fetch($key,$apc); } if(!$video_nav) { $result = mysql_query($sql,$mysql_link_slave); $vid_pos = $first_vid + 1; $pre_vid_pos = $vid_pos - 3; if ($vid_pos > 1) { if ($pre_vid_pos < 1) $pre_vid_pos = 1; $video_pre ="
«
"; } else { $video_pre = "
«
"; } $video_thumb =''; if($result) { while($row = mysql_fetch_array($result)) { $thumbnail = $row['thumbnail']; $owner = $row['user_id']; $private = $row['private']; $master_id = $row['master_id']; //adult fiter algo if ($private == 0 || $user_id == $owner || $adult_filter == 0) { $thumbnail_list = tmb_loader($thumbnail); } else $thumbnail_list = "/images/adult.jpg"; $title = $row['title']; $id = $row['id']; $video_name_url = safe_url($title); if ($id != $video_id) { $video_thumb .= "
"; } else { $video_thumb .= "
"; } $vid_pos++; } $next_vid_pos = $vid_pos + 2; if ($vid_pos <= $video_count) { if ($next_vid_pos >= $video_count) $pre_vid_pos = $video_count; $video_nxt ="
»
"; } else { $video_nxt = "
»
"; } $video_nav ="
$video_pre
$video_thumb
$video_nxt
"; if($glb_memcached) { $glb_memcached->set($key,$video_nav,120); } else { apc_store($key, $video_nav,120); } } } return $video_nav; } function set_video_nav_all($gallery_id,$pos,$video_id,$video_count,$target="_self") { global $mysql_link_slave; global $mysql_link_slave; global $user_id; global $adult_filter; global $glb_nav_tmb_w; global $glb_nav_tmb_h; $w=$glb_nav_tmb_w; $h=$glb_nav_tmb_h; $count = 5; //return "Bookmark Slider Temporary Offline"; $enable_porn = ",2"; $first_vid = $pos - 3; $last_vid = 5; $last_vid_pos = $last_vid + $first_vid; if ($last_vid_pos > $video_count) { $first_vid = ($video_count - $count); $last_vid = $count; } if ($first_vid < 0) { $first_vid = 0; } if($user_id) $user_id_sql="video.user_id = '$user_id' OR"; else $user_id_sql=""; //myvidster_video video USE INDEX(fast_idx) $sql="SELECT video.master_id, video.id, video.thumbnail, video.title, video.user_id, video.private FROM myvidster_video video USE INDEX(fast_idx), myvidster_channel channel, myvidster_gallery gallery WHERE (gallery.id = channel.gallery_id AND channel.id = video.channel_id AND gallery.id = $gallery_id AND video.private <> 3) AND ($user_id_sql video.private IN (0$enable_porn)) ORDER BY video.posted DESC LIMIT $first_vid,$last_vid"; $apc_label="set_video_nav_".md5($sql); $video_nav = apc_fetch($apc_label,$apc); if(!$apc) { $result = mysql_query($sql,$mysql_link_slave); $vid_pos = $first_vid + 1; $pre_vid_pos = $vid_pos - 3; if ($vid_pos > 1) { if ($pre_vid_pos < 1) $pre_vid_pos = 1; $video_pre = "
«
"; } else { $video_pre = "
«
"; } $video_thumb=''; if($result) { while($row = mysql_fetch_array($result)) { $thumbnail = $row['thumbnail']; $owner = $row['user_id']; $private = $row['private']; $master_id = $row['master_id']; //adult fiter algo if ($private == 0 || $user_id == $owner || $adult_filter == 0) { $thumbnail_list = tmb_loader($thumbnail); } else $thumbnail_list = "/images/adult.jpg"; $title = $row['title']; $id = $row['id']; $video_name_url = safe_url($title); if ($id != $video_id) { $video_thumb .= "
"; } else { $video_thumb .= "
"; } $vid_pos++; } $next_vid_pos = $vid_pos + 2; if ($vid_pos <= $video_count) { if ($next_vid_pos >= $video_count) $pre_vid_pos = $video_count; $video_nxt ="
»
"; } else { $video_nxt = "
»
"; } $video_nav ="
$video_pre
$video_thumb
$video_nxt
"; apc_store($apc_label, $video_nav,90); } } return $video_nav; } function getPaginationString_lite($dis_user_id,$page,$prepage,$nxtpage,$thumb_num,$video_count) { $pagination = ''; if($prepage > 0) $pagination .= ''; else $pagination .= ''; $pagination .= ''; if($video_count > $thumb_num - 1 && $page < 100) $pagination .= ''; else $pagination .= ''; $pagination .= '
 
'; return $pagination; } function getPaginationString($page = 1, $totalitems, $limit = 15, $adjacents = 1, $targetpage = "/", $id = 0, $thumbnum=1,$mini=false) { //defaults if(!$adjacents) $adjacents = 1; if(!$limit) $limit = 15; if(!$page) $page = 1; if(!$targetpage) $targetpage = "/"; //other vars $prev = $page - 1; //previous page is page - 1 $next = $page + 1; //next page is page + 1 $lastpage = ceil($totalitems / $limit); //lastpage is = total items / items per page, rounded up. $lpm1 = $lastpage - 1; //last page minus 1 $padding=""; $margin=""; if(!$mini) { $nxt_txt='>'._("next").' »'; $pre_txt='>« '._("prev"); $max_lastpage = 8; } else { $nxt_txt='style="font-size:1.25em;padding-top:0px; padding-bottom:1px;"> » '; $pre_txt='style="font-size:1.25em;padding-top:0px; padding-bottom:1px;"> « '; $max_lastpage = 7; } /* Now we apply our rules and draw the pagination object. We're actually saving the code to a variable in case we want to draw it more than once. */ $pagination = ""; if($lastpage > 1) { $pagination .= "
1) $pagination .= ""; else $pagination .= ""; //pages if ($lastpage < 7 + ($adjacents * 2)) //not enough pages to bother breaking it up { for ($counter = 1; $counter <= $lastpage; $counter++) { if ($counter == $page) $pagination .= "$counter"; else $pagination .= "$counter"; } } elseif($lastpage >= 7 + ($adjacents * 2)) //enough pages to hide some { //close to beginning; only hide later pages if($page < 1 + ($adjacents * $max_lastpage)) { for ($counter = 1; $counter < $max_lastpage + ($adjacents * 2); $counter++) { if ($counter == $page) $pagination .= "$counter"; else $pagination .= "$counter"; } $pagination .= "..."; $pagination .= "$lpm1"; $pagination .= "$lastpage"; } //in middle; hide some front and some back elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2)) { $pagination .= "1"; $pagination .= "2"; $pagination .= "..."; for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++) { if ($counter == $page) $pagination .= "$counter"; else $pagination .= "$counter"; } $pagination .= "..."; $pagination .= "$lpm1"; $pagination .= "$lastpage"; } //close to end; only hide early pages else { $pagination .= "1"; $pagination .= "2"; $pagination .= "..."; for ($counter = $lastpage - (1 + ($adjacents * 3)); $counter <= $lastpage; $counter++) { if ($counter == $page) $pagination .= "$counter"; else $pagination .= "$counter"; } } } //next button if ($page < $counter - 1) $pagination .= ""; else $pagination .= ""; $pagination .= "
\n"; } return $pagination; } function get_myVidsterAD() { global $glb_no_ads; global $glb_last_vid_access; global $adult_filter; global $user_id; $myVidsterAD=""; $myVidsterAD2=""; if($adult_filter) { $vid_access=0; } else { if(!isset($glb_last_vid_access)) $vid_access=0; else $vid_access=$glb_last_vid_access; } $myv_pro_txt_ad=''; if (!isset($_SESSION['ad_rotate_misc'])) { $ad_rotate_misc=mt_rand(0, 3); } else $ad_rotate_misc=$_SESSION['ad_rotate_misc']; switch ($ad_rotate_misc) { case 0: $adult_ad = fetch_ad('a1'); $ff_ad = fetch_ad('f1'); $ad_rotate_misc=1; break; case 1: $adult_ad = fetch_ad('a2'); $ff_ad = fetch_ad('f2'); $ad_rotate_misc=2; break; case 2: $adult_ad = fetch_ad('a3'); $ff_ad = fetch_ad('f1'); $ad_rotate_misc=3; break; case 3: default: $adult_ad = fetch_ad('a4'); $ff_ad = fetch_ad('f2'); $ad_rotate_misc=0; break; } $_SESSION['ad_rotate_misc']=$ad_rotate_misc; if ($vid_access == 2) $myVidsterAD=$adult_ad; else $myVidsterAD=$ff_ad; if($myVidsterAD && !$glb_no_ads) $myVidsterAD='
'.$myv_pro_txt_ad.'
'.$myVidsterAD.'
'; else $myVidsterAD=''; return $myVidsterAD; } function promoted_app() { $myv_ad_title = 'You should download the MyVidster App!'; $myv_ad_url = '/docs/mobile'; $myv_ad_thumb = '//cdn1.myvidster.com/ads/android-ios175.jpg'; $myv_ad_desc = 'Sponsored AD by
MyVidster - Collect the videos you love'; $myv_ad_desc ='You can now take MyVidster to go and enjoy all of its benefits in the palm of your hand.'; $profile_url="
\"thumbnail\"
"._("Promoted by").":
MyVidster
"; $myv_ad_target=""; $myv_videos .= '
thumbnail
'.$myv_ad_title.'
'.$myv_ad_desc.'
' . $profile_url . '
'; return $myv_videos; } function promoted_videos($audience,$ov=false) { global $mysql_link_slave; global $mysql_link_slave2; global $adult_filter; global $user_id; global $glb_home_thumb_w; global $glb_home_thumb_h; global $glb_home_thumb_w; $myv_videos=""; $home_thumb_w_home = $glb_home_thumb_w+15; if(isset($_SESSION['glb_promoted_watched'])) { $sql_watched = implode(',',$_SESSION['glb_promoted_watched']); $sql_watched = " and p.id NOT IN ($sql_watched)"; } else $sql_watched = ""; if($adult_filter) $sql_where = "p.audience IN ('all','family')"; else { if($audience == 'all') $sql_where = "p.audience IN ('gay','straight','all')"; else $sql_where = "p.audience IN ('$audience','all')"; } if($ov) $x=1; else $x = mt_rand(0,3); if($x == 1) { $sql_where .= " and p.featured = 1"; $sql_watched = ""; } $query = "select p.featured, p.id, p.video_id from myvidster_promoted p where p.status = 1 and $sql_where $sql_watched order by rand() limit 1"; $p_results = mysql_query($query,$mysql_link_slave2); if($p_results) { $p_row = mysql_fetch_array($p_results); $p_id = $p_row['id']; $p_video_id = $p_row['video_id']; $p_featured = $p_row['featured']; } if($p_video_id) { $query = "select u.profile_photo, u.disp_name, u.email, v.title, v.thumbnail, v.channel_id, v.description, v.master_id from myvidster_video v JOIN myvidster_user u ON u.id = v.user_id where v.id = $p_video_id"; $p_results = mysql_query($query,$mysql_link_slave); $p_row = mysql_fetch_array($p_results); } else { unset($_SESSION['glb_promoted_watched']); return false; } $_SESSION['glb_promoted_watched'][] = $p_id; $p_title = $p_row['title']; $p_title = str_replace(" - Pornhub.com","",$p_title); $p_title = shortentext($p_title,60); $p_thumb = tmb_loader($p_row['thumbnail']); $p_channel = $p_row['channel_id']; $p_profile_photo = $p_row['profile_photo']; $p_user = $p_row['disp_name']; $p_email = $p_row['email']; $p_desc = shortentext($p_row['description'], 145); $p_master_id = $p_row['master_id']; if($p_featured) $promo_txt=_("Featured by"); else $promo_txt=_("Promoted by"); if(!$p_profile_photo) { $p_profile_photo = get_gravatar($p_email,40,'monsterid','pg',false,1); } $p_video_name_url = safe_url($p_title); $p_profile_url="
\"thumbnail\"
$promo_txt
$p_user
"; $myv_videos .= '
thumbnail
' . $p_title . '
'.$p_desc.'
' . $p_profile_url . '
'; return $myv_videos; } function display_promoted($audience) { global $mysql_link_slave; global $mysql_link_slave2; global $adult_filter; global $user_id; if(!$adult_filter && $audience != 'straight') { $sql_where='0,2'; $promote_max = 4; } else { $sql_where='0'; $promote_max = 3; } $glb_promoted_sel=$_SESSION['glb_promoted_sel']; $tmp_selector = mt_rand(0,$promote_max); if($glb_promoted_sel == $tmp_selector) { while( in_array( ($n = mt_rand(0,$promote_max)), array($tmp_selector) ) ); $tmp_selector = $n; } $selector = $tmp_selector; $_SESSION['glb_promoted_sel'] = $tmp_selector; switch ($selector) { case 0: //return promoted_app(); return promoted_videos($audience); break; case 1: case 2: case 3: return promoted_videos($audience); break; case 99: //update image before enabling $myv_ad_title = 'Discover New Videos with our Video Shuffle Wall!'; $myv_ad_url = '/video_shuffle/new/'.$audience; $myv_ad_thumb = '//cdn1.myvidster.com/images/video_shuffle_new.jpg?v=1'; $myv_ad_desc = 'Sponsored AD by MyVidster - Collect the videos you love'; $myv_ad_desc ='Check out our Video Shuffle Wall to quickly discover new and popular videos on MyVidster!'; $profile_url="
\"thumbnail\"
Promoted by:
MyVidster
"; $myv_ad_target=""; break; case 4: $sql="SELECT g.id, g.title, g.description, g.profile_photo, u.disp_name, u.email, u.profile_photo owner_profile_photo FROM myvidster_group g JOIN myvidster_user u ON u.id = g.user_id WHERE g.status = 1 and g.access IN ($sql_where) and featured=1 order by rand() limit 1"; $apc_label="promoted_group_".md5($sql); $row1=apc_fetch($apc_label,$apc); if(!$apc) { $results1 = mysql_query($sql,$mysql_link_slave); $row1 = mysql_fetch_assoc($results1); apc_store($apc_label, $row1,60); } $myv_ad_title = $row1['title']; $myv_ad_url = '/groups/'.$row1['id'].'/'.safe_url($row1['title']); $myv_ad_thumb = tmb_loader($row1['profile_photo']); $myv_ad_desc = 'Featured Group: '.ShortenText($row1['description'], 145); $myv_ad_creator_photo = $row1['owner_profile_photo']; $myv_ad_creator_name = $row1['disp_name']; $myv_ad_creator_email = $row1['email']; if(!$myv_ad_creator_photo) $myv_ad_creator_photo = get_gravatar($myv_ad_creator_email,40,'monsterid','pg',false,1); $profile_url="
\"thumbnail\"
Created by:
$myv_ad_creator_name
"; $myv_ad_target=""; break; case 5: $myv_ad_title = 'Love MyVidster? UPGRADE to MyVidster PRO!'; $myv_ad_url = '/get_pro.php?ref=homepage'; $myv_ad_thumb = '/images/badges/gold-coin-pro-57.png'; $myv_ad_desc = 'Sponsored AD by MyVidster - Collect the videos you love'; $myv_ad_desc ='Ad-free browsing, PRO badge and rates starting at $4.99 a month.'; $profile_url="
\"thumbnail\"
Promoted by:
MyVidster
"; $myv_ad_target=""; break; } $myv_videos .= '
thumbnail
'.$myv_ad_title.'
'.$myv_ad_desc.'
' . $profile_url . '
'; return $myv_videos; } function mongo_notify_insert($tmp_user_id,$type,$type_id,$master_id,$video_id,$thumbnail,$posted_by,$message,$posted,$external_url) { global $mongo_link_master; global $mysql_link_slave; global $mysql_link_slave; global $glb_user_token; if(!$mongo_link_master) { return true; } if(!$glb_user_token || !$tmp_user_id) return true; $sql="SELECT b.id FROM myvidster_block_user b JOIN myvidster_user u ON u.id = b.block_user_id WHERE b.user_id = $tmp_user_id and u.disp_name = '$posted_by' and b.status = 1 limit 1"; $result = mysql_query($sql,$mysql_link_slave); if($result) { $row = mysql_fetch_assoc($result); if($row['id']) { return false; } } $message = htmlspecialchars($message); $collection = $mongo_link_master->notify; if($collection) { if($posted) $posted_formated = new MongoDate(strtotime($posted)); else $posted_formated = new MongoDate(); $obj = array( "user_id" => "$tmp_user_id", "type" => "$type", "type_id" => "$type_id", "master_id" => "$master_id", "video_id" => "$video_id", "thumbnail" => "$thumbnail", "posted_by" => "$posted_by", "message" => "$message", "posted" => $posted_formated, "external_url" => "$external_url", "status" => "1" ); $collection->insert($obj); } if($type == "share") { $sql = "select email from myvidster_user where id='$tmp_user_id' and notify_disable not like '%email_video%' and valid_email=1"; $result = mysql_query($sql,$mysql_link_slave) or die("Could not run query."); $row = mysql_fetch_array($result); if($row['email']) { $to=$row['email']; $from="no-reply@myvidster.com"; $subject="$posted_by is sharing a video with you!"; $thumbnail = tmb_loader($thumbnail); $message="$posted_by is sharing video with you.
$message
//www.myvidster.com/video/$video_id

If you do not want to receive email notifications please disable email notifications in the user options.

MyVidster - collect the videos you love"; //hack to block abusive users //if($posted_by!='MrSKINFLICK' || $posted_by!='manuelmoranmoran') //send_mail($to,$from,$subject,$message); } } } function send_mail($to,$from,$subject,$message) { require_once($_SERVER['DOCUMENT_ROOT']."/user/class.phpmailer.php"); $mail = new PHPMailer(); $mail->SetLanguage("en"); $mail->IsSMTP(); // set mailer to use SMTP $mail->Host = "smtp.sendgrid.net:2525"; //$mail->Host = "smtp.sendgrid.net:25"; // specify main and backup server $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "apikey"; // SMTP username $mail->Password = "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"; // SMTP password $mail->From = "no-reply@myvidster.com"; $mail->FromName = "MyVidster"; $mail->AddReplyTo($from); $mail->AddAddress($to); $mail->WordWrap = 50; // set word wrap to 50 characters $mail->IsHTML(true); // set email format to HTML $mail->Subject = $subject; $body =stripslashes(nl2br($message)); $mail->Body = $body; if(!$mail->Send()) { $status.= "Message could not be sent.

"; $status.= "Mailer Error: " . $mail->ErrorInfo; } else { $status=true; } return $status; } function curl_get_file_size($url,$referer=NULL) { $arr_domain=parse_url($url); if($arr_domain['host']) $domain=$arr_domain['scheme']."://".$arr_domain['host']; else $domain="https://www.myvidster.com"; if(strstr($url,".cdn") || strstr($url,".sex.com") || strstr($url,".kordonivkakino.net") || strstr($url,".neodrive.co") ) $domain=""; elseif(strstr($domain,".tub99.com")) $domain="https://www.tub99.com/"; elseif(strstr($url,"xdomain=")) { $start = explode("xdomain=",$url); $domain = end($start); } //hack for these sites that block my ip if(stristr($url,"jerkyourtube.eu") || stristr($url,"youtube.com") || stristr($url,"pridetube.com") || stristr($url,"theluckeystartube.com") || stristr($url,"xxxbunker.com") || stristr($url,"www.w3.org") || stristr($url,"ccstatic.highwebmedia.com") || stristr($url,"//chaturbate.com/") ) return false; // Assume failure. $result = -1; $curl = curl_init( $url ); // Issue a HEAD request and follow any redirects. curl_setopt( $curl, CURLOPT_NOBODY, true ); curl_setopt( $curl, CURLOPT_HEADER, true ); curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $curl, CURLOPT_FOLLOWLOCATION, true ); if($referer) { curl_setopt( $curl, CURLOPT_REFERER, $referer); } $ua="Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36"; curl_setopt( $curl, CURLOPT_USERAGENT, $ua); curl_setopt( $curl, CURLOPT_TIMEOUT, 20); curl_setopt( $curl, CURLOPT_CONNECTTIMEOUT, 20); curl_setopt( $curl, CURLOPT_MAXREDIRS, 5); // stop after 5 redirects curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, false); /* if(stristr($url,".tumblr.com/video_file/")) { // curl_setopt($curl, CURLOPT_PROXY, "108.59.9.137:3128"); curl_setopt($curl, CURLOPT_HTTPPROXYTUNNEL, 0); } */ $data = curl_exec( $curl ); $results['contentType'] = curl_getinfo($curl, CURLINFO_CONTENT_TYPE); $results['content_length'] = curl_getinfo($curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD); $results['http_code'] = curl_getinfo($curl, CURLINFO_HTTP_CODE); curl_close( $curl ); return $results; } function flag_cloud_upload($id,$file,$reason) { global $mysql_link_slave; global $mysql_link_slave; global $mysql_link_master; if($file) { $file = explode(".",$file); $hash = $file[0]; $query = "select id from myvidster_vbackup where hash = '$hash' order by id desc limit 1"; $result = mysql_query($query,$mysql_link_slave); $row = mysql_fetch_array($result); $id = $row['id']; } if($id) { $query = "select id from myvidster_flag_cloud where vbackup_id = '$id'"; $result = mysql_query($query,$mysql_link_slave); $row = mysql_fetch_array($result); $vbackup_id = $row['id']; if(!$vbackup_id) { $query = "insert into myvidster_flag_cloud (vbackup_id,reason) values ($id,'$reason')"; mysql_query($query,$mysql_link_master); } else { $query = "update myvidster_flag_cloud set status=1 where id = $vbackup_id"; mysql_query($query,$mysql_link_master); } } } function getPaginationString_no_ajax($page = 1, $totalitems, $limit = 15, $adjacents = 1, $targetpage = "/", $pagestring = "&page=") { //defaults if(!$adjacents) $adjacents = 1; if(!$limit) $limit = 15; if(!$page) $page = 1; if(!$targetpage) $targetpage = "/"; //other vars $prev = $page - 1; //previous page is page - 1 $next = $page + 1; //next page is page + 1 $lastpage = ceil($totalitems / $limit); //lastpage is = total items / items per page, rounded up. $lpm1 = $lastpage - 1; //last page minus 1 $pagestring1 = $pagestring."1"; $pagestring2 = $pagestring."2"; /* Now we apply our rules and draw the pagination object. We're actually saving the code to a variable in case we want to draw it more than once. */ $pagination = ""; if($lastpage > 1) { $pagination .= "

1) $pagination .= "« prev"; else $pagination .= "« prev"; //pages if ($lastpage < 7 + ($adjacents * 2)) //not enough pages to bother breaking it up { for ($counter = 1; $counter <= $lastpage; $counter++) { if ($counter == $page) $pagination .= "$counter"; else $pagination .= "$counter"; } } elseif($lastpage >= 7 + ($adjacents * 2)) //enough pages to hide some { //close to beginning; only hide later pages if($page < 1 + ($adjacents * 3)) { for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++) { if ($counter == $page) $pagination .= "$counter"; else $pagination .= "$counter"; } $pagination .= "..."; $pagination .= "$lpm1"; $pagination .= "$lastpage"; } //in middle; hide some front and some back elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2)) { $pagination .= "1"; $pagination .= "2"; $pagination .= "..."; for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++) { if ($counter == $page) $pagination .= "$counter"; else $pagination .= "$counter"; } $pagination .= "..."; $pagination .= "$lpm1"; $pagination .= "$lastpage"; } //close to end; only hide early pages else { $pagination .= "1"; $pagination .= "2"; $pagination .= "..."; for ($counter = $lastpage - (1 + ($adjacents * 3)); $counter <= $lastpage; $counter++) { if ($counter == $page) $pagination .= "$counter"; else $pagination .= "$counter"; } } } //next button if ($page < $counter - 1) $pagination .= ""._("next")." »"; else $pagination .= ""._("next")." »"; $pagination .= "
\n"; } return $pagination; } function scaleserp_web_search($query,$start,$mobile=false) { global $adult_filter; if($adult_filter) { $safe='on'; } else { $safe='off'; } $rm_sites = "-site:exporntoons.net -site:mat6tube.com -site:noodlemagazine.com -site:manyvids.com -site:clips4sale.com -site:xfantazy.com -site:daftsex.com -site:pornocriceto.com -site:buylegalporno.com -site:sxyprn.com -site:sxyprn.net -site:anybunny.com -site:freepornxxxhd.com -site:sineplex.net -site:anybunny.tv -site:porngo.com -site:hellporno.com -site:biguz.net -site:gosexpod.com -site:xvideos2.com -site:bangx.org -site:vidmo.org -site:peekvids.com -site:mojva.com -site:melonstube.cc -site:legalporno.com -site:faphouse.com"; $query = trim($query)." ".$rm_sites; $hits = array(); if($query) { if(!$start) $start = 1; $queryString = http_build_query([ 'api_key' => '5063CBCB798C4DA3996A7CA114D14CE0', 'q' => $query, 'search_type' => 'videos', 'safe' => $safe, 'num' => '20', 'page' => $start ]); # make the http GET request to Scale SERP $ch = curl_init(sprintf('%s?%s', 'https://api.scaleserp.com/search', $queryString)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $api_result = curl_exec($ch); curl_close($ch); # print the JSON response from Scale SERP $results = json_decode($api_result, false); $videos = $results->video_results; if($videos) { foreach($videos as $video) { if(!$mobile) { $hits[] = array('link' => $video->link, 'thumb' => $video->image, 'title' => $video->title, 'description' => $video->snippet, 'source' => get_domain($video->link)); } else { $hits[] = array('link' => $video->link, 'video_thumbnail' => $video->image, 'video_title' => $video->title, 'source' => get_domain($video->link), 'video_id' => $video->link); } } } else { $hits = false; } } else { $hits = false; } return $hits; } function adult_web_search($search,$page,$mobile=false,$category ="") { $search = urlencode(trim($search)); $api_url="https://www.pornhub.com/webmasters/search?search=$search&thumbsize=large_hd&page=$page".$category; if($mobile) $apc_label = "web_search".md5($api_url."mobile"); else $apc_label = "web_search".md5($api_url."desktop"); $response = apc_fetch($apc_label,$apc); if(!$apc) { $response = curl_scrape($api_url,20024); apc_store($apc_label, $response,60*10); } $jsonobj = json_decode($response); if($jsonobj->message != 'No Videos found!') { foreach ($jsonobj->videos as $videos) { $link = $videos->url; $thumb = $videos->default_thumb; $title = $videos->title; $description = ''; $source = "pornhub.com"; if(!$mobile) { $hits[] = array('link' => $link, 'thumb' => $thumb, 'title' => $title, 'description' => $description, 'source' => $source); } else { $hits[] = array('video_id' => $link, 'video_thumbnail' => $thumb, 'video_title' => $title, 'source' => $source); } } } return $hits; } function iExplode($Delimiter, $String, $Limit = '') { $Explode = array(); $LastIni = 0; $Count = 1; if (is_numeric($Limit) == false) $Limit = ''; while ( false !== ( $Ini = stripos($String, $Delimiter, $LastIni) ) && ($Count < $Limit || $Limit == '')) { $Explode[] = substr($String, $LastIni, $Ini-$LastIni); $LastIni = $Ini+strlen($Delimiter); $Count++; } $Explode[] = substr($String, $LastIni); return $Explode; } function mysql_fetch_all(array &$rows=NULL) { while($row=mysql_fetch_array($this->result)) { $rows[] = $row; } if(isset($rows)) { return $rows; } return NULL; } function cloud_upload_mysqli($title,$master_id,$user_id,$thumbnail,$flv_download,$video_id,$type_url,$queue=false) { global $mysqli_link_slave; global $mysqli_link_slave2; global $mysqli_link_master; $type_url = sanitize_sql_string($type_url); //this is needed b/c single quotas have been found see manage.inc.php mrg if($user_id == 436) $limit = 2; else $limit = 3; $ran = rand(); $hash = ""; $newfile = "videos/$ran.mp4"; $query = "SELECT count(id) cnt from myvidster_vbackup where user_id='$user_id' and completed IN (2,6,7)"; //and file_size > 0 sleep(2); //do not remove hacker man will fuck you good $result = $mysqli_link_slave2->query($query); //mrg $row=$result->fetch_assoc(); $cnt = $row['cnt']; if($cnt <= $limit) { $scraper = get_upload_server($flv_download,$video_id); $flv_download = $scraper.".mp4"; $completed=6; $query = "insert into myvidster_download (title,master_id,user_id,thumbnail,filepath,video_id,type_url,source) VALUES ('$title','$master_id','$user_id','$thumbnail','$flv_download','$video_id','$type_url',2)"; $mysqli_link_master->query($query); $dl_id = $mysqli->insert_id; $query = "INSERT INTO myvidster_vbackup (video_id, user_id, vid_download, newfile, completed, thumbnail, hash) VALUES ($dl_id, $user_id, '$flv_download', '$newfile', $completed,'$thumbnail','$hash')"; $mysqli_link_master->query($query); $insert_id = $mysqli->insert_id; $newfile = "videos/$insert_id.mp4"; $query = "UPDATE myvidster_vbackup SET newfile = '$newfile' WHERE id=$insert_id"; $mysqli_link_master->query($query); } return true; } function cloud_upload($title,$master_id,$user_id,$thumbnail,$flv_download,$video_id,$type_url,$queue=false) { if(!function_exists('mysql_connect')) { return cloud_upload_mysqli($title,$master_id,$user_id,$thumbnail,$flv_download,$video_id,$type_url,$queue=false); } global $mysql_link_slave; global $mysql_link_slave2; global $mysql_link_master; $type_url = sanitize_sql_string($type_url); //this is needed b/c single quotas have been found see manage.inc.php mrg if($user_id == 436) $limit = 2; else $limit = 3; $ran = rand(); $hash = ""; $newfile = "videos/$ran.mp4"; $query = "SELECT count(id) cnt from myvidster_vbackup where user_id='$user_id' and completed IN (2,6,7)"; //and file_size > 0 sleep(2); //do not remove hacker man will fuck you good $result = mysql_query($query,$mysql_link_slave2); //mrg $row=mysql_fetch_assoc($result); $cnt = $row['cnt']; if($cnt <= $limit) { $scraper = get_upload_server($flv_download,$video_id); $flv_download = $scraper.".mp4"; $completed=6; $query = "insert into myvidster_download (title,master_id,user_id,thumbnail,filepath,video_id,type_url,source) VALUES ('$title','$master_id','$user_id','$thumbnail','$flv_download','$video_id','$type_url',2)"; mysql_query($query,$mysql_link_master); $dl_id = mysql_insert_id(); $query = "INSERT INTO myvidster_vbackup (video_id, user_id, vid_download, newfile, completed, thumbnail, hash) VALUES ($dl_id, $user_id, '$flv_download', '$newfile', $completed,'$thumbnail','$hash')"; mysql_query($query,$mysql_link_master); $insert_id = mysql_insert_id(); $newfile = "videos/$insert_id.mp4"; $query = "UPDATE myvidster_vbackup SET newfile = '$newfile' WHERE id=$insert_id"; mysql_query($query,$mysql_link_master); } return true; } function get_video_by_id($id) { global $config; global $mysql_link_slave; global $user_id; $viddata = false; if($user_id) { $id = intval($id); $sql = "SELECT * FROM myvidster_video v WHERE v.id = '$id'"; $result = mysql_query($sql,$mysql_link_slave); $viddata = mysql_fetch_assoc($result); } return $viddata; } Function get_channel_by_name($name) { global $user_id; $query = "SELECT id FROM myvidster_channel WHERE name = '$name' AND user_id = '$user_id'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result); $id = $row['id']; Return $id; } function SmartAddSlashes($str){ if (get_magic_quotes_gpc()){ return $str; } else{ return addslashes($str); } //if magic_quotes_gpc } function SmartStripSlashes($str){ if (get_magic_quotes_gpc()){ return stripslashes($str); }else{ return $str; }//if magic_quotes_gpc } function left ($str, $howManyCharsFromLeft) { return substr ($str, 0, $howManyCharsFromLeft); } function right ($str, $howManyCharsFromRight) { $strLen = strlen ($str); return substr ($str, $strLen - $howManyCharsFromRight, $strLen); } function mid ($str, $start, $howManyCharsToRetrieve = 0) { $start--; if ($howManyCharsToRetrieve === 0) $howManyCharsToRetrieve = strlen ($str) - $start; return substr ($str, $start, $howManyCharsToRetrieve); } function is_firefox() { $agent = ''; // old php user agent can be found here if (!empty($HTTP_USER_AGENT)) $agent = $HTTP_USER_AGENT; // newer versions of php do have useragent here. if (empty($agent) && !empty($_SERVER["HTTP_USER_AGENT"])) $agent = $_SERVER["HTTP_USER_AGENT"]; if (!empty($agent) && preg_match("/firefox/si", $agent)) return 1; if (!empty($agent) && preg_match("/MSIE/si", $agent)) return 2; return false; } function get_user_browser() { $u_agent = $_SERVER['HTTP_USER_AGENT']; $ub = ''; if(preg_match('/MSIE/i',$u_agent)) { $ub = "ie"; } elseif(preg_match('/Firefox/i',$u_agent)) { $ub = "firefox"; } elseif(preg_match('/Chrome/i',$u_agent)) { $ub = "chrome"; } elseif(preg_match('/Safari/i',$u_agent)) { $ub = "safari"; } elseif(preg_match('/Flock/i',$u_agent)) { $ub = "flock"; } elseif(preg_match('/Opera/i',$u_agent)) { $ub = "opera"; } return $ub; } function create_header_lite() { $header ='
'._("collect the videos you love").'
'._('collect').' | '._('share').' | '._('explore').'
'; return $header; } function get_family_popunder() { if (!isset($_SESSION['family_popunder'])) { $family_popunders[]=''; //good $family_popunders[]=''; //good $family_popunders[]=''; //good $fp_cnt = count($family_popunders); $fp_pick = rand(0,$fp_cnt -1); $family_popunder = $family_popunders[$fp_pick]; $_SESSION['family_popunder'] = $family_popunder; } else { $family_popunder = $_SESSION['family_popunder']; } return true; //MRG ad tags need updated return $family_popunder; } function sm_hash_email($email){ $parts = explode('@',$email); //split the email into the local and domain parts $res = ''; $res .= 'H1:' . sha1(strtolower($email)); // SHA1 hexadecimal string of the lowercase version of the email address $res .= ',H2:' . sha1(strtoupper($email)); # SHA1 hexadecimal string of the uppercase version of the email address $res .= ',H3:' . sha1(strtolower($parts[1])); # SHA1 hexadecimal string of the lowercase version of the email domain $res .= ',H4:' . md5 (strtolower($email)); # MD5 hexadecimal string of the lowercase version of the email address $res .= ',H5:' . md5 (strtoupper($email)); # MD5 hexadecimal string of the uppercase version of the email address $res .= ',H6:' . hash('sha256', strtolower($email)); # SHA256 hexadecimal string of the lowercase version of the email address $res .= ',H7:' . hash('sha256', strtoupper($email)); # SHA256 hexadecimal string of the uppercase version of the email address return $res; } function adult_content($string) { global $mysql_link_slave; $chunks = 50; $query = "SELECT * FROM myvidster_adult_meta WHERE status = 1"; $result = mysql_query($query, $mysql_link_slave); while($row = mysql_fetch_array($result)) { $type = $row['type']; $meta = $row['meta']; if($type == 1){ $meta = str_replace ("http://", "", $meta); $meta = str_replace ("www.", "", $meta); $compare_string = substr($meta, -1); if($compare_string === "/"){ $meta = str_replace ("/", "", $meta); } //To escape special characters $meta = addcslashes("$meta","."); $meta = addcslashes("$meta","-"); $meta = addcslashes("$meta",":"); $meta = addcslashes("$meta","/"); $domain_patterns[] = $meta; } elseif($type == 2){ $meta = str_replace ("http://", "", $meta); $meta = str_replace ("www.", "", $meta); $compare_string = substr($meta, -1); if($compare_string === "/"){ $meta = str_replace ("/", "", $meta); } //To escape special characters $meta = addcslashes("$meta","."); $meta = addcslashes("$meta","-"); $meta = addcslashes("$meta",":"); $meta = addcslashes("$meta","/"); $domain2_patterns[] = $meta; } elseif($type == 3){ $append = '\b'; $word = $append.$meta.$append; $word_patterns[] = $meta; } } $m2_v_ids = array_chunk($domain_patterns, $chunks); foreach($m2_v_ids as $m2_v_id) { $domain_pattern = '/'.rtrim(implode("|",$m2_v_id)).'/i'; $result = preg_match($domain_pattern, $string, $matches); if($result){ return 1; //adult domain } unset($matches); } unset($m2_v_ids); $m2_v_ids = array_chunk($domain2_patterns, $chunks); foreach($m2_v_ids as $m2_v_id) { $domain2_pattern = '/'.rtrim(implode("|",$m2_v_id)).'/i'; $result = preg_match($domain2_pattern, $string, $matches); if($result){ return 2; //mostly adult content } unset($matches); } unset($m2_v_ids); $m2_v_ids = array_chunk($word_patterns, $chunks); foreach($m2_v_ids as $m2_v_id) { $word_pattern = '/'.rtrim(implode("|",$m2_v_id)).'/i'; $result = preg_match($word_pattern, $string, $matches); if($result){ return 3; //word filter } unset($matches); } return 0; //no match, public video } function mongo_cometchat_insert($id,$from,$to,$message,$sent,$read,$direction) { global $mongo_link_master; if(!$mongo_link_master) { return true; } $collection = $mongo_link_master->cometchat2; $message = new MongoBinData($message); $id = intval($id); $sent = intval($sent); $read = intval($read); $direction = intval($direction); $obj = array( "id" => $id, "from" => "$from", "to" => "$to", "message" => $message, "sent" => $sent, "read" => $read, "direction" => $direction); $collection->insert($obj); } function build_thumb_html($file) { global $mysql_link_slave; $thumb_html = ""; $arr_domain=parse_url($file); $start = explode("/",$arr_domain['path'],2); $end = explode('.',$start[1],2); $master_id = $end[0]; $img_server="https://cdn1.myvidster.com"; $max_thumbs = 100; $thumbnails = ""; $sql="select id, duration, seconds from myvidster_duration where master_id = '$master_id' and status = 1 limit 1"; $result = mysql_query($sql,$mysql_link_slave); $row = mysql_fetch_array($result); $duration = $row['duration']; $seconds = $row['seconds']; $id = $row['id']; if(!$id) { duration_fix($master_id); return true; } if($duration && $duration != '0.000') { $thumb_cnt = ceil($duration / $seconds); if($thumb_cnt > $max_thumbs) { $z_factor = ceil($duration / $max_thumbs / $seconds); } else { $z_factor = 1; } for ($i = $z_factor; $i <= $thumb_cnt; $i+=$z_factor) { $z = $i - $z_factor; $zs = $z * $seconds; $tmb_cnt=str_pad($i,3,"0",STR_PAD_LEFT); $thumbnails[] = "$zs: {src: '$img_server/$master_id/img$tmb_cnt.jpg', style: {left: '-90px',width: '180px'}}"; $thumbnails_pl[]="img$z = new Image();\n img$z.src = '$img_server/$master_id/img$tmb_cnt.jpg';\n"; } if($thumbnails) { $thumb_html=""; } } elseif(!strstr($master_id,'/') && $duration <= 0) { duration_fix($master_id); } return $thumb_html; } function url_shorters_fix($video_link) { if(stristr($video_link,"://goo.gl/") || stristr($video_link,"://bit.ly/") || stristr($video_link,"://is.gd/") || stristr($video_link,"://bitly.com/") || stristr($video_link,"://urlcut.org/") || stristr($video_link,"://tinyurl.com/") || stristr($video_link,"://cort.as/") || stristr($video_link,"://ow.ly/") || stristr($video_link,"://hyperurl.co/") || stristr($video_link,"://ShortURL.de/") || stristr($video_link,"://bit.do/") || stristr($video_link,"://adf.ly/") || stristr($video_link,"://j.gs/") || stristr($video_link,"://q.gs/") || stristr($video_link,"://www.allanalpass.com/") || stristr($video_link,"://www.drstickyfingers.com/") || stristr($video_link,"://www.fapoff.com/") || stristr($video_link,"://www.freegaysitepass.com/") || stristr($video_link,"://www.galleries.bz/") || stristr($video_link,"://www.hornywood.tv/") || stristr($video_link,"://www.linkbabes.com/") || stristr($video_link,"://www.picbucks.com/") || stristr($video_link,"://www.poontown.net/") || stristr($video_link,"://www.tnabucks.com/") || stristr($video_link,"://www.youfap.me/") || stristr($video_link,"://www.rqq.co/") || stristr($video_link,"://www.zff.co/") || stristr($video_link,"://www.yye.io/") || stristr($video_link,"://www.lba.io/") || stristr($video_link,"://www.iskk.co/") || stristr($video_link,"://www.yyv.co/") || stristr($video_link,"://www.ekdd.co/") || stristr($video_link,"://www.erq.io/") || stristr($video_link,"://www.ooep.co/") || stristr($video_link,"://zo.ee/") || stristr($video_link,"://jmpz.in/") || stristr($video_link,"://blv.me/") || stristr($video_link,"://unloc.us/") || stristr($video_link,"://adurl.id/") || stristr($video_link,"://iwas.pw/") || stristr($video_link,"://ad24.us/") || stristr($video_link,"://akorto.eu/") || stristr($video_link,"://linclik.com/") || stristr($video_link,"://mskip.us/") || stristr($video_link,"://50tl.net/") || stristr($video_link,"://ref.so/") || stristr($video_link,"://adfe.es/") || stristr($video_link,"://www.tec.so/") || stristr($video_link,"://x18.eu/") || stristr($video_link,"://sht.st/") || stristr($video_link,"://url.ie/") || stristr($video_link,"://urlskip.co/") || stristr($video_link,"://elink.link/") || stristr($video_link,"://get.al/") || stristr($video_link,"://el32.com/") || stristr($video_link,"://privatelink.de/") || stristr($video_link,"://glurl.co/") || stristr($video_link,"://so.gd/") || stristr($video_link,"://so.") || stristr($video_link,"//tiny.cc/") || stristr($video_link,"//cutt.ly/") ) { $redirect=get_redirect_url($video_link); if($redirect) $video_link = $redirect; } return $video_link; } function duration_fix($master_id) { // $scraper = get_rand_selenium_server(1); $myurl = "$scraper/user/duration_fixer.php?master_id=$master_id&apc_label=$apc_label"; $shell_results= exec("wget -O /dev/null \"$myurl\" > /dev/null 2>&1 &",$results,$status); } function get_upload_server($flv_download=NULL,$type_id=NULL) { //mrg //global $mysql_link_master; global $mysql_link_slave; global $mysql_link_slave2; global $mysql_link_slave2; $cloud_servers=array(); if(substr($flv_download,0,6) == "server") { $start = explode("server",$flv_download); $end = explode(".mp4",end($start),2); $m_key= $end[0]; $query="select count(v.id) cnt from myvidster_vbackup v where v.completed IN (2) and server = 'server$m_key'"; $result2 = mysql_query($query,$mysql_link_slave2); $row2 = mysql_fetch_array($result2); $cnt2 = $balancer + $row2['cnt']; if($cnt2 <= 6) { $sql="select id from myvidster_vars where m_name = 'c_server_load' and m_value != 69 and m_key='$m_key'"; $var_result = mysql_query($sql,$mysql_link_slave2); if($var_row = mysql_fetch_assoc($var_result)) { $rr_server = "server".$m_key; } } } if(!$rr_server) { $sql="select m_key, m_value from myvidster_vars where m_name = 'c_server_load' and m_value != 69 order by rand()"; $var_result = mysql_query($sql,$mysql_link_slave2); while($var_row = mysql_fetch_assoc($var_result)) { $server = "server".$var_row['m_key']; $balancer = $var_row['m_value']; $query="select count(v.id) cnt from myvidster_vbackup v where v.completed IN (2) and server = '$server'"; $result1 = mysql_query($query,$mysql_link_slave2); $row1 = mysql_fetch_array($result1); $cnt = $balancer + $row1['cnt']; $cloud_servers[$server]=$cnt; } $min_cnt = min($cloud_servers); $rr_server = array_search($min_cnt,$cloud_servers,true); } return $rr_server; } function s3_tmb_upload($source_file,$key,$s3_img) { $image_bucket = 'myvidster-images2'; //myvidster-images2 is cdn2.myvidster.com if(file_exists($source_file)) { //authenticated-read OR public-read try { $acl = 'public-read'; $bucket = $image_bucket; $s3_img->upload($bucket, $key, fopen($source_file, 'r'), $acl); } catch (S3Exception $e) { $msg = $e->getMessage(); //send_mail("marques@myvidster.com","no-reply@myvidster.com","S3 Video - $id",$msg); } } } function tmb_loader($source_file) { if($source_file == 'https://www.myvidster.com/user/images/film.jpg') $tmb="https://www.myvidster.com/user/images/film.jpg"; elseif(substr($source_file,0,6) == 'images') $tmb="https://cdn2.myvidster.com/user/$source_file"; elseif(substr($source_file,0,11) == 'user/thumbs') $tmb="https://cdn2.myvidster.com/$source_file"; elseif(substr($source_file,0,7) == '/images') $tmb="https://cdn2.myvidster.com$source_file"; elseif(substr($source_file,0,4) != 'http') $tmb="https://cdn2.myvidster.com/$source_file"; else $tmb=$source_file; return $tmb; } function tmb_cloud_loader($source_file) { //currently only used for download thumbs if(!strstr($source_file,'videothumbs/')) { $legacy_folder = explode("myvidster.com/",$source_file); $legacy_folder = $legacy_folder[1]; $tmb="https://cdn2.myvidster.com/$legacy_folder"; } elseif(substr($source_file,0,11) == 'videothumbs') { $tmb="https://cdn2.myvidster.com/$source_file"; } else { $tmb=$source_file; } return $tmb; } function fix_ios_trans($keep_id,$user_id) { global $mysql_link_slave; if(!$keep_id) return false; $sql="select id,transactionId,product_id from myvidster_ios_receipts where user_id = $user_id and status = 1 and id <> $keep_id"; $result2 = mysql_query($sql,$mysql_link_slave); while($row2 = mysql_fetch_array($result2)) { $drop_id=$row2['id']; $transactionId=$row2['transactionId']; $product_id=$row2['product_id']; switch ($product_id) { case "silver.product4": $storage = 131072 * 2; $myv_item = 'myv_pro_silver2'; $x_amount = '9.99'; $tier = 1; break; case "gold.product5": $storage = 131072 * 2 * 2; $myv_item = 'myv_pro_gold2'; $x_amount = '14.99'; $tier = 2; break; case "platinum.product6": $storage = 131072 * 2 * 2 * 2; $myv_item = 'myv_pro_plat2'; $x_amount = '17.99'; $tier = 3; break; default: $storage = 0; } $sql="update myvidster_user set v_quota=v_quota-$storage where id='$user_id'"; mysql_query($sql); $sql="update myvidster_pro set status=0 where x_trans_id = '$transactionId' and x_cust_id = '$user_id' and status = 1 order by id asc limit 1"; mysql_query($sql); $sql="update myvidster_ios_receipts set status=0 where id = $drop_id"; mysql_query($sql); return true; } } function change_dns($server,$cf_api,$name) { $headers = array( 'X-Auth-Email: marques@myvidster.com', 'X-Auth-Key: ffb1dc4e4ffb864573f2dcd2b2c7c5d162584', 'Content-Type: application/json' ); $data = array("type" => "CNAME", "name" => "$name.myvidster.com", "content" => "$server.myvidster.com", "ttl" => 1, "proxied" => true ); $data_json = json_encode($data); $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $cf_api); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt ($ch, CURLOPT_TIMEOUT, 60); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "PUT"); curl_setopt ($ch, CURLOPT_POSTFIELDS,$data_json); $reponse = curl_exec ($ch); curl_close($ch); $json = json_decode($reponse); return $json; } function setMemoryForImage( $filename ){ $imageInfo = getimagesize($filename); $MB = 1048576; // number of bytes in 1M $K64 = 65536; // number of bytes in 64K $TWEAKFACTOR = 1.5; // Or whatever works for you $memoryNeeded = round( ( $imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $imageInfo['channels'] / 8 + $K64 ) * $TWEAKFACTOR ); $memoryLimit = 42 * $MB; if (function_exists('memory_get_usage') && memory_get_usage() + $memoryNeeded > $memoryLimit) { $newLimit = $memoryLimitMB + ceil( ( memory_get_usage() + $memoryNeeded - $memoryLimit ) / $MB ); return true; }else { return false; } } function display_qr_code($url) { $allow = ['gif', 'jpg', 'png']; // allowed extensions $curl = curl_init($url); curl_setopt($curl, CURLOPT_PORT, 2222); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 2222); $img = curl_exec($curl); $url_info = pathinfo($url); // if allowed extension if(in_array($url_info['extension'], $allow)) { // Format the image SRC: data:{mime};base64,{img_data_base64}; $src = 'data:image/'. $url_info['extension'] .';base64,'. base64_encode($img); // add the base64 image into a to display it $re = ''. $url_info['basename'] .''; } else $re = 'Invalid extension: '. $url_info['extension']; return $re; // output $re data } function create_btc_payment($x_cust_id,$myv_item,$crypto='BTC',$myv_type='new',$myv_type_id=0,$myv_ref) { global $mysql_link_slave; global $user_id; $today = getdate(); $day=$today['mday']; $btc_server="serverbtc.myvidster.com"; $aro_server="server14.myvidster.com"; if($x_cust_id != $user_id) { $gift="

"._("You are giving a PRO membership to another user ")."

"; } else { $gift=""; } if($crypto == 'BTC') $crypto_name = 'Bitcoin ($BTC)'; else $crypto_name = 'Arionum ($ARO)'; $callback_url=urlencode("https://www.myvidster.com/crypto_processor.php?notify=1&crypto=$crypto"); if($myv_item=='myv_pro_silver2') { $x_amount=9.99; } elseif($myv_item=='myv_pro_gold2') { $x_amount=15.99; } elseif($myv_item=='myv_pro_plat2') { $x_amount=17.99; } $x_trans_id=md5($x_cust_id.$myv_item.$day.$crypto); if($crypto == 'BTC') $btc_pay = "http://$btc_server/request_payment/$x_amount/USD/$myv_item/myvidster/$x_cust_id/$callback_url"; else $btc_pay = "http://$aro_server/?action=request_payment&amount=$x_amount¤cy=USD&message=$x_cust_id:$myv_item&callback_url=$callback_url"; $sql="select id, btc_amount,btc_address,qr_code,pay from myvidster_btc where x_trans_id = '$x_trans_id' and status = 1"; $results = mysql_query($sql,$mysql_link_slave); $row = mysql_fetch_array($results); $crypto_id = $row['id']; $pay = $row['pay']; if(!$crypto_id) { $curl = curl_init($btc_pay); curl_setopt($curl, CURLOPT_PORT, 2222); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 2222); $config_xml = curl_exec($curl); if($crypto == 'BTC') { $config_xml=str_replace("localhost",$btc_server,$config_xml); } $pay_load = json_decode($config_xml); if($crypto == 'BTC') { //get redirect only works in production? $qr_code = "http://$btc_server:2222".get_redirect_url($pay_load->qr); $pay_load->qr = "http://$btc_server:2222".get_redirect_url($pay_load->qr); } else $qr_code = $pay_load->qr; $btc_address = $pay_load->address; if($crypto == 'BTC') { $start = explode("amount=",$pay_load->link); $end = explode("&",end($start),2); $btc_amount = $end[0]; $pay_load->amount = $btc_amount; } else $btc_amount = $pay_load->aro_amount; $sql="insert into myvidster_btc (x_trans_id,x_cust_id,btc_amount,x_amount,btc_address,qr_code,myv_item,crypto,myv_type,myv_type_id,myv_ref) values('$x_trans_id',$x_cust_id,$btc_amount,$x_amount,'$btc_address', '$qr_code','$myv_item','$crypto','$myv_type',$myv_type_id,'$myv_ref')"; mysql_query($sql); } else { $btc_amount = $row['btc_amount']; $btc_address = $row['btc_address']; $qr_code = $row['qr_code']; if($myv_ref=='app_btc') { $pay_load->amount = $btc_amount; $pay_load->address = $btc_address; $pay_load->qr = $qr_code; } } $msg='
'; if(!$pay) { $qr_img = display_qr_code($qr_code); $msg.= "$gift $qr_img
"; $msg.="Send $btc_amount $crypto_name to
$btc_address
"; $msg.="
After we have received your payment, your membership will be activated!
Please allow up to an hour for the payment transaction to be completed and confirm."; $msg.=''; } else { $msg.="Your $crypto_name payment has been received and process, contact us if you are
having issues accessing your PRO membership. Internal trans id: $x_trans_id"; } $msg.='
Done   Cancel
'; if($myv_ref=='app_btc') { $callback = $pay_load; } else { $callback = $msg; } return $callback; } function ip_hacker_check($ip,$email_check="") { //echo ip_hacker_check('101.188.67.134'); global $mysql_link_master; $ip=sanitize_sql_string($ip); $email_check=sanitize_sql_string($email_check); $api_key='qery8uvejyhu'; $method='spam_check'; $message=true; if($email_check) { $email_check=sanitize_sql_string($email_check); $api_url_email="&email=$email_check"; } else { $api_url_email=""; } if($ip) { $api_url="https://api.cleantalk.org/?method_name=spam_check&auth_key=$api_key&ip=$ip".$api_url_email; $config_xml = file_get_contents($api_url); $tmp_json = json_decode($config_xml); $spam_rate = sanitize_sql_string($tmp_json->data->$ip->spam_rate); $frequency = sanitize_sql_string($tmp_json->data->$ip->frequency); $submitted = sanitize_sql_string($tmp_json->data->$ip->submitted); $updated = sanitize_sql_string($tmp_json->data->$ip->updated); $reported = $ip; if(!$spam_rate && $email_check) { $spam_rate = sanitize_sql_string($tmp_json->data->$email_check->spam_rate); $frequency = sanitize_sql_string($tmp_json->data->$email_check->frequency); $submitted = sanitize_sql_string($tmp_json->data->$email_check->submitted); $updated = sanitize_sql_string($tmp_json->data->$email_check->updated); $reported = $email_check; } $message ="$reported reported as spam $frequency websites attacked, discovered $submitted, last activity $updated"; if($spam_rate) { $sql="insert into myvidster_hacker (ip,message,email) values('$ip','$message','$email_check')"; mysql_query($sql,$mysql_link_master); } else { $message=false; } } return $message; } function video_remove($master_id,$wait=4,$chunks=10) { global $mysql_link_slave; return true; $sql="select id from myvidster_video where master_id = '$master_id' and private <> 3 and broken = 0"; $result1 = mysql_query($sql,$mysql_link_slave); $ids = array(); while($row1 = mysql_fetch_assoc($result1)) { $ids[] = $row1['id']; } $i = count($ids); $m_v_ids = array_chunk($ids, $chunks); foreach($m_v_ids as $m_v_id) { $v_ids=implode(",",$m_v_id); $sql="UPDATE myvidster_video SET private=1,broken=1 where id IN ($v_ids)"; mysql_query($sql); do { $query="SHOW SLAVE STATUS"; $l_result = mysql_query($query,$mysql_link_slave); $l_row = mysql_fetch_array($l_result); $lag = $l_row['Seconds_Behind_Master']; if($lag > 2) { sleep($wait); } } while ($lag > 2); } foreach($ids as $id) { delete_index_doc($id,false); insert_index_doc($id,false); $index_output[]=$id; } $index_ids = implode(",",$index_output); $sql="update myvidster_flag set resolved=1 where master_id = '$master_id'"; mysql_query($sql); } function is_cached($channel_id,$type_id,$master_id=NULL) { global $mysql_link_slave; global $mysql_link_slave; $sql = "select id from myvidster_sponsored where channel_id = $channel_id and status = 1 and cached = 1"; $u_result = mysql_query($sql,$mysql_link_slave); $u_row1 = mysql_fetch_assoc($u_result); if($u_row1['id']) { $cached = 1; } elseif(stristr($type_id,'.tumblr.com') || stristr($type_id,'//streaminporn.xyz/') || stristr($type_id,'//media1.faptube.xyz/') || stristr($type_id,'//videos.freegaypornonline.com/')) { $cached = 1; } else { $cached = 0; } return $cached; } function is_cloud_hosting($type_id) { global $mysql_link_slave; global $mysql_link_slave2; global $mysql_link_slave2; $video_host = get_video_host($type_id); if(function_exists('mysql_query')) { $sql = "select id from myvidster_vars where m_name = 'ad_removal' and m_value = '$video_host' and m_key = 1"; $result1 = @mysql_query($sql,$mysql_link_slave2); if($result1) { $row1 = mysql_fetch_array($result1); $ad_removal = $row1['id']; } else { $ad_removal = 0; } } if($ad_removal > 0) { return true; } else { return false; } } function load_videojs_scripts() { global $user_id; global $glb_videojs_ver; $browser = get_user_browser(); if($browser != 'firefox') { $pip_js = ''; $pip_css = ''; } else { $pip_js = ''; $pip_css = ''; } $videojs_scripts = ' '.$pip_css.' '.$pip_js.' '; return $videojs_scripts; } function give_pro($user_id, $upgrade_type,$x_trans_id='givepro') { if(!$user_id){ echo "Can't give someone who doesn't exist a pro trial!"; exit; } switch ($upgrade_type){ case 'Give PRO Silver': case 'MyVidster PRO (Silver) for 1 month.': $upgrade_text = 'myv_pro_silver2'; $upgrade_ref = 'Admin_silver_gift'; $upgrade_v_quota_new = 131072 * 2; break; case 'Give PRO Gold': case 'MyVidster PRO (Gold) for 1 month.': $upgrade_text = 'myv_pro_gold2'; $upgrade_ref = 'Admin_gold_gift'; $upgrade_v_quota_new = 131072 * 2* 2; break; case 'Give PRO Platinum': case 'MyVidster PRO (Platinum) for 1 month.': $upgrade_text = 'myv_pro_plat2'; $upgrade_ref = 'Admin_plat_gift'; $upgrade_v_quota_new = 131072 * 2 * 2 * 2; break; default: echo "wtf v3"; } $expire_date=time() + (31 * 24 * 60 * 60);//Calculates current time in seconds plus 31 days $expire_date=date('Y-m-d H:i:s',$expire_date);//Converts expire_date to the format you want using capital and lowercase letters that correspond to PHP documentation $query="insert into myvidster_pro (x_cust_id,myv_item,myv_ref,expire_date,x_trans_id) values ($user_id,'$upgrade_text','$upgrade_ref','$expire_date','$x_trans_id')"; mysql_query($query); $query2="update myvidster_user set v_quota=$upgrade_v_quota_new where id=$user_id"; mysql_query($query2); $results = "$query
$query2
"; return $results; } function fetch_download_server($type_id,$flv_download) { $download_server4='http://download.myvidster.com/download'; //server4 $download_server2='http://server2.myvidster.com/download'; //server2 $download_server11='https://www.myvidster.com/download'; //server11 return $download_server11; if(strstr($type_id,'peekvids.com') || strstr($type_id,'eporner.com') || strstr($type_id,'feedvid.com') || strstr($type_id,'indianpornvideos.com') || strstr($type_id,'hclips.com') || strstr($type_id,'//verystream.com/') || strstr($type_id,'//menhdv.com/embed/') || strstr($flv_download,'gaysexo.org') || strstr($flv_download,'//www.youtube.com/get_video') ) { $download_server = $download_server2; } elseif(strstr($flv_download,'server2.mp4')) { $download_server = $download_server2; } elseif(strstr($flv_download,'/get_file/') || strstr($flv_download,'server11.mp4') || strstr($flv_download,'wegayboys.com') || strstr($flv_download,'gayforit.eu') ) { $download_server = $download_server11; } else { $servers[] = $download_server4; $servers[] = $download_server2; $servers[] = $download_server11; $rand=array_rand($servers); $download_server=$servers[$rand]; } return $download_server; } function myv_import($id,$master_id) { global $mysql_link_slave; global $mysql_link_slave; global $mysql_link_master; $sql="select id from myvidster_download where master_id = '$master_id' and status = 1 and filepath like 'http://videos.myvidster.com/%' limit 1"; $result1 = mysql_query($sql,$mysql_link_slave); $row1 = mysql_fetch_assoc($result1); $dl_id = $row1['id']; $type_id ="https://www.myvidster.com/embed/$dl_id"; if($dl_id) { $sql="update myvidster_video set type=92, type_id='$type_id' where id = $id"; mysql_query($sql,$mysql_link_master); } } function get_myv_mp4($id) { global $mysql_link_slave; global $mysqli_link_slave; $start = explode('/',$id); $dl_id = end($start); $sql="select d.filepath, d.thumbnail, v.private, v.cc_owner, v.access_lock, v.user_id from myvidster_download d join myvidster_video v ON v.id = d.video_id where d.id = '$dl_id' and d.status = 1 and d.filepath like 'http://videos.myvidster.com/%' limit 1"; if($mysql_link_slave) { $result = mysql_query($sql,$mysql_link_slave); $row = mysql_fetch_array( $result ); } else { $result = $mysqli_link_slave->query($sql); $row = $result->fetch_assoc(); } $filepath = $row['filepath']; if($filepath) return get_s3_dll($filepath,'&',false); else return 'broken.mp4'; } function get_video_host($type_id) { $arr_domain=parse_url($type_id); $host = $arr_domain['host']; return $host; } function get_token($id) { $salt="Am6ctD#rw5d$"; $token=md5($id.$salt); return $token; } function get_api_key($id) { $salt="XxtQ$8isE2vHw1"; $key=md5($id.$salt); return $key; } function get_rand_selenium_server($m_key=1,$name=false) { //note, ok let do this global $mysql_link_slave; $sql = "select m_value from myvidster_vars where m_name = 'scraper' and m_key IN($m_key) and status = 1"; if(function_exists('mysql_query')) { $result = mysql_query($sql,$mysql_link_slave); while($row = mysql_fetch_assoc($result)) { $servers[] = $row['m_value']; } } if($servers) { $rand=array_rand($servers); $server=$servers[$rand]; if($name) { $x = str_replace('http://','',$server); $server = explode('.',$x)[0]; } } else { $server = false; } return $server; } function get_rand_selenium_server_legacy($m_key=1,$name=false) { //note, do not use cloudflare proxied fucks w APC global $mysqli_link_slave2; global $mysqli_link_slave3; global $mysql_link_slave; global $mysqli_link_slave3; $sql = "select m_value from myvidster_vars where m_name = 'scraper' and m_key IN($m_key) and status = 1"; if(function_exists('mysql_query') && $mysql_link_slave2) { $result = mysql_query($sql,$mysql_link_slave); while($row = mysql_fetch_assoc($result)) { $servers[] = $row['m_value']; } } else { $result = $mysqli_link_slave3->query($sql); while($row = $result->fetch_assoc()) { $servers[] = $row['m_value']; } } if($servers) { $rand=array_rand($servers); $server=$servers[$rand]; if($name) { $x = str_replace('http://','',$server); $server = explode('.',$x)[0]; } } else { $server = false; } return $server; } function url_sanitizer($url) { $url = filter_var($url, FILTER_SANITIZE_URL); $url_check = get_video_host($url); if (!filter_var($url, FILTER_VALIDATE_URL) || !strstr($url_check,'myvidster.com')) { return false; } else { return $url; } } function json_vid_fixer($pre_json) { $pre_json = str_replace('file:','"file":',$pre_json); $pre_json = str_replace('label:','"label":',$pre_json); $pre_json = str_replace('default:','"default":',$pre_json); return $pre_json; } function string_extact_end($str1,$str2,$data) { $start = explode($str1,$data); $end = explode($str2,end($start)); return end($end); } function string_extact($str1,$str2,$data) { $start = iExplode($str1,$data,2); $end = iExplode($str2,$start[1],2); return $end[0]; } function loop_vid($type_id,$base_link) { global $mysql_link_slave; $duration = 0; $duration_master=""; if(strstr($type_id,'//d1sdac3zefu2ho.cloudfront.net/')) { $duration_master = string_extact('//d1sdac3zefu2ho.cloudfront.net/','.',$type_id); }elseif(strstr($type_id,'//myvidster-cloud.s3.amazonaws.com/')) { $duration_master = string_extact('//myvidster-cloud.s3.amazonaws.com/','.',$type_id); } if($duration_master) { $sql="SELECT duration FROM `myvidster_duration` WHERE `master_id` LIKE '$duration_master'"; $result1 = mysql_query($sql,$mysql_link_slave); $row1 = mysql_fetch_array($result1); $duration = $row1['duration']; } if(strstr($base_link,'.tumblr.com') || strstr($type_id,'.gfycat.com') || strstr($type_id,'slushe.com/videos') || strstr($type_id,'motherlessmedia.com') || (strstr($type_id,'.mp4') && !$duration) || ($duration && $duration < 600) ) $loop = 'loop'; else $loop = ''; return $loop; } function selenium_check($server,$url) { $url = $server."/selenium_chrome.php?token=badkitty&sleep=0d&url=".urlencode($url); $curlHandle = curl_init(); curl_setopt($curlHandle, CURLOPT_URL, $url); curl_setopt($curlHandle, CURLOPT_HEADER, true); curl_setopt($curlHandle, CURLOPT_NOBODY, true); // we don't need body curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true); curl_setopt($curlHandle, CURLOPT_CONNECTTIMEOUT, 20); curl_setopt($curlHandle, CURLOPT_TIMEOUT,20); //timeout in seconds curl_exec($curlHandle); $httpcode = curl_getinfo($curlHandle, CURLINFO_HTTP_CODE); $total_time = curl_getinfo($curlHandle, CURLINFO_TOTAL_TIME); curl_close($curlHandle); // Don't forget to close the connection $payload="http_code: $httpcode | total_time: $total_time"; if($httpcode <> 200) { return false; } return $payload; } function dl_blacklist($type_id) { global $mysql_link_slave; global $mysqli_link_slave; global $mysql_link_slave2; global $mysqli_link_slave3; if($type_id) { $sql = "select m_value from myvidster_vars where m_name = 'dl_blacklist' and m_key = 1"; if(function_exists('mysql_query') && $mysql_link_slave2) { $result = mysql_query($sql,$mysql_link_slave2); while($row = mysql_fetch_array($result)) { $vid=$row['m_value']; if(strstr($type_id,$vid)) { return true; } } } elseif(function_exists('mysqli_query') && $mysqli_link_slave3) { $result = $mysqli_link_slave3->query($sql) or die($mysqli_link_slave3->error); while($row = $result->fetch_assoc()) { $vid=$row['m_value']; if(strstr($type_id,$vid)) { return true; } } } } return false; } function resub($email) { $url = 'https://api.sendgrid.com/api/unsubscribes.delete.json'; $fields = array( 'email' => $email, 'api_user' => 'myvidster', 'api_key' => 'bppq296t', ); //url-ify the data for the POST foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string, '&'); //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_POST, count($fields)); curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string); //execute post $result = curl_exec($ch); //close connection curl_close($ch); return $result; } function load_js_scripts() { global $glb_js_ver; //$cb=127; $output=""; $js_files[]='/js/jquery-1.12.4.js'; $js_files[]='/js/jquery-migrate-1.4.1.js'; $js_files[]='/js/jquery-ui.min.js'; $js_files[]='/js/jquery.address-1.5.min.js'; $js_files[]='/js/myv_address.js'; $js_files[]='/js/jquery.qtip-1.0.0-rc3.min.js'; $js_files[]='/js/loadingoverlay.min.js'; $js_files[]='/js/vidster.js'; //$js_files[]='/js/core_engine.js'; $js_files[]='/js/smartbanner/jquery.smartbanner.js'; foreach($js_files as $js_file) { $output .= "\n"; } $output .= ''; //needs CB for auto refresh return $output; } function load_css_scripts() { global $glb_css_ver; $output=""; $css_files[]='/css/style.css?type=css'; $css_files[]='/css/redmond/jquery-ui-1.8.22.custom.css?type=css'; $css_files[]='/css/smartbanner/jquery.smartbanner.css?type=css'; //$css_files[]='/arrowchat/external.php?type=css'; foreach($css_files as $css_file) { $output .= "\n"; } return $output; } function is_mobile($ua) { if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$ua)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',substr($ua,0,4))) { return true; } else { return false; } } function sendgrid_suppressions($email) { $api="https://api.sendgrid.com/v3/asm/suppressions/global/$email"; $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $api); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt ($ch, CURLOPT_TIMEOUT, 30); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Authorization: Bearer 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' )); $reponse = curl_exec ($ch); curl_close($ch); $json = json_decode($reponse, true); return $json; } function sendgrid_resub($email) { $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.sendgrid.com/v3/asm/suppressions/global/$email", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "DELETE", CURLOPT_POSTFIELDS => "{}", CURLOPT_HTTPHEADER => array( "authorization: Bearer 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" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } } function sanitize_url_check($url) { if(!$url) { return false; } // Remove all illegal characters from a url $url = filter_var($url, FILTER_SANITIZE_URL); // php FILTER_VALIDATE_URL is fucking broken, thanks! if(substr($url,0,4) != 'http') { return false; } if(!filter_var($url, FILTER_VALIDATE_URL)) { return false; } return true; } function is_admin($user_id) { global $mysql_link_slave2; $results = false; if($user_id) { $sql="SELECT m_value FROM `myvidster_vars` WHERE `m_name` = 'admin' and m_value = '$user_id' and m_key=1"; $result = @mysql_query($sql,$mysql_link_slave2); $row = @mysql_fetch_array($result); $m_value = $row['m_value']; if($m_value) $results = true; } return $results; } function is_php_server($ip) { global $mysql_link_slave2; $sql="SELECT id FROM `myvidster_vars` WHERE `m_name` = 'php_server' and m_value = '$ip' and m_key=1"; $result = mysql_query($sql,$mysql_link_slave2); $row = mysql_fetch_array($result); $id = $row['id']; if($id) $is_php_server = true; else $is_php_server = false; return $is_php_server; } function pornhub_api($video_id) { $result = get_web_page($video_id,true); $ph_content = $result['content']; $ph_thumb = string_extact('thumbnailUrl": "','"',$ph_content); return $ph_thumb; } function unparse_url($parsed_url) { $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : ''; $host = isset($parsed_url['host']) ? $parsed_url['host'] : ''; $port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : ''; $user = isset($parsed_url['user']) ? $parsed_url['user'] : ''; $pass = isset($parsed_url['pass']) ? ':' . $parsed_url['pass'] : ''; $pass = ($user || $pass) ? "$pass@" : ''; $path = isset($parsed_url['path']) ? $parsed_url['path'] : ''; $query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : ''; $fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : ''; return "$scheme$user$pass$host$port$path$query$fragment"; } function is_valid_domain($url){ $validation = FALSE; /*Parse URL*/ $urlparts = parse_url(filter_var($url, FILTER_SANITIZE_URL)); /*Check host exist else path assign to host*/ if(!isset($urlparts['host'])){ $urlparts['host'] = $urlparts['path']; } if($urlparts['host']!=''){ /*Add scheme if not found*/ if (!isset($urlparts['scheme'])){ $urlparts['scheme'] = 'http'; } /*Validation*/ if(checkdnsrr($urlparts['host'], 'A') && in_array($urlparts['scheme'],array('http','https')) && ip2long($urlparts['host']) === FALSE){ $urlparts['host'] = preg_replace('/^www\./', '', $urlparts['host']); $url = $urlparts['scheme'].'://'.$urlparts['host']. "/"; if (filter_var($url, FILTER_VALIDATE_URL) !== false && @get_headers($url)) { $validation = TRUE; } } } if(!$validation){ return true; }else{ return false; } } function is_working_url($url) { $handle = curl_init($url); curl_setopt($handle, CURLOPT_RETURNTRANSFER, true); curl_setopt($handle, CURLOPT_NOBODY, true); curl_setopt($handle, CURLOPT_TIMEOUT, 20); curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, false); curl_exec($handle); $httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE); curl_close($handle); if ($httpCode >= 200 && $httpCode < 300) { return true; } else { return false; } } function getjpegsize($img_loc) { $handle = @fopen($img_loc, "rb") or die("Invalid file stream."); $new_block = NULL; if(!feof($handle)) { $new_block = fread($handle, 32); $i = 0; if($new_block[$i]=="\xFF" && $new_block[$i+1]=="\xD8" && $new_block[$i+2]=="\xFF" && $new_block[$i+3]=="\xE0") { $i += 4; if($new_block[$i+2]=="\x4A" && $new_block[$i+3]=="\x46" && $new_block[$i+4]=="\x49" && $new_block[$i+5]=="\x46" && $new_block[$i+6]=="\x00") { // Read block size and skip ahead to begin cycling through blocks in search of SOF marker $block_size = unpack("H*", $new_block[$i] . $new_block[$i+1]); $block_size = hexdec($block_size[1]); while(!feof($handle)) { $i += $block_size; $new_block .= fread($handle, $block_size); if($new_block[$i]=="\xFF") { // New block detected, check for SOF marker $sof_marker = array("\xC0", "\xC1", "\xC2", "\xC3", "\xC5", "\xC6", "\xC7", "\xC8", "\xC9", "\xCA", "\xCB", "\xCD", "\xCE", "\xCF"); if(in_array($new_block[$i+1], $sof_marker)) { // SOF marker detected. Width and height information is contained in bytes 4-7 after this byte. $size_data = $new_block[$i+2] . $new_block[$i+3] . $new_block[$i+4] . $new_block[$i+5] . $new_block[$i+6] . $new_block[$i+7] . $new_block[$i+8]; $unpacked = unpack("H*", $size_data); $unpacked = $unpacked[1]; $height = hexdec($unpacked[6] . $unpacked[7] . $unpacked[8] . $unpacked[9]); $width = hexdec($unpacked[10] . $unpacked[11] . $unpacked[12] . $unpacked[13]); return array($width, $height); } else { // Skip block marker and read block size $i += 2; $block_size = unpack("H*", $new_block[$i] . $new_block[$i+1]); $block_size = hexdec($block_size[1]); } } else { return FALSE; } } } } } return FALSE; } ?>