Welcome, Guest. Please Login or Register.
May 10, 2025, 04:48:59 PM
Home Help Search Log in Register
News: If you are still using YaBB SE, please consider upgrading to SMF as soon as possible.

YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  How to read in cookie if user is already logged on? « previous next »
Pages: [1] Reply Ignore Print
Author Topic: How to read in cookie if user is already logged on?  (Read 509 times)
bully
Noobie
*
Posts: 7


I'm a llama!

How to read in cookie if user is already logged on?
« on: March 15, 2003, 03:19:58 PM »
Reply with quote

I would like to extend my YabbSE with a special member-page and additional member info. Every member should be able to alter their own profile if already logged on.
So here the question:
How and where can I extract the user information from the YabbSE set cookie to determine the user's status?
Thx for answers...
« Last Edit: March 15, 2003, 03:20:39 PM by bully » Logged
David
Destroyer Dave
Global Moderator
YaBB God
*****
Posts: 5761


I'm not a llama!

WWW
Re:How to read in cookie if user is already logged on?
« Reply #1 on: March 15, 2003, 07:17:20 PM »
Reply with quote

Look in LogInOut.php and you will see how the cookie is set.
Logged

bully
Noobie
*
Posts: 7


I'm a llama!

Re:How to read in cookie if user is already logged on?
« Reply #2 on: March 15, 2003, 08:29:05 PM »
Reply with quote

Ah, I see, almost too easy  ::)

Is there also a complete function somewhere which checks if the member is logged on before an action is executed?

Would be nice if I just could set an "if (function checkifloggedon()) { do my stuff }" and thats it.  ;)
Logged
Gobalopper
Mod Team
YaBB God
*****
Posts: 993


Cookie Monster

WWW
Re:How to read in cookie if user is already logged on?
« Reply #3 on: March 15, 2003, 09:02:18 PM »
Reply with quote

Yes LoadCookie() does that already.
Logged
bully
Noobie
*
Posts: 7


I'm a llama!

Re:How to read in cookie if user is already logged on?
« Reply #4 on: March 15, 2003, 09:48:22 PM »
Reply with quote

so you are saying I can simply write:

if (LoadCookie()) {
  allow user xyz to change his stuff
}


or do I have to write:

LoadCookie();
if ($username != "Guest") {
     DO_MY_STUFF
}

because as far as I understand it, LoadCookie checks if the cookie is set, and if not it sets $username to "Guest".
That also explains the following SQL Select command with ...WHERE memberName=$username.

So my last version should be correct, shouldn't it?
Just checking the value of $username, and when it is "Guest" he is not registered.
Or other way round: I can allow member $username to access and change his profile ./profile/$username.php

Hope I got it now, thx for the help!
Logged
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:How to read in cookie if user is already logged on?
« Reply #5 on: March 15, 2003, 09:52:59 PM »
Reply with quote

Well, that would mean you would have a security risk.

Better, you should also LoadUserSettings() immediately after LoadCookie().  This will actually authenticate the user.

-[Unknown]
Logged
bully
Noobie
*
Posts: 7


I'm a llama!

Re:How to read in cookie if user is already logged on?
« Reply #6 on: March 15, 2003, 10:12:18 PM »
Reply with quote

... and thereby check if $username is in the database and retrieve his values to verify the first assumption that he really is $username.   :D

Smart thing to do, thx.

BTW: is there a good lecture on the internet about security issues in PHP and MySQL?
Seems like I have some more lessons to do on this  :-\

Logged
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  How to read in cookie if user is already logged on? « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.058 seconds with 21 queries.