Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: show quota in profile, upload  (Read 2629 times)

0 Members and 1 Guest are viewing this topic.

Justttt

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 170
    • Trippy-ILLusion.Co.Uk
show quota in profile, upload
« on: June 25, 2006, 04:20:54 pm »

found this code of the fourm and it was marked 1.3 also putting it in right place works with 1.4


edit upload.php

find
Code: [Select]
echo "<br /><br />{$lang_upload_php['reg_instr_4']}";
under add.

Code: [Select]
global $CONFIG;
global $USER_DATA;
$results = cpg_db_query("SELECT sum(total_filesize) FROM {$CONFIG['TABLE_PICTURES']} WHERE owner_id = " . USER_ID);
$record = mysql_fetch_array($results);
        $total_space_used = $record[0];
$total_space_used = round($total_space_used / 1048576, 2);
$quota = $USER_DATA['group_quota'];
$quota = round($quota/1024, 2);
if($quota == 0) {
//User has no quota, so don't display quota message.
}
else {
$percentage = round(100 * ($total_space_used / $quota), 2);
if($percentage <= 60) {
$color = '#00A000';
}
elseif($percentage > 60 && $percentage < 80) {
$color = '#FFD300';
}
elseif($percentage >= 80) {
$color = '#FF0000';
$upgrade_now = '<a href="upgrade.php"><font color="#FF0000">Upgrade NOW!</a>';
}
$prog_width = round($percentage, 0);
if ($prog_width > 100) {
$prog_width = 100;
}
echo '<hr><div align="center" style="color:'.$color.';font-weight:bold;">You are currently using '.$total_space_used.' MB ('.$percentage.'%) of your '.$quota.' MB of storage. '.$upgrade_now.'';
echo '<div align="left" style="display:block; margin-top:5px; margin-bottom:5px; width:100%; border:1px solid #000000; height:10px;">';
echo '<div align="left" style="display:block; background-color:'.$color.'; width:'.$prog_width.'%; height:10px; color:#000000;"></div>';
echo '</div>';
echo '</div>';
}


edit profile.php

find.
Code: [Select]
make_form($edit_profile_form_param, $form_data);
below it add.

Code: [Select]
global $CONFIG;
global $USER_DATA;
$results = cpg_db_query("SELECT sum(total_filesize) FROM {$CONFIG['TABLE_PICTURES']} WHERE owner_id = " . USER_ID);
$record = mysql_fetch_array($results);
        $total_space_used = $record[0];
$total_space_used = round($total_space_used / 1048576, 2);
$quota = $USER_DATA['group_quota'];
$quota = round($quota/1024, 2);
if($quota == 0) {
//User has no quota, so don't display quota message.
}
else {
$percentage = round(100 * ($total_space_used / $quota), 2);
if($percentage <= 60) {
$color = '#00A000';
}
elseif($percentage > 60 && $percentage < 80) {
$color = '#FFD300';
}
elseif($percentage >= 80) {
$color = '#FF0000';
$upgrade_now = '<a href="upgrade.php"><font color="#FF0000">Upgrade NOW!</a>';
}
$prog_width = round($percentage, 0);
if ($prog_width > 100) {
$prog_width = 100;
}
echo '<hr><div align="center" style="color:'.$color.';font-weight:bold;">You are currently using '.$total_space_used.' MB ('.$percentage.'%) of your '.$quota.' MB of storage. '.$upgrade_now.'';
echo '<div align="left" style="display:block; margin-top:5px; margin-bottom:5px; width:100%; border:1px solid #000000; height:10px;">';
echo '<div align="left" style="display:block; background-color:'.$color.'; width:'.$prog_width.'%; height:10px; color:#000000;"></div>';
echo '</div>';
echo '</div>';
}
Logged
J U S T T T T

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: show quota in profile, upload
« Reply #1 on: July 04, 2006, 07:40:03 am »

Saying what your code changes are suppossed to do and posting a link to the thread you're refering to would have made this thread much more usefull.
Logged
Pages: [1]   Go Up
 

Page created in 0.031 seconds with 20 queries.