Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 

News:



Author Topic: limit video upload  (Read 1421 times)

riolino

  • **
  • Posts: 87
    • View Profile
limit video upload
« on: May 28, 2012, 06:58:28 AM »
Hello, how can I limit the video uploaded daily? For example if today were uploaded 4 videos, set the variable $no_upload in upload.html to yes, i don't know how to access the number of the video uploaded in a day...

Thank you!

ZArvixe

  • Sr. Technical Operations Officer
  • *****
  • Posts: 1618
    • View Profile
Re: limit video upload
« Reply #1 on: May 28, 2012, 07:52:01 AM »
You should be able to view the uploaded videos and allow/disallow uploads from Admin section.
Zee Shan
Sr. Technical Operations Officer
zee.shan@arvixe.com
1-888-927-8493

riolino

  • **
  • Posts: 87
    • View Profile
Re: limit video upload
« Reply #2 on: May 28, 2012, 09:01:20 AM »
You should be able to view the uploaded videos and allow/disallow uploads from Admin section.
I know that I mean count the video uploaded in a day and if they are more than 4 disallow other uploads until the next day...

juapo2

  • Community Liaison
  • *****
  • Posts: 1007
  • Clip-Bucket Community Liaison for Arvixe. PHP Dev.
    • View Profile
    • Juapo2Services
Re: limit video upload
« Reply #3 on: May 28, 2012, 12:42:58 PM »
Hello,

I have created the code for you.

1. Open upload.php, located in ./*

2. Look for:
Code: [Select]
if(has_access('allow_video_upload',false,$verify_logged_user))
{

3. Under that line, copy-paste this code:
Code: [Select]
//Check if the upload limit has been exceeded
$currdate = date("Y-m-d"); //Get current date in format YYYY-DD-MM like in database
$q = "SELECT COUNT(*) FROM cb_video WHERE datecreated='{$currdate}'"; // Query to count videos with that date
$res = mysql_query($q);
$row = mysql_fetch_assoc($res);
//$row <- will contain the current number of videos upload with that date
//We will now check with an if statement if the limit has been exceeded.
if($row >= '4') { // if it HAS BEEN exceeded
    $userquery->logincheck('allow_video_upload',true);
        } else { //if NOT BEEN   

It will now look like this:
Code: [Select]
if(has_access('allow_video_upload',false,$verify_logged_user))
{

//Check if the upload limit has been exceeded
$currdate = date("Y-m-d"); //Get current date in format YYYY-DD-MM like in database
$q = "SELECT COUNT(*) FROM cb_video WHERE datecreated='{$currdate}'"; // Query to count videos with that date
$res = mysql_query($q);
$row = mysql_fetch_assoc($res);
//$row <- will contain the current number of videos upload with that date
//We will now check with an if statement if the limit has been exceeded.
if($row >= '4') { // if it HAS BEEN exceeded
    $userquery->logincheck('allow_video_upload',true);
        } else { //if NOT BEEN   
     
    $file_name = time().RandomString(5);
    assign('file_name',$file_name);

4. Now, you are missing an ending curly bracket of the if(). Add this code:
Code: [Select]
}//End our check BEFORE:
Code: [Select]
}else
{
    $userquery->logincheck('allow_video_upload',true);
}

So the complete code will not look like this:
Code: [Select]
//Check if the upload limit has been exceeded
$currdate = date("Y-m-d"); //Get current date in format YYYY-DD-MM like in database
$q = "SELECT COUNT(*) FROM cb_video WHERE datecreated='{$currdate}'"; // Query to count videos with that date
$res = mysql_query($q);
$row = mysql_fetch_assoc($res);
//$row <- will contain the current number of videos upload with that date
//We will now check with an if statement if the limit has been exceeded.
if($row >= '4') { // if it HAS BEEN exceeded
    $userquery->logincheck('allow_video_upload',true);
        } else { //if NOT BEEN   
     
    $file_name = time().RandomString(5);
    assign('file_name',$file_name);
             
    $step = 1;
    if(isset($_POST['submit_data']))
    {
        $Upload->validate_video_upload_form();
        if(empty($eh->error_list))
        {
            $step=2;
        }
    }
     
    if(isset($_POST['submit_upload']))
    {
        if(!$_POST['file_name'])
            $_POST['file_name'] = time().RandomString(5);
 
        //$Upload->validate_video_upload_form(NULL,TRUE);
        if(empty($eh->error_list))
        {
            $vid = $Upload->submit_upload();
            //echo $db->db_query;
            //Call file so it can activate video
            $Upload->do_after_video_upload($vid);
             
            if(!error())
            $step=3;
        }
    }
     
    //Assigning Form Name [RECOMMEND for submitting purpose]
    Assign('upload_form_name','UploadForm');
           
    //Adding Uploading JS Files
    $Cbucket->add_js(array('swfupload/swfupload.js'=>'uploadactive'));
    $Cbucket->add_js(array('swfupload/plugins/swfupload.queue.js'=>'uploadactive'));
    $Cbucket->add_js(array('swfupload/plugins/handlers.js'=>'uploadactive'));
    $Cbucket->add_js(array('swfupload/plugins/fileprogress.js'=>'uploadactive'));
}//End our check
}else
{
    $userquery->logincheck('allow_video_upload',true);
}

Hope it helps.

Best Regards,
Richi
 

Richi Glez
Community Liaison
richi.glez@arvixe.com
1-888-927-8493

 

Web Hosting

Linux Hosting
ASP .NET Hosting
Business Hosting
Reseller Hosting
Dedicated Servers

Server Alerts
Acceptable Use Policy
Terms of Service
Privacy Policy

Affiliate Program
Site Map

Blog  Hosting

WordPress Hosting
ExpressionEngine Hosting
Movable Type Hosting
Habari Hosting
Textpattern Hosting


CMS  Hosting

Joomla Hosting
Drupal Hosting
MODX Hosting
Concrete5 Hosting
Xoops Hosting
Ecommerce  Hosting

nopCommerce Hosting
OpenCart Hosting
Magento Hosting
osCommerce Hosting
Tomato Cart Hosting


Video Sharing Software  Hosting

ClipBucket Hosting
PHPMotion Hosting
ClipShare Hosting
osTube Hosting
vShare Hosting
Forum  Hosting

XenForo Hosting
vBulletin Hosting
MyBB Hosting
phpBB Hosting
Simple Machines Hosting


Social Network and Community Website  Hosting

SocialEngine Hosting
Elgg Hosting
Dolphin Hosting
phpfox Hosting
OxWall Hosting
Copyright © 2003-2014 Arvixe, LLC. All trademarks are property of their legal owner.