how to limit uploads to X amount per user

Discussion in 'PHP' started by matt121400, Dec 19, 2008.

  1. #1
    What i am trying to do is give someone a limit for uploads, for example limit that person to 1000 uploads what do i do in combination with mysql or something else that adds on 1 everytime they make an upload until they reach the max of 1000
     
    matt121400, Dec 19, 2008 IP
  2. Dirty-Rockstar

    Dirty-Rockstar Guest

    Messages:
    252
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    
    
    mysql_query("select limit from user_table where username_field='$username'");
    //$username is whatever unique field you use to differentiate each user
    //$limit is your mysql_fetch_assoc
    if($limit>=1000){
    print "too many uploads";
    }else{
    //uploading whatever you are uploading message
    //uploading script here as well
    mysql_query("update user_table set limit=limit+'1' where username_field='$username'");
    
    }
    
    PHP:
    hope i helped. :D
     
    Dirty-Rockstar, Dec 19, 2008 IP