How to Limit the Number of Videos That Can Be Uploaded in a Day in Clip-Bucket v2.6

Hello,

A couple of days ago, a user at the forum asked how to limit the amount of videos that can be uploaded in a day; looking at the script I found the tweak was very simple to do, so I am writing an article for all of you that would like to limit the videos to X per day. Tested in Clip-Bucket v2.6.

Difficulty level: Easy

1. Back up upload.php, located in ./*

2. Open upload.php

If you have made changes/modifications in the past to that file, please read this post for step by step instruction, so you don’t lose your previous work: http://forum.arvixe.com/smf/clip-bucket-software/limit-video-upload/msg27553/#msg27564

3. Delete everything from the file and copy paste these: (This examples limits upload to 4, to change, look for if($row >= ’4′) and edit that number to your needs)

<?php

/*  
 *******************************************************************
 | Copyright (c) 2007-2008 Clip-Bucket.com. All rights reserved.    
 | @ Author   : ArslanHassan                                        
 | @ Software : ClipBucket , © PHPBucket.com
 | @ Modified : June 14, 2009 by Arslan Hassan
 *******************************************************************
*/

define("THIS_PAGE","upload");
define("PARENT_PAGE","upload");

require 'includes/config.inc.php';

$pages->page_redir();
subtitle('upload');

//Checking if user is guest  
if(userid())
    $verify_logged_user = true;
else
    $verify_logged_user = false;

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);

    $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);
}

Assign('step',$step);

subtitle(lang('upload'));
//Displaying The Template
template_files('upload.html');
display_it();

?>

4. Save and Upload.

You’ve now finished. If you have any problem, question, comment, please let me know and I’ll get back to you ASAP.

Best Regards,
Richi
Owner of Juapo2Services

Looking for quality ClipBucket hosting? Try out Arvixe and you won’t be disappointed.
Tags: , , , , , , , , , , , , , , , , | Posted under ClipBucket | RSS 2.0

Author Spotlight

Richi González

Richi González

I started programming when I was 12. I'm a Developer and have been working with the Clip-Bucket script since it came out. I became a Liaison between Arvixe and Clip-Bucket, so I am here to assist you with anything you need regarding Clip-Bucket or any particular computer-related subject you need. Best Regards, Richi

Leave a Reply

Your email address will not be published. Required fields are marked *


4 + 2 =

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>