Title: use login data for php $_SESSION
Last modified: August 22, 2016

---

# use login data for php $_SESSION

 *  [balux](https://wordpress.org/support/users/balux/)
 * (@balux)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/use-login-data-for-php-_session/)
 * Hi, I want to use the login data of a user to create a php session (to protect
   some pages basically).
    I saw some functions like get_userdata or get_currentuserinfo
   but I’m not sure what’s the difference between these 2. Also I could not find
   examples around. Can anyone tell me what’s the best way to proceed? thanks B.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [11 years, 6 months ago](https://wordpress.org/support/topic/use-login-data-for-php-_session/#post-5523816)
 * Is it the whole WordPress installation or just specific posts you wish to protect?
 * The reason I’m asking is that you can lock down the whole installation using 
   a plugin for authenticated users or just password protect the posts.
 * [https://wordpress.org/plugins/search.php?q=member](https://wordpress.org/plugins/search.php?q=member)
 * [http://codex.wordpress.org/Using_Password_Protection](http://codex.wordpress.org/Using_Password_Protection)
 * That may be easier than using `$_SESSION` and likely safer too.
 *  Thread Starter [balux](https://wordpress.org/support/users/balux/)
 * (@balux)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/use-login-data-for-php-_session/#post-5523932)
 * Hi, thanks.
    no, it’s just some pages of the website that I wrote (to manage 
   the db) Once the admin will be logged in, there will be a link in the footer 
   to the home page of the db section..I’d like to start a session with the same
   data the admin used to log into wp (otherwise I have to do another login page
   for the db section)..Hope I was clear

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘use login data for php $_SESSION’ is closed to new replies.

## Tags

 * [login](https://wordpress.org/support/topic-tag/login/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [session](https://wordpress.org/support/topic-tag/session/)
 * [user](https://wordpress.org/support/topic-tag/user/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [balux](https://wordpress.org/support/users/balux/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/use-login-data-for-php-_session/#post-5523932)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
