Restrict users viewing

Here is a mod to allow you to set which of your users can view certain videos

1st add the following fields to your database(make backup 1st)
member_profile

Name - restricted_allowed
type - int
length - 1
default - 0

videos

Name - restricted
type - int
length - 1
default - 0

now open up play.php
below

include_once(‘classes/permissions.php’);

add

// restrict code
$r_vid = (int) mysql_real_escape_string($_GET['vid']);
$sql = "SELECT * FROM videos WHERE indexer = $r_vid AND approved ='yes'";
$query = @mysql_query($sql);
$result = @mysql_fetch_array($query);
$restricted = $result['restricted'];
echo "Hey - " . $restricted . "";
if ($restricted == 1){
$r_user_id = $_SESSION['user_id'];
$sql = "SELECT * FROM member_profile WHERE user_id = $r_user_id";
$query = @mysql_query($sql);
$result = @mysql_fetch_array($query);
$restricted_allowed = $result['restricted _allowed'];
echo "Hey - " . $restricted_allowed. "";
echo "Hey - " . $r_user_id. "";
if ($restricted_allowed ==1) {
$proceed = true;
}else{
$proceed = false;
	$error_height = '430px;';
	$message_2 = 'Sorry Not today - You are not allowed to view this clip' ;

	$codes = $codes_internal;
	$error_code = errorcodes($codes);

	// tmp test
	if ( $error_height ==  '' ) {
		if (!empty($error_code)) {
			$blk_notification = $error_code['error_display'];
    			$message_type = $error_code['error_type'];
    			$error_message = $error_code['error_message'];
		}
	}

	$template 		= "themes/$user_theme/templates/main_1.htm";
	$inner_template1 	= "themes/$user_theme/templates/inner_notification.htm";

	$TBS 			= new clsTinyButStrong;
	$TBS->NoErr 	= true;
	$TBS->LoadTemplate("$template");

	$TBS->Render 	= TBS_OUTPUT;
	$TBS->Show();

	@mysql_close();
	die();
}
}

Leave a Reply

Listed on BlogShares