 | Re: forum views counter error |  |
Posted: 11/13/2006 11:41 AM |
|
|
|
|
|
| Site Admin |
| Posts |
30757 |
| Word Cnt. |
2,628,690 |
| BDay |
Jul 28 |
| Sign |
Leo |
| Sex |
 |
|
|
|
Joined: Sep 25, 2004
Local time: 4:32 AM
Location: St Pete, FL
|

|
|
|
|
 |
I'm glad that worked. So now what I need to do is compare the files that were modified and see if there is anything obvious that stands out. I will try to do that after I get some sleep...
 |
|
|
 |
 |
| Back to Top |
|
|
 | Re: forum views counter error |  |
Posted: 11/14/2006 1:37 PM |
|
|
|
|
|
| Crow |
| Posts |
66 |
| Word Cnt. |
2,029 |
| BDay |
May 15 |
| Sign |
Taurus |
| Sex |
 |
|
|
|
Joined: Oct 28, 2006
Local time: 3:32 AM
|

|
|
|
|
 |
Ow, ok. Thanks NR.
btw, I found out that all captcha.php files (not only of phpBB) aren't working anymore |
|
|
 |
 |
| Back to Top |
|
|
 | Re: forum views counter error |  |
Posted: 11/15/2006 12:31 AM |
|
|
|
|
|
| Site Admin |
| Posts |
30757 |
| Word Cnt. |
2,628,690 |
| BDay |
Jul 28 |
| Sign |
Leo |
| Sex |
 |
|
|
|
Joined: Sep 25, 2004
Local time: 4:32 AM
Location: St Pete, FL
|

|
|
|
|
 |
Could you zip up the backups and processed folders, including their contents, from the forum views counter error MOD and make it available for me to download? I would like to compare the before and after files to try to figure out what caused this problem...
What is captcha???
 |
|
|
 |
 |
| Back to Top |
|
|
 | Re: forum views counter error |  |
Posted: 11/15/2006 11:06 AM |
|
|
|
|
|
| Crow |
| Posts |
66 |
| Word Cnt. |
2,029 |
| BDay |
May 15 |
| Sign |
Taurus |
| Sex |
 |
|
|
|
Joined: Oct 28, 2006
Local time: 3:32 AM
|

|
|
|
|
 |
| well, that thing that makes you first type the letters seen in a image. That thing what you get when you rigister but also for a few guestbooks. |
|
|
 |
 |
| Back to Top |
|
|
 | Re: forum views counter error |  |
Posted: 11/15/2006 11:15 AM |
|
|
|
|
|
| Crow |
| Posts |
66 |
| Word Cnt. |
2,029 |
| BDay |
May 15 |
| Sign |
Taurus |
| Sex |
 |
|
|
|
Joined: Oct 28, 2006
Local time: 3:32 AM
|

|
|
|
|
 |
|
|
 |
 |
| Back to Top |
|
|
 | Re: forum views counter error |  |
Posted: 11/16/2006 4:27 AM |
|
|
|
|
|
| Site Admin |
| Posts |
30757 |
| Word Cnt. |
2,628,690 |
| BDay |
Jul 28 |
| Sign |
Leo |
| Sex |
 |
|
|
|
Joined: Sep 25, 2004
Local time: 4:32 AM
Location: St Pete, FL
|

|
|
|
|
 |
Ok, I see the error. The MOD author made a mistake that is probably easy to overlook and make. In this instance the mistake is not blatantly obvious like most errors are. So let me attempt to explain what happened and hopefully I won't confuse you...
For SQL queries, the standard is to assign the SELECT queries to a result set variable named $result. Every result set after a SELECT query needs to be freed to avoid memory leaks. So you would normally see something like this after the result set is no longer needed:
| Code:
|
|
$db->sql_freeresult($result);
|
This line of code frees up the memory so that the server OS can use it for something else...
Non SELECT queries such as UPDATE, DELETE, CREATE, and INSERT return a true or false value instead of a result set. Since there is no need to free any resources for true or false values since no memory has been allocated to store them, then it is unnecessary to use the sql_freeresult function to free it. In fact, if you attempt to free a non-set, you will see an error message similar to what you listed on the previous page in this topic. That is the mistake that the MOD author made on this MOD...
So to fix the MOD script, do this:
OPEN
forum_views_counter_1.0.0.txt
FIND
| Code:
|
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// Start Forum Views Counter MOD
$sql = 'UPDATE ' . FORUMS_TABLE . "
SET forum_views = forum_views + 1
WHERE forum_id = $forum_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update forum views count', '', __LINE__, __FILE__, $sql);
}
$db->sql_freeresult($result);
// End Forum Views Counter MOD
|
REPLACE WITH
| Code:
|
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// Start Forum Views Counter MOD
$sql = 'UPDATE ' . FORUMS_TABLE . "
SET forum_views = forum_views + 1
WHERE forum_id = $forum_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update forum views count', '', __LINE__, __FILE__, $sql);
}
// End Forum Views Counter MOD
|
Save, upload, and try again using EM...
That was a hard error to find...
 |
|
|
 |
 |
| Back to Top |
|
|
 | Re: forum views counter error |  |
Posted: 11/16/2006 1:04 PM |
|
|
|
|
|
| Crow |
| Posts |
66 |
| Word Cnt. |
2,029 |
| BDay |
May 15 |
| Sign |
Taurus |
| Sex |
 |
|
|
|
Joined: Oct 28, 2006
Local time: 3:32 AM
|

|
|
|
|
 |
woohooo. It worked.
Thanks for going true all that work. I'm sure more people have the same prob so maybe you should post this edited version the the mod autor or to phpbb.com
btw, do you make any mods yourself? since you so handy with php |
|
|
 |
 |
| Back to Top |
|
|
 | Re: forum views counter error |  |
Posted: 11/17/2006 2:40 AM |
|
|
|
|
|
| Site Admin |
| Posts |
30757 |
| Word Cnt. |
2,628,690 |
| BDay |
Jul 28 |
| Sign |
Leo |
| Sex |
 |
|
|
|
Joined: Sep 25, 2004
Local time: 4:32 AM
Location: St Pete, FL
|

|
|
|
|
 |
I don't know where the MOD topic is located, but you are free to post the correction if you can find it. I would be surprised if the MOD author hasn't figured it out by now. This would affect everyone who installs his MOD...
I have written a few small MODs and co-authored a couple others. I don't understand php thoroughly enough to write a large MOD yet though...
 |
|
|
 |
 |
| Back to Top |
|
|
 | Re: forum views counter error |  |
Posted: 11/17/2006 10:30 AM |
|
|
|
|
|
| Crow |
| Posts |
66 |
| Word Cnt. |
2,029 |
| BDay |
May 15 |
| Sign |
Taurus |
| Sex |
 |
|
|
|
Joined: Oct 28, 2006
Local time: 3:32 AM
|

|
|
|
|
 |
Ok.
I still got a little question. Sometimes there are errors in a mod. Do those errors also apply when doing a manual install or is Easymod just not capible of doing the requested moding. |
|
|
 |
 |
| Back to Top |
|
|
 | Re: forum views counter error |  |
Posted: 11/17/2006 10:38 AM |
|
|
|
|
|
| Site Admin |
| Posts |
30757 |
| Word Cnt. |
2,628,690 |
| BDay |
Jul 28 |
| Sign |
Leo |
| Sex |
 |
|
|
|
Joined: Sep 25, 2004
Local time: 4:32 AM
Location: St Pete, FL
|

|
|
|
|
 |
The errors that you see when installing a MOD with EM are caused when the FIND doesn't match EXACTLY with code in your phpBB files. What could make something not match is an extra or missing space or character in the line of code in the phpBB file. So if you searched for the same code in the FIND that EM is using then you wouldn't find the code either. That's why it is important to minimize the FIND statements so that there is much less chance that the code won't match...
 |
|
|
 |
 |
| Back to Top |
|
|
 | Information |  |
|