What's wrong with this?

Discussion in 'Scripts, 3rd Party Apps, and Programming' started by TechAsh, Jul 17, 2008.

Thread Status:
Not open for further replies.
  1. DefecTalisman

    DefecTalisman Community Advocate Community Support

    Messages:
    4,148
    Likes Received:
    5
    Trophy Points:
    38
    odd, cause without the
    PHP:
      $tmp4 explode('>',$tmp3[0]);
            
    $tmp3[0] = $tmp4[1];
    I get the same old tag sitting there.
     
  2. woiwky

    woiwky New Member

    Messages:
    390
    Likes Received:
    0
    Trophy Points:
    0
    Well, you also said that the index.html source from the function didn't match the source code you saw from your browser. So I'm not sure what's going on there, maybe you have a different return string than I do. But even still, strip_tags() *should* strip any html tags regardless of if they're closed or not.
     
  3. DefecTalisman

    DefecTalisman Community Advocate Community Support

    Messages:
    4,148
    Likes Received:
    5
    Trophy Points:
    38
    ok, cleaned it up a little.
    PHP:
    function parseIndex2($key)
        {
            
    $value = array();
            
    preg_match('/' $key '([^MB]*)/'$this->HTTP->getData('index.html'), $value);
            
    $tmp strip_tags($value[1]);
            
    $value[1]= $tmp;
            return 
    $value[1];
        }

    function 
    getSpaceUsed()
        {
            
    $tmp $this->parseIndex2('Disk Space Usage');
            
    $tmp1 explode('/',$tmp);
            
    settype($tmp1[0], 'float');
            
            
            return 
    $tmp1[0];
        }

    function 
    getBandwidthUsed()
        {
            
    $tmp $this->parseIndex2('Monthly Bandwidth Transfer');
            
    $tmp1 explode('/',$tmp);
            
    settype($tmp1[0], 'float');
            
            
            return 
    $tmp1[0];
        }
     
    Last edited: Jul 18, 2008
  4. TechAsh

    TechAsh Retired

    Messages:
    5,853
    Likes Received:
    7
    Trophy Points:
    38
    I'm not currently using the cPanel API to get the used disk space (Although I'm probably just about to change it) I use a function that just goes though and counts up the size of every file in my account.

    Right it's working now. Yay! Thanks Defec.

    NOTE:
    There is an error in the code in your last post,
    Should be:
    EDIT:
    Oh, you've already fixed it.
     
    Last edited: Jul 18, 2008
  5. DefecTalisman

    DefecTalisman Community Advocate Community Support

    Messages:
    4,148
    Likes Received:
    5
    Trophy Points:
    38
    I have changed a whole load more of this class.

    Watch this exact post for an "EDIT" and a link to a *.rar.


    EDIT
    http://www.defectalisman.com/examples/cpanel.rar

    i have included my little GD image class with it as I use it in the example.

    BEWARE, I got a high resource suspension from refreshing the page to much I think. Was only for 15 mins. i am not sure if its the GD image or if also other things where being used from my account or if it was the cpanel class :s
     
    Last edited: Jul 18, 2008
  6. TechAsh

    TechAsh Retired

    Messages:
    5,853
    Likes Received:
    7
    Trophy Points:
    38
    Cool, I see you put some of the functions together (All the Disk/Bandwidth ones.) I guess to use it you use something like:
    PHP:
    getSomethingUsage("Disk Space Usage");
    I'll stick to to slightly older version, because I've only just re-written my scripts to use the cPanel API, and don't fancy re-writing them again soon.

    Maybe in the next version you should re-write some of the comments (Some of them have got mixed up).
     
  7. DefecTalisman

    DefecTalisman Community Advocate Community Support

    Messages:
    4,148
    Likes Received:
    5
    Trophy Points:
    38
    Yeah. But it's
    PHP:
    ->getSomethingUsed('Identifier');
    ->
    getSomethingMax('Identifier');
    ->
    getSomethingFree('Identifier');
    ->
    getSomethingInfo('Identifier')
    EDIT
    ok, just to clear this up. 101 reasons why its not the gd image :p
    Its the cpanel AIP.

    http://www.defectalisman.com/class/test.php

    101 random instances of the GD statBar image and you can refresh the page as you will.

    I think its cause I call almost all the working functions in the aip class in the one script.
    Even with the images set not to display the text output lags.

    oh, sorry.
    If you are saying the images are cached then try this ->

    http://www.defectalisman.com/class/test2.php

    Although the headers are constructed so they shouldn't be.
     
    Last edited: Jul 19, 2008
  8. TechAsh

    TechAsh Retired

    Messages:
    5,853
    Likes Received:
    7
    Trophy Points:
    38
    I'm going to close this now that the problem I was having has been solved.

    *Closed*
     
Thread Status:
Not open for further replies.

Share This Page