Stop suspending my account!

Status
Not open for further replies.

nicholas66

New Member
Messages
6
Reaction score
0
Points
0
can you gyes at X10 please stop suspending me. I'm trying to debug a piece of loop code and every time I execute it to see what's wrong. your robot suspends my account. Please stop. I used to thin you were the best hosting company but you are really starting to annoy me now. And now if I slip up again YOU WILL DELETE ALL MY WORK. I am really passionate about coding and i'm only 13 (and yes my parents have approved this hosting account). Please don't make me leave you as I really like X10hosting but if this is how your going to treat me then I'd rather spend £47543687564875436587645874635874675846387563498756439785648756487585843658764589764258743692857634257694326587463529748596487658756924 a month than use your mean hosting company. :(
 

lemon-tree

x10 Minion
Community Support
Messages
1,420
Reaction score
46
Points
48
If you had that sort of money to spend, I don't know what you'd be doing on free hosting anyway...
The problem here is that you need to log into the forums once a month to prevent an inactivity suspension, so by making this post you have prevented your account from being suspended for the next month. Note: you don't actually have to post, you only have to log in to prevent the suspension.

And now if I slip up again YOU WILL DELETE ALL MY WORK

I don't know where you read that but it is not the case as long as you get unsuspended before 14 days have passed since the suspension. Either way, you should always have local backups of the most recent copies of all of your files; I have no pity for people who complain their files were deleted when they themselves didn't have a backup.

piece of loop code

Be careful how long your loop is, if it is an infinite loop you may find your account gets suspended for high resource usage if the script is running for more than 60 seconds. This is reduce load on the servers from resource heavy scripts.
 
Last edited:

nicholas66

New Member
Messages
6
Reaction score
0
Points
0
the loop is supposed to take like a seccond. It just checks what level the use is depending on the exp needed for that level. How would you do it then. :mad:
and the suspension reason was for high resource usage. I only made this account two days ago.
I do keep backups but how else am I going to host it?
 
Last edited:

Anna

I am just me
Staff member
Messages
11,752
Reaction score
582
Points
113
Below is a snippet from the logs, something that you have in the root of the domain spyzania.co.cc did at that point use 94% of one full CPU. Limits is you can't use more then 25% over a period of 60 seconds. If you go over that for more then 60 seconds, your account gets suspended.

You should look at your code trying to determine the cause. Some cache related functions/addons/plugins does tend to use quiet a bit at the time content is added to the cache, so if you have something like that, that would be a good place to start looking.

Sun 19 Dec 2010 08:55:15 / 1292766915:
cpu: 94.000
mem: 0.300
ctm: 00:00:03
commands: (1 total)
SCRIPT_URI=http://spyzania.co.cc/
 

nicholas66

New Member
Messages
6
Reaction score
0
Points
0
yea I have thought about the problem but like I said if I slip up again (even thought I do know lots of php for my age) then that's my hosting account screwed. but the answer is simples. all I need to do is terminate the page if it seems to be ding a loop before my 60 seconds are up. Am I right????

---------- Post added at 07:33 PM ---------- Previous post was at 07:15 PM ----------

Now you see what I mean, I change the code and it suspends me for testing it. This below is the troublesome code and I would like some help with it, please no copying it as this is my work.

How It works is $mainquery is a query to the USERS database and the table levels contains a level and the required exp needed for it (yes it is filled)

PHP:
$exp = mysql_result($mainquery,0,"exp");
$tick = true;
$i = 1;
$levelquery = mysql_query("SELECT * FROM `LEVELS`");
while ($tick) { 
	if (mysql_result($levelquery,($i-1),"exp")>=$exp) {
		$level = $i;
		$i++;
	}
	else {
		$tick = false;
	}
}

Please Help, this is my holiday project.
 

lemon-tree

x10 Minion
Community Support
Messages
1,420
Reaction score
46
Points
48
What exactly is this code meant to do, could you explain line by line as it is possible that this could be done with a single mysql query and thus cut out the entire loop.
This is how I am understanding it: loop through every 'level' until it finds the first row greater than the specified $exp value? So say $exp was 10 and the values of exp in LEVELS were: 1, 4, 7, 11, 15, 20 it would return the row with exp as 11? If so, this certainly could be simplified down to one query with no loop.
 

nicholas66

New Member
Messages
6
Reaction score
0
Points
0
It is supposed to find the user's level by finding the highest level (which goes 1,2,3,4,5,6... to 10) that the user has the amount of exp to have achieved, I don't get why it's not working

---------- Post added at 08:27 PM ---------- Previous post was at 08:19 PM ----------

I was able to test it and the loop has gone mad, can I please have that non loop solution please.
 

lemon-tree

x10 Minion
Community Support
Messages
1,420
Reaction score
46
Points
48
OK, this should work then and should take a fraction of the time:
Code:
$exp = intval(mysql_result($mainquery,0,"exp")); 
$levelquery = mysql_query("SELECT `LEVEL_COLUMN` FROM `LEVELS` WHERE `exp` >= $exp ORDER BY `exp` ASC LIMIT 1");
$level = mysql_result($levelquery,0,"LEVEL_COLUMN");
You'll have to substitute in the name of the column containing the level number where I have typed LEVEL_COLUMN (Make sure you replace both of them).
Also, I suggest you avoid using the old mysql_ driver and move to PDO or mysqli. There are a few other things in there that are a bit dodgy, but it should at least work now.
In theory, you could even combine the $mainquery with the levelquery into one query that does both.
 

nicholas66

New Member
Messages
6
Reaction score
0
Points
0
Thanks, I will try that code asap,
two points:
  • I'm used to mysql and what would be the benefits of switching to mysqli, I have heard very little of it
  • I won't combine them as I only need to query the level table once and once again on the page soon to come displaying all the levels and the required exp.
I'm glad I'm on the right track with X10 again. :)

EDIT:
Also, is the "intval" function necessary? It is an int already, I don't need to convert it
it's like that mis-printed question in my maths test convert 0.8 recurring to a decimal.
EDIT2:
Also thank you, I have learnt lots from this little accident :)
 
Last edited:

lemon-tree

x10 Minion
Community Support
Messages
1,420
Reaction score
46
Points
48
PDO and Mysqli are more modern versions of the mysql plugin, meaning they are generally faster, more secure and more memory efficient.
 
Status
Not open for further replies.
Top