View Single Post
Old 12.06.2006, 21:42   #16
Bruenor
Архивный участник
 
Join Date: Jun 2006
Posts: 14
Default

I found another bug. Where the website says "you need install a db 'itemname' to database (setted up to $dbname)", I'm not sure whether you meant to display '$dbname' or the name of the database.
In the first case, insert a \ before the $ to prevent it from being treated as a variable name.
In the second case, insert include("config.php"); before the echo statement. (Although it is already included in the PAGE_DEFAULT function, it isn't visible elsewhere. I tried moving the include statement to the top of the file, but then it wasn't visible inside PAGE_DEFAULT, so apparently you have to put it in both places.)

I also found some more problems related to the fix I posted earlier:
1) Variables do not get assigned a default value when they are first referenced. If you have not previously assigned a value to a variable, trying to get its value results in an error.
2) Sending parameters in the URL does not assign the specified values to your variables. For example, the URL "http://mysite.com/index.php?MyVar=4" does NOT set $MyVar to 4. To get the parameter, use $HTTP_GET_VARS['MyVar'], as demonstrated in my previous post.

You moved the code for setting the variables into PAGE_DEFAULT but then called the function after the value of $page is checked. I think the best way to resolve this is to just move
Code:
if(isset($HTTP_GET_VARS['step'])) $step=intval($HTTP_GET_VARS['step']); else $step=0;
if(isset($HTTP_GET_VARS['page'])) $page=intval($HTTP_GET_VARS['page']); else $page=0;
out of PAGE_DEFAULT and put it before "if($page==0)". (This applies to petdata.php, droplist.php, npcpos.php, and skillacquire.php.)

Here are some more fixes:
skillacquire.php line 72
Code:
if(isset($skill_book_id[$sid]) and $skill_book_id[$sid]==$sid) {
skillacquire.php before line 54
Code:
$num=0; $cid2=0; $classname_end="";
droplist.php line 65
Code:
$spoil_chance=$drops_row["chance"]/10000;
npcpos.php line 44
Code:
if($step=="2") $query="SELECT * FROM spawnlist ORDER BY npc_templateid LIMIT 20001,1000000000";
Bruenor is offline