views:

60

answers:

2

Greetings: I am trying to pass a parameter from one page into another one. How do I do this? Is there a way when someone logs into the application, I do not want them to log in twice. I want the other page to know that this user is already logged in and give him or her OK to use the other page. This is just to prevent multiple log ins.

I appriciate any help I can get on this isue.

Best Regards, David Ramezani

A: 

Agree w/Jacob: Add a flag to the session to show that the user is logged in. You can access that session variable from any page that the user accesses until they log out or close the browser.

morganpdx
In PHP, you start a session by using <?php session_start()?> More information: http://stackoverflow.com/questions/3544217/what-happens-if-i-dont-call-session-start
morganpdx
A: 

WordPress handles this for you by setting 2 cookies when you log in:

When you log into WordPress from http://example.com/wp-login.php, WordPress stores the following two cookies:

Your user name

A double-hashed copy of your password

WordPress uses the two cookies to bypass the password entry portion of wp-login.php. If WordPress recognizes that you have valid, non-expired cookies, you go directly to the WordPress Administration interface. If you don't have the cookies, or they're expired, or in some other way invalid (like you edited them manually for some reason), WordPress will require you to log in again, in order to obtain new cookies. http://codex.wordpress.org/WordPress_Cookies

If you want to use the data else where with WordPress you can use the is_user_logged_in conditional statement:

<?php
if ( is_user_logged_in() ) {    echo 'Welcome, registered user!';} else {    echo 'Welcome, visitor!';};?>
Chris_O