Firefox PHP

Big problem: What is the variable p, i or id for? Cannot reply.

Posted by rowitech 
Big problem: What is the variable p, i or id for? Cannot reply.
July 27, 2005 02:44PM
Hi,

I run a phorum 3.1.8a with 1850 Users and as of today prople can't reply to postings sometimes. I shut down the forum to prevent it from getting false posting variables.

I found out that the p variable in the HTML output is set to 42 regardless to which posting is answered. Obviously it should contain the post id from the current posting.

Here is a snipplet of the output when reading a thread:

<form action="post.php" method="post" enctype="multipart/form-data" onSubmit="post.disabled=true;">
<input type="hidden" name="t" value="280" />
<input type="hidden" name="a" value="post" />
<input type="hidden" name="f" value="47" />
<input type="hidden" name="p" value="42" />
<input type="hidden" name="attach_ids" value="" />

In some of my forums there isn't a posting with id 42 and therefore the reply isn't written. But anyway: I could track back this bug to 2003 or further so maybe the variable p just needs an existing posting id and hasn't further features.

So may I set it just to what the variable t (above) contains?

Thank you for your help, it's quite urgent, the forum is down now.

Rolf
Re: Big problem: What is the variable p, i or id for? Cannot reply.
July 27, 2005 03:08PM
just of the top of my head:
t = thread
a = action
f = forum
p = parent


if p is set everywhere for you then you have some own php-code i.e. in header.php which overwrites this variable(s).


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Big problem: What is the variable p, i or id for? Cannot reply.
July 27, 2005 03:20PM
Hi Thomas,

no, p is set to 0 if this is the first posting.
I just started orphan_cleanup but this won't work, so I let it be, before something crashes...

#!/usr/bin/php4 Deleting from allgemein:Array ( [0] => 82055 )
Warning: implode(): Bad arguments. in /noodles/phorum3/include/delete_message.php on line 27
Deleting from allgemeintalk:Array ( [0] => 18500 [1] => 18501 [2] => 18503 [3] => 18505 [4] => 18506 [5] => 18510 [6] => 18512 [7] => 18513 [8] => 18514 [9] => 18516 [10] => 18517 [11] => 18521 [12] => 13643 )

I changed the path of php to the right one (and changed it to php4).

Rolf
Re: Big problem: What is the variable p, i or id for? Cannot reply.
July 27, 2005 04:15PM
> no, p is set to 0 if this is the first posting.

yes, thats fine but still something sets this to 42 in your case and thats not phorum.




Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Big problem: What is the variable p, i or id for? Cannot reply.
July 27, 2005 04:38PM
Yes, but it's not always set to 42 so I'm not sure if I should just turn it to what the t stands for.

I stumbled across post_functions, read.php, post.php, common etc.
From $p I traced back to $id then to $i, it's very hard to checkt out where the 42 (or the other minor numbers) come from.

My own scripts were the first which I investigated but I use only prefixes and so variables like rowi_id, so there should no interference, but it could, of course.

I searched header.php for this case but there was nothing of interest (not set $id or $i or something which could interfere).

Do you have an idea what I could do?

Rolf
Re: Big problem: What is the variable p, i or id for? Cannot reply.
July 27, 2005 06:29PM
try to track this in the code in read.php with some output.
I'm still pretty sure that its some code in header.php changing $parent or $id.
phorum only takes the id from the parent, nothing else.


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Big problem: What is the variable p, i or id for? Cannot reply.
July 28, 2005 09:35AM
Hi Thomas,

I checked $header and $id at the end of header.php.
In a forum (not all forums and users have the same problem!) I posted a new posting.
$header was not set in my trace and $id was 283 (first posting).
And that's the output:

<input type="hidden" name="t" value="283" />
<input type="hidden" name="a" value="post" />
<input type="hidden" name="f" value="47" />
<input type="hidden" name="p" value="42" />

As you can see, the 42 is there and will obivoisly check if the posting with id 42 exists. But one of my admins probably deleted this old posting and therefore the check if the posting is still there will get a false as result:

In post_functions.php:
// checks that the parent of a posted message still exists
function check_parent($parent)

This one prevents the posting from being inserted into the database when being called by this one in post.php:

if (!check_dup() && check_parent($parent)) ...

I'm sitting here in front of this problem more than 12 or 24 hours. I'd thank you much if you would have another idea. The code ist so big that it's sometimes really hard to track.

Is it possible to set p to 283 (like t) as a first aid?
My users can't reply to any post at all and I would like to have a workaround until I found out what happened.

EDIT: Just put all unnecessary things out of header.php, there is definitely no variable set (there wer just 5 rows of code left).

Rolf





Edited 1 time(s). Last edit at 07/28/2005 09:47AM by rowitech.
Re: Big problem: What is the variable p, i or id for? Cannot reply.
July 28, 2005 10:12AM
I told to check $parent, not $header.
make a phpinfo-page in your forum-folder and check if there are i.e. cookies set as parent or something like that.



Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Big problem: What is the variable p, i or id for? Cannot reply.
July 28, 2005 10:47AM
Sorry, I tested $parent, not $header just wrote the wrong variable down.
The phpinfo didn't give me the 42 back, I checked every cookie and everything which could have a 42 in it, but there isn't something.

As a first aid I changed check_parent to give back always true.
Hope this is not too bad. This will be changed immediately
when I found out where the 42 comes from (why just 42? Thinking of Douglas Adams).

Rolf


Re: Big problem: What is the variable p, i or id for? Cannot reply.
July 28, 2005 10:49AM
> As a first aid I changed check_parent to give back always true.

uhm, you will have a lot of bad messages/threads then.

> when I found out where the 42 comes from (why just 42? Thinking of Douglas Adams).

check in include/form.php if $parent or $id is set to 42 there in the beginning, then go up from there.


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Big problem: What is the variable p, i or id for? Cannot reply.
July 28, 2005 12:15PM
SOLVED!!

Thank you, Thomas. I've started at the form.php and went up from there.
Finally I found a select I made in read.php.

Accidentally I made a select id from... and just wanted to get ne number of rows, so I never used $id (for what I searched for).

Thank you again for replying so fast.

Rolf
Sorry, you do not have permission to post/reply in this forum.