Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inactivity Scanner
#1
Hello AGAIN,

Sorry to ask for so many things but i want this version to be the best lol.

I was looking through a friends sitem he has iPanel installed, there is a feature called the Inactiviry Scanner. I was wondering can this be packed into v1.2?

I mean it looks pretty simple to do.

Whadya think?
#2
I will take a look Big Grin

If its as simple as it sounds, it will hopefully be implemented.
Rich - Ex lead developer
#3
Depends what you mean by inactivity scanner? Is it inactivity in cPanel or logged in, into THT?
Jonny H - THT Main Developer & Founder


#4
(04-26-2009, 06:32 AM)Jonny Wrote: Depends what you mean by inactivity scanner? Is it inactivity in cPanel or logged in, into THT?

The one in i(usless)panel scans for diskspace/bandwidth usage in WHM.
Rich - Ex lead developer
#5
Here is a little snippet i wrote. And yes it works.

Code:
function convert_from_bytes( $bytes, $to=NULL )
{
  $float = floatval( $bytes );
  switch( $to )
  {
    case 'Kb' :            // Kilobit
      $float = ( $float*8 ) / 1024;
      break;
    case 'b' :             // bit
      $float *= 8;
      break;
    case 'GB' :            // Gigabyte
      $float /= 1024;
    case 'MB' :            // Megabyte
      $float /= 1024;
    case 'KB' :            // Kilobyte
      $float /= 1024;
    default :              // byte
  }
  unset( $bytes, $to );
  return( $float );
}

// YOU CAN USE THE API-XML BUILD IN THINGY HERE BUT IT GIVES TE SAME RESULT
    $user = "username";
    $pass = "password";
    $title1 = implode('', file("http://$user:$[email protected]:2086/xml-api/showbw"));
// END OF THAT.

    $title1 = str_replace("%20", " ", $title1);
    $accounts = substr_count($title1, '<acct>');
    $mainpiece = explode('<acct>', $title1);    
    
    $i=1;
    while ( $i <= $accounts ) {
    $cpiece = $mainpiece[$i];

    $pieces = explode('<user>', $cpiece);
    $a = $pieces[1];
    $pieces = explode('</user>', $a);
    $user = $pieces[0];
    
    $pieces = explode('<totalbytes>', $cpiece);
    $a = $pieces[1];
    $pieces = explode('</totalbytes>', $a);
    $tb = $pieces[0];
    $tbr = round(convert_from_bytes( $tb, "MB" ));
    
    if($tbr < "2") {
    $inactive = "INACTIVE";
    // Send out email that they are inactive if the data is the 15th
    // Suspend on the 20th
    // Send email at 23rd
    // Still no reply? Terminate on 25th.
    } else {
    $inactive = "active";
    }
    

    
    echo "[$user] $tbr <B>$inactive</b><br>";
    
    $i++;
}


Forum Jump:


Users browsing this thread: 1 Guest(s)