Could someone help me with my wordpress bridge by showing me how to make a mybb cookie. I have been trying for an hour now but can't understand the mybb source. I have access to the mybb database from wordpress and can get the mybb data required.
Thanks if you can help me
Edit: All i need is an example of the code using simple variables like $uid and $loginkey and i will modify it to work with my previous code and database interaction.
Take a look at inc/class_session.php
The cookie is mainly in the form uid_loginkey
Thanks Zinga, i had already looked at that but i need to do it without any mybb functions (i think thats what it is doing) but from that and the function my_setcookie i have come up with this, could you tell me if its correct.
setcookie("mybbuser", "$uid_$loginkey", time()+3600);
Looks fine, except the "$uid_$loginkey" part (you should probably read up on how PHP's string expansion works).
Of course, you should double check it.
Is this better?
setcookie("mybbuser", $mybbuser."-".$mybblogkey, time()+3600);
(Or atleast what you meant)
Its just that its not working so i am trying to work out if its that or its my query.
It looks right, but again, I don't know all your code, so can't guarantee anything.
Generally, if you suspect a value may be wrong, just dump it and check, for example:
$query = mysql_query(...);
$result = mysql_fetch_assoc($query);
// do we have the right result?
die(var_dump($result));
// other code here.
Oh ok, that's cool. I think that's what wordpress is already doing because i was wondering why it wasn't showing errors when my query wasn't working.
Also, what is the loginkey comprised of? I think i read somewhere that it was your user name and you md5 password all md5ed again?
Thanks for your help so far Zinga, its been awesome!
function generate_loginkey()
{
return random_str(50);
}
Oh really, i didn't think it was random. damn.
Thanks for you help Zinga, i worked this out so i now have a working wp/mybb bridge
I will post it up here soon (its not a plugin though, just overwrite files).