Page 1 of 1

get_user_id function

PostPosted: 20 Sep 2012, 03:35
by ka3de
Hi.
I installed arrowchat on a custom site and I'm having some problems with the "get_user_id" function.

What I've done so far is I created a cookie wich has the "userid" for the user, this cookie is set for the main directory "/" so I guessed the "get_user_id" function would be able to read that cookie, but it doesn't.

Is there something that I'm ignoring? Where is the "get_user_id" function called from?

Thank you.

PostPosted: 20 Sep 2012, 06:30
by Jason
It sounds like you're doing it right. I would get a cookie extension for your browser so that you can see all the cookies from the site your browsing and make sure it is actually being set properly.

PostPosted: 21 Sep 2012, 04:08
by ka3de
Ok I solved that, but I have another question sorry:

From the includes/integration.php I want to connect to the database to get the url's of the avatars wich are stored in the "users" table, ¿is that possible? I'm not much sure what are the "elements" of my webpage that I can reach from integration.php

Thanks for the help.

PostPosted: 21 Sep 2012, 22:29
by bodyguard
What are you make for found get_user_id with cookies for integration.pphp please?? :-s
Thanks

PostPosted: 06 Oct 2012, 01:44
by bodyguard
bodyguard wrote:What are you make for found get_user_id with cookies for integration.pphp please?? :-s
Thanks

Up please :-)

PostPosted: 23 Oct 2012, 06:10
by aproape
Hi there,

We added a 2nd function, to avoid using the cookies:

function getUserID2() {
$userid = 0;
echo "<pre>"; print_r ($_SESSION);
echo "</pre>";
if (!empty($_SESSION['userid'])) {
$userid = $_SESSION['userid'];
}

return $userid;
}

Then modified the includes/init.php to use this new function for $userid.

This way, if a browser/user doesn't accept cookies we still get his userid..



Cheers,
Alex

PostPosted: 23 Oct 2012, 12:02
by Jason
Alex, that's unnecessary, you can put it all in one function by first checking for cookies and then a session.

Topic Closed

PostPosted: 16 Dec 2014, 00:26
by Staff Bot
[b]This thread has been locked because the last post is greater than six months old. There is a good chance that the information in this thread is outdated. Please open a new topic if you wish to discuss this further.[/b]