user_exists && !$setting['setting_permission_video'] )
{
$page = "error";
$smarty->assign('error_header', 639);
$smarty->assign('error_message', 656);
$smarty->assign('error_submit', 641);
include "footer.php";
}
// DISPLAY ERROR FOR MEMBERS WITH INSUFFICIENT USER LEVEL
if ($user->user_info['user_level_id'] != 2&&$user->user_info['user_level_id'] != 7) :
header("Location: /premium.php?premiumonly=1");
exit;
endif;
function chaturbatead()
{
$url="https://chaturbate.com/api/public/affiliates/onlinerooms/?wm=jFpVD&client_ip=request_ip&gender=m&tag=bateworld&num_users=1";
$ch = curl_init();
// Set URL to download
curl_setopt($ch, CURLOPT_URL, $url);
// Include header in result? (0 = yes, 1 = no)
curl_setopt($ch, CURLOPT_HEADER, 0);
// Should cURL return or print out the data? (true = return, false = print)
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Timeout in seconds
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
// Download the given URL, and return output
$output = curl_exec($ch);
// Close the cURL resource, and free system resources
curl_close($ch);
$j=json_decode($output);
if($j->count==0){
$url="https://chaturbate.com/api/public/affiliates/onlinerooms/?wm=jFpVD&client_ip=request_ip&gender=m&num_users=1";
$ch = curl_init();
// Set URL to download
curl_setopt($ch, CURLOPT_URL, $url);
// Include header in result? (0 = yes, 1 = no)
curl_setopt($ch, CURLOPT_HEADER, 0);
// Should cURL return or print out the data? (true = return, false = print)
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Timeout in seconds
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
// Download the given URL, and return output
$output = curl_exec($ch);
// Close the cURL resource, and free system resources
curl_close($ch);
$j=json_decode($output);
}
/* ?>


*/?>
count==0){
$url="https://chaturbate.com/api/public/affiliates/onlinerooms/?wm=jFpVD&client_ip=request_ip&gender=m&num_users=1";
$ch = curl_init();
// Set URL to download
curl_setopt($ch, CURLOPT_URL, $url);
// Include header in result? (0 = yes, 1 = no)
curl_setopt($ch, CURLOPT_HEADER, 0);
// Should cURL return or print out the data? (true = return, false = print)
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Timeout in seconds
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
// Download the given URL, and return output
$output = curl_exec($ch);
// Close the cURL resource, and free system resources
curl_close($ch);
$j=json_decode($output);
}
/* ?>


*/?>
user_info['user_id']}'
THEN TRUE
"./*WHEN ((se_videos.video_privacy & @SE_PRIVACY_REGISTERED) AND '{$user->user_exists}'<>0)
THEN TRUE
"./*WHEN ((se_videos.video_privacy & @SE_PRIVACY_ANONYMOUS) AND '{$user->user_exists}'=0)
THEN TRUE*/
"
WHEN ((se_videos.video_privacy & @SE_PRIVACY_FRIEND) AND (SELECT TRUE FROM se_friends WHERE friend_user_id1=se_videos.video_user_id AND friend_user_id2='{$user->user_info['user_id']}' AND friend_status='1' LIMIT 1))
THEN TRUE
"./*WHEN ((se_videos.video_privacy & @SE_PRIVACY_SUBNET) AND '{$user->user_exists}'<>0 AND (SELECT TRUE FROM se_users WHERE user_id=se_videos.video_user_id AND user_subnet_id='{$user->user_info['user_subnet_id']}' LIMIT 1))
THEN TRUE*/"
WHEN ((se_videos.video_privacy & @SE_PRIVACY_FRIEND2))
THEN TRUE
ELSE FALSE
END)";
$where1 = "video_search='1' AND se_videos.video_is_converted='1' AND video_admin_approved='1' ";
// ONLY MY FRIENDS' VIDEOS
if($v == "1" && $user->user_exists) {
// SET WHERE CLAUSE
$where .= " AND (SELECT TRUE FROM se_friends WHERE friend_user_id1='{$user->user_info['user_id']}' AND friend_user_id2=se_videos.video_user_id AND friend_status=1)";
}
// CREATE VIDEO OBJECT
$video = new se_video();
// GET TOTAL VIDEOS
$total_videos = $video->video_total($where);
// MAKE ENTRY PAGES
$videos_per_page = 14;
$chaturbatead=rand(0, $videos_per_page);
$page_vars = make_page($total_videos, $videos_per_page, $p);
if($v==3){
$video_array = $video->randomvideos($where1);
$video_array=array_slice($video_array, 0, $videos_per_page);
}
//var_dump($signup_array); exit;
// GET VIDEO ARRAY
if($v==0||$v==1){
$video_array = $video->video_list_all($page_vars[0], $videos_per_page, $s, $where, 1);
}
for($x=$page_vars[1]; $x<=$page_vars[2]; $x++)
{
if(($page_vars[1]+4)==$x)
{break;}
$for[$y]=$x;
$y++;
}
$smarty->assign('chaturbatead', $chaturbatead);
$smarty->assign('ip', $_SERVER['REMOTE_ADDR']);
$smarty->assign('for', $for);
$smarty->assign_by_ref('signups', $signup_array);
// ASSIGN SMARTY VARIABLES AND DISPLAY VIDEOS PAGE
$smarty->assign('videos', $video_array);
$smarty->assign('total_videos', $total_videos);
$smarty->assign('p', $page_vars[1]);
$smarty->assign('maxpage', $page_vars[2]);
$smarty->assign('p_start', $page_vars[0]+1);
$smarty->assign('p_end', $page_vars[0]+count($video_array));
$smarty->assign('s', $s);
$smarty->assign('v', $v);
include "footer.php";
?>