What's wrong with this?

Status
Not open for further replies.

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
Points
38
odd, cause without the
PHP:
  $tmp4 = explode('>',$tmp3[0]);
        $tmp3[0] = $tmp4[1];
I get the same old tag sitting there.
 

woiwky

New Member
Messages
390
Reaction score
0
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.
 

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
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:

TechAsh

Retired
Messages
5,853
Reaction score
7
Points
38
Really odd that the disk space was working and not the bandwidth. I got the same problem from both
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,
settype($tmp1[0], $type);
Should be:
settype($tmp1[0], float);

EDIT:
Oh, you've already fixed it.
 
Last edited:

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
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:

TechAsh

Retired
Messages
5,853
Reaction score
7
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).
 

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
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:

TechAsh

Retired
Messages
5,853
Reaction score
7
Points
38
I'm going to close this now that the problem I was having has been solved.

*Closed*
 
Status
Not open for further replies.
Top