entete eBusiness.be
imagegauche
 
 




La FAQ eBusiness

FAQ  > Technique et programmation  > CGI > Comment puis-je vérifier l’état de mon quota ?

Vous devez créer un fichier quota.cgi qui vérifie votre quota et l’affiche.

Voici le code à insérer dans le script CGI :


#!/usr/bin/perl

print "Content-type: text/html\n\n";
`quota | tail -n1` =~ / +(\d+) +(\d+) +(\d+)/;
my $used_Ko = sprintf "%d", $1;
my $used_Mo = sprintf "%.2f", ($1)/1024; my $total_Ko = sprintf "%.0f", $3;
my $total_Mo = sprintf "%d", ($3)/1024;
my $remain_Ko = sprintf "%.0f", $total_Ko - $used_Ko;
my $remain_Mo = sprintf "%.2f", ($total_Ko - $used_Ko)/1024;
my $pc = sprintf "%.2f", ($1/$3)*100;
print "<html><head><title>Espace disque</title></head><body bgcolor=#D0DCE0>\n";
print "<table border=0 align=center cellspacing=3>\n";
print "<tr><td colspan=2 align=center><h1>Etat de votre espace disque</h1></td></tr>\n";
print "<tr><td> </td></tr>";
print "<tr><th align=right> Espace total disponible :</th><th align=left> $total_Mo Mo</th></tr>\n";
print "<tr><th align=right> Espace utilisé :</th><td> $used_Ko Ko ($used_Mo Mo) ($pc%)</td></tr>\n";
print "<tr><th align=right> Espace restant :</th><td> $remain_Ko Ko ($remain_Mo Mo) </td></tr>\n";
print "</table>\n";
print "</body></html>";


rect