Part of the EllisLab Network
   
1 of 2
1
RA_Session - Version 2.3 Updated
Posted: 20 February 2008 08:22 PM   [ Ignore ]  
Grad Student
Avatar
Rank
Total Posts:  68
Joined  02-13-2008

http://codeigniter.com/wiki/RA_session/
Finally got to updating it again.

* Native PHP Session library
* including two main features
* Persistant Login (Able to set the session length on a per session basis)
* Remember Me (Set 1 variable to remember, normally a username)

* Update-Log
* Version 2.1
* Session expiry is renewed each time a new page is loaded (Reduces the need for a regnerate session function to be run)
* Cookie for persistant session now reflects your base session name with _persist
* Code was cleaned up (there were a few 1=1 statements)
* Productive comments Added
* Less coffee was drank - although was not completed remove.  I make no warrenty against coffee stains found in this code

Everything I’m doing with RA_Session is to be compatible with my RA_Auth library, more to come on that later.

Biggest BONUS with this version is that the session cookie now automatically updates it’s expiry time on each page load.

Enjoy

 Signature 

RapidHosting.com.au
Affordable and Reliable Aussie server hosting

Profile
 
 
Posted: 20 February 2008 10:05 PM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  437
Joined  12-13-2007

Looking sweet as - one thing you need so I can convert is flashdata!

 Signature 

PX Webdesign | The Lab | Personal Blog

Profile
 
 
Posted: 20 February 2008 10:37 PM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  660
Joined  06-07-2007

this would be great with flashdata…

 Signature 

CodeExtinguisher
Download: codex2_rc14.2.zip - 219 KiloBytes of Gloriousness!
Demo: Public preview - login with preview:preview
Temporary Docs: PBWiki

Profile
 
 
Posted: 20 February 2008 10:46 PM   [ Ignore ]   [ # 3 ]  
Grad Student
Avatar
Rank
Total Posts:  68
Joined  02-13-2008

/sigh

Okay okay okay. lol - I’ll do a nasty little hack and get it together for you.  You both will have to test it though - I don’t have any applications that have a use for it at this stage....

 Signature 

RapidHosting.com.au
Affordable and Reliable Aussie server hosting

Profile
 
 
Posted: 20 February 2008 11:27 PM   [ Ignore ]   [ # 4 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  437
Joined  12-13-2007

You will once you start using it raspberry

Just don’t forget to ‘sweep’ wink

 Signature 

PX Webdesign | The Lab | Personal Blog

Profile
 
 
Posted: 21 February 2008 06:53 AM   [ Ignore ]   [ # 5 ]  
Grad Student
Avatar
Rank
Total Posts:  68
Joined  02-13-2008

Go for gold guys - V2.2 has the same flash functions as the native session library that comes with CI.

It was a simple drag/drop code copy - the functions use set_userdata which encodes data into the session as required etc.

Let me know how you go guys smile

 Signature 

RapidHosting.com.au
Affordable and Reliable Aussie server hosting

Profile
 
 
Posted: 21 February 2008 09:05 AM   [ Ignore ]   [ # 6 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  660
Joined  06-07-2007

make sure you give credit though

 Signature 

CodeExtinguisher
Download: codex2_rc14.2.zip - 219 KiloBytes of Gloriousness!
Demo: Public preview - login with preview:preview
Temporary Docs: PBWiki

Profile
 
 
Posted: 21 February 2008 09:12 AM   [ Ignore ]   [ # 7 ]  
Grad Student
Avatar
Rank
Total Posts:  68
Joined  02-13-2008
jTaby - 21 February 2008 09:05 AM

make sure you give credit though

Duly noted and actioned (Reinforced that the FLASHDATA code is not my own, taken direct from CI)

 Signature 

RapidHosting.com.au
Affordable and Reliable Aussie server hosting

Profile
 
 
Posted: 25 February 2008 09:11 AM   [ Ignore ]   [ # 8 ]  
Summer Student
Total Posts:  7
Joined  03-14-2007

Love the library, particularly the persistent sessions, however if I set session data using $this->ra_session->set_userdata(array(’user_id’=> 1)

calling any of the functions to clear this data doesn’t seem to work

in my logout function i have:

$this->ra_session->unset_userdata;
$this->ra_session->persistant_session(FALSE);
$this->ra_session->sess_destroy;

but even after successfully calling this function, the userdata is still assigned and the cookie still exists...am I just being a numpty and missing something?

Profile
 
 
Posted: 25 February 2008 09:28 AM   [ Ignore ]   [ # 9 ]  
Grad Student
Avatar
Rank
Total Posts:  68
Joined  02-13-2008

I’ve probably missed something.

Joe thank you for your time to look at this.  I’ll investigate now and see what’s happening.  Will be back shortly with a response.

Cheers,
Darren

 Signature 

RapidHosting.com.au
Affordable and Reliable Aussie server hosting

Profile
 
 
Posted: 25 February 2008 10:07 AM   [ Ignore ]   [ # 10 ]  
Grad Student
Avatar
Rank
Total Posts:  68
Joined  02-13-2008

Found my error.  First I thought my if statements where all screwy (which they were, I don’t like using elseif statements everywhere but it appears I did).

Secondly, is something I’m not fulling grasping (I’ll grab that coffee).

In the function persistant_session - the following statement is used to determine if the user is just checking to see if it’s there.

if ($time_to_stay_active == '' OR $time_to_stay_active == NULL) {

Where in actual fact - I should possibly be using === (checks that the variables are the same type, not just the equal the same).  This is a first for me actually… Previously I must have constructed my functions in such a way that the ‘’ and NULL statements were always last.

Anyway - I was going to use is_null() but according to a little script I ran from james (who posted on PHP) suggested that === is 30x faster than using is_null. And I confirm - spot on james!

I shall adjust my functions now - and give you an update very shortly.

Cheers,

Ps: You don’t need to unset the userdata anymore - it’s not done for you.  I saw that if it’s not handled by the sess_Destory function - which the session itself holds the correct value (nothing) on destroying it - the array userdata still does for one more page.  Again, thanks for your help smile

 Signature 

RapidHosting.com.au
Affordable and Reliable Aussie server hosting

Profile
 
 
   
1 of 2
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 61066 Total Logged-in Users: 16
Total Topics: 73889 Total Anonymous Users: 0
Total Replies: 398542 Total Guests: 327
Total Posts: 472431    
Members ( View Memberlist )
Newest Members:  KarnadvdconsultingindispusTelder4336dudeami0Dale-M Moeen uddinbnolenstanjadebieSan2k