• Welcome to WooUSEFUL by PHPVIBE . Please log in.

[ Video Sharing CMS v4 ] Daily upload limit per user /How to limit daily uploads in PHPVibe

Started by ASDF,

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ASDFTopic starter

Hi Mario...i don't want my users to upload, say (X)number of files per day, or let's just say that i want to limit number of uploads per user per day... :) .
  •  

mihai

I am curious about if is posible to don''t let them share the same file
ex(user:Alice shared the link x so user:Marius can"t share the link x anymore becouse is already shared)
  •  

ASDFTopic starter

Stopping users from sharing the same file....acc to me is impossible, and the rest depends on Mario, if he has some codes
If you are talking about,images, then you should make it mandatory for users to add a watermark, so that you can delete the multiple uploads, the same thing can be applied on videos too, if uploading is enabled for users, i don't think you will be able to stop them from sharing the same file via youtube link....but you can delete them by yourself. Another solution is,ask your user to search first if the file he is uploading,by tags and related search terms, if the file has been already uploaded by someone,then they should upload that again, or else we will delete the file, resulting in total waste of time and money/data. Repeating that might lead to termination of account or something like that.
  •  

ASDFTopic starter

  •  

Marius

Kinder garden questions :)
Query a count on the user's videos uploaded today , build your if on the upload page:)

if($uservids->nr > 5) {
echo "No more dude!"
} else {
//render normal upload page
}



Don't ask for true code today, is weekend, I'm on an tablet traveling.
If this helped, consider buying me a coffee.
20 years coding, tweaking, building in PHP. Still creating!
  •  

ASDFTopic starter

No more dude.... :p :p :p, good one.
But dude, which file to edit?
  •  

Marius

Always com/com_add.php for video uploads :)
If this helped, consider buying me a coffee.
20 years coding, tweaking, building in PHP. Still creating!
  •  

ASDFTopic starter

Hey Mario...can you tell me where to insert that code....is it possible for you?
  •  

ASDFTopic starter

  •  

ASDFTopic starter

 ;D....can you tell me where to insert the above code for limiting uploads by user.
  •  

Marius

If you want to copy/paste it you'll just get that $uservids->nr is undefined :)
If this helped, consider buying me a coffee.
20 years coding, tweaking, building in PHP. Still creating!
  •  

ASDFTopic starter

Sorry bro, i don't know if it's the same, but i have to limit the users by from uploading (X) number of photos....sorry,i only mentioned the uploads earlier and not the type.
You said for video related things, i should always look into com_add.php.....but what about the photos.
Com_image.php? and can it be done. Sorry again.
Please please help me with this one.
This is a must for me right now. :( :( :(.
  •  

ASDFTopic starter

  •  

Marius

#13
Here is the sql query examples returning what you need.

For videos:
SELECT COUNT( * ) 
FROM `vibe_videos` 
WHERE `user_id` =1
AND DATE( DATE ) = DATE( NOW( ) ) 
AND media = '1'



For pictures:


SELECT COUNT( * ) 
FROM `vibe_videos` 
WHERE `user_id` =1
AND DATE( DATE ) = DATE( NOW( ) ) 
AND media = '3'



Now that you know the logic query here is how it goes in PHPVibe:


$uservids = $db->get_row("Select count(*) as nr from ".DB_PREFIX."videos WHERE `user_id` = '".user_id()."' AND DATE( DATE ) = DATE( NOW( ) ) AND media = '1' ");



now


$uservids->nr


and you can easily do an if:


if($uservids->nr > 4){
echo "You have reached the daily number of 5 videos.";

}

Holds the number of videos uploaded today by the current user.


Same for pictures, just media is 3 in that case, for music is 2.

If this helped, consider buying me a coffee.
20 years coding, tweaking, building in PHP. Still creating!
  •  

Marius

Quote from: ASDF on
Please Mario.... :( :-\ :-\.

You saw me typing here and you decided I need a push? :)
I was anyways answering you.
If this helped, consider buying me a coffee.
20 years coding, tweaking, building in PHP. Still creating!
  •  

ASDFTopic starter

  •  

ASDFTopic starter

Hey Mario...your this line...Holds the number of videos uploaded today by the current user.
Has confused me totally, the above code is for limiting the user from uploading the X number of images (media 3 )?
If, yes...then where am i supposed to insert that code now and where in the particular file....com_add.php or com_images.php?
:p.
  •  

Marius

If this helped, consider buying me a coffee.
20 years coding, tweaking, building in PHP. Still creating!
  •  

ASDFTopic starter

In which file for limiting image uploads....com_add.php or com_image.php and where.....i know bro you will literally beat the hell out of me if i show you up, as you are pissed, but i even know a minor mistake in coding can bring the whole website down.
  •  

Marius

Do you read what your are asking? Or think about it for a second? I've already told you before com_add is for video, com_image is for images (it has 'image' in it  ??? )
If this helped, consider buying me a coffee.
20 years coding, tweaking, building in PHP. Still creating!
  •  

Marius

I'm not pissed, I know I'm not all sugar, pretty hard to be when you eyes and head hurt 24/7.
If this helped, consider buying me a coffee.
20 years coding, tweaking, building in PHP. Still creating!
  •  

ASDFTopic starter

Sorry mate  :p...getting different types of errors, that's why i have given you the codes ^-^ :) :).
  •  

Marius

Want me to make you an paid subscription for coding lessons?  :p


All you need is this area:


if((get_option('uploadrule') == 1) ||  is_moderator()) {    
add_filter( 'the_defaults', 'modify_content' );
} else {
add_filter( 'the_defaults', _lang("Uploading is disabled") );
}



like:



/* New line */ if(($uservids->nr > 4) && !is_moderator()){
if((get_option('uploadrule') == 1) ||  is_moderator()) {   
add_filter( 'the_defaults', 'modify_content' );
} else {
add_filter( 'the_defaults', _lang("Uploading is disabled") );
}

/* New condition */
} else {
add_filter( 'the_defaults', _lang("You have passed your daily limit of X videos/images/music bla bla") );
}



Don't forget to place the actual query right before this code :)
If this helped, consider buying me a coffee.
20 years coding, tweaking, building in PHP. Still creating!
  •  

ASDFTopic starter

  •  

ASDFTopic starter

  •  

Similar topics (7)