If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

After and Before Login : About PHP & Sessions

Well, after much work, at last, i have created members system. Well its not completed yet, reason is when i open page it works - it can register new peoples, can login but (till my website doesn't have any memberr-only page.) I don't know how to make "Sign Up" button disappear while user has logged-in and show "Log out" and "User Name" instead. Means, IDK how to tell website that user has logged in. I know it is not big deal, i just don't get how... please help me. Hear my codes...

1. This part is at end of my login script....
I think problem is here....

2. This is part of index.php , in that empty division with id "systemTarget", i want to show buttons... like "Sign Up" and "Sign In" if user is not signed in, and "Username" & "Log out" if user isn't signed in.

You'll need some sort of conditional logic in each page where you want the login/sign-out links to appear. This may be a good candidate for something to put into a function so you can call it as/where needed if it will appear on multiple different pages.

"ob" = output buffering, something I personally would not bother with unless you have a specific reason to use it. (It's going to add a little bit of processing/memory overhead which, while probably fairly trivial, why bother if you don't actually need it? (There are valid reasons why you might need it, in which case, no big deal.)

It depends on how you make your website and pages. If you start getting "headers already sent" error messages then you may want to consider using ob_start and ob_end_flush.

If things are well designed and properly configured, you shouldn't get those sorts of errors -- but sometimes if I'm using 3rd-party classes, packages, etc., that are not so well designed, it can be useful to add buffering rather than spending time to fix them.

It can also be useful if you want to compress your output (by using the ob_gzhandler() function as the optional callback parameter in ob_start()).

"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation