MyBB Community Forums

Full Version: Where to I find the UID in the PHP Scripts So I Can Set Unique User IDs For Guests?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm doing this without a plugin - it works so far.

Where are the UID's for guests and members.

I need to assign a UID for guests that is unique.

I am half way there by setting a UID that is unique, it works for members but not for guests as it registers '0' for the User ID.

In postbit_author_user I insert the line:

<b>User ID: {$post['uid']}</b>

This brings a unique number such as User ID: 1234

But if I do the same in postbit_author_guest it is '0' as I said.

Now for this to register a unique number my guess is the the postbit_author_user is grabbing numbers from the IP address of a registered user.

Where do I find the UID for those members and add the same code to guests in the php scripts?

This should in theory bring a unique number for guests also.

Thank you.
The UID is the primary key of the users table.
Since guests are not in that table, they have no user ID (for obvious reasons).
(2012-05-20, 02:39 PM)Pirata Nervo Wrote: [ -> ]The UID is the primary key of the users table.
Since guests are not in that table, they have no user ID (for obvious reasons).

But is it not true that the registered UID would record the IP of the user and give a unique identifier as that ID?

I'm not too bothered about the ID being overly unique for the guest.

If a member posts as a guest his/her ip would still bring the UID of the user that is registered.

But if the IP is unique for the guest it would come back as a unique id for that session.

Is there a way I could try this out via the scripts for the forum in my root files?
The uid has nothing to do with the ip...
(2012-05-20, 03:56 PM)StefanT Wrote: [ -> ]The uid has nothing to do with the ip...

Okay let me rephrase

How would I make the UID tally with an IP, it has to be possible because both Lunatic OutPost and godlike Productions have managed it - and it is not with the UID Plugin because that does not work with Guests.

The UID must be able to tally with the IP address of a user somewhere down the line.

If we can suss this out between us then this would be an awesome facility for MyBB.

I have been trying to figure this out for months with no success.

If it can be done that is. Smile

Thanks guys.
You could probably do something such as $custom_uid = my_ip2long($post['ipaddress']); but it doesn't take much to reveal the actual IP of the post to everyone. With a bit of mathematical work you could add a hardcoded number to the end or start of the variable to make it unconvertable yet still unique.
(2012-05-20, 04:50 PM)Nathan Malcolm Wrote: [ -> ]You could probably do something such as $custom_uid = my_ip2long($post['ipaddress']); but it doesn't take much to reveal the actual IP of the post to everyone. With a bit of mathematical work you could add a hardcoded number to the end or start of the variable to make it unconvertable yet still unique.

This makes great sense - how would I configure this to a guest ID?

Which PHP file? I have been working with the inc/functions_post.php

And the Templates/Postbit/postbit_authors_guest

So far the only success I am having is with the iplogged but as you point out it shows the full IP, with your method it would do the job needed. But the coding is becoming a little beyond my capabilities (Ouch).

(2012-05-20, 04:50 PM)Nathan Malcolm Wrote: [ -> ]You could probably do something such as $custom_uid = my_ip2long($post['ipaddress']); but it doesn't take much to reveal the actual IP of the post to everyone. With a bit of mathematical work you could add a hardcoded number to the end or start of the variable to make it unconvertable yet still unique.

Is there a function script in the mybb php files?

I am trying this but without success. I have tried the string value $ip to no avail.

I see this http://uk.php.net/ip2long is somewhat how I should be using the ip2long code - but is this a separate php page?

How do I point to it in postbit_authors_guest?

I cannot find any info on how to do this in mybb can anybody help with figuring out ip2long so that I can use the code in postbit_author_users

Thank you in advance.