SunQuest
 
           General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old October 16th, 2002, 09:49 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 364 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 26 sec
Reputation Power: 6
question about sessions

when you guys are checking to see if sessions exist, how are you doing it?

PHP Code:
if(isset($_SESSION['var'])) 

or
PHP Code:
if(session_is_registered('var')) 


-- Jason

Reply With Quote
  #2  
Old October 16th, 2002, 10:55 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
i dont actually use session variables (not secure enough), but if i was to check if a session variable existed then i would use the following

if(isset($_SESSION['var']))

Ofcourse i have no reason, its just easier to remember, then a huge function call.

Its also probally faster, but im just guessing here.

Reply With Quote
  #3  
Old October 16th, 2002, 11:57 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 364 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 26 sec
Reputation Power: 6
thanks Ben

Reply With Quote
  #4  
Old October 21st, 2002, 03:36 AM
AmericanD AmericanD is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 81 AmericanD User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Ben you said session was not secure enough. I just managed to get over the concept of sessions in my PHP book and the example code. It works ok if we use require once function.

So since you said its not secure enough, can u please tell me what is more secure. cookies ? . and how do we write the code for secure stuff (cookies..) . any examples would be good. ..thanks

Reply With Quote
  #5  
Old October 21st, 2002, 01:32 PM
crazytrain81 crazytrain81 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 232 crazytrain81 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
cookies are pretty simple. to set one
PHP Code:
 setcookie(myCookie,'cookies are yummy!',600000); 

This would create a cookie named myCookie with a value of 'cookies are yummy!' with a timeout of 600 hours. To access a cookie, you can either use the $_COOKIE superglobal array, the $HTTP_COOKIE_VARS global array (which requires you register it as a global variable), or you can just access it as $myCookie. The best of these 3 is the $_COOKIE superglobal array based simply on the fact that's easier to track variables using the superglobals if you can, and code can be confusing when someone else looks at it and can't find where the mysterious cookie variables are coming from =D

Reply With Quote
  #6  
Old October 21st, 2002, 07:47 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
If im going to make a login area, i use the session ID and store it in a database, using a database to handle the loggin/logout data.

Reply With Quote
  #7  
Old October 21st, 2002, 11:53 PM
AmericanD AmericanD is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 81 AmericanD User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
ok Ben i'm going to start implementing just sessions in my first login script but then later on i'll try your idea and if i wont find answers in my book and other places, will get back to you

thanks

Reply With Quote
  #8  
Old October 22nd, 2002, 02:18 AM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
basically you use the session id as a point of refrence, then you store any other details, you want for that session, then to check if they are loged in, you have a function which checks the database.
something like this:

$query = mysql_query("SELECT sessionId from session_table where sessionId=" . session_id());

if(mysql_num_rows($query) => 1)

logged in

else

public user


something like that. that just gives you a basic idea of what to do. I use a few functions to
1. create the login data, and make a loged session,
2. checked if they are loged in
3. create a log file, to see if they are hacking, etc
4. create a function that checks the session table and retrives data, like there username, unique id, first and last names, etc

Reply With Quote
  #9  
Old October 22nd, 2002, 04:01 PM
OKrogius OKrogius is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 8 OKrogius User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally posted by Ben Rowe
i dont actually use session variables (not secure enough), but if i was to check if a session variable existed then i would use the following

if(isset($_SESSION['var']))

Ofcourse i have no reason, its just easier to remember, then a huge function call.

Its also probally faster, but im just guessing here.


OUt of quriosity what do you use for authentication then. Cookies are less secure then sessions.

Reply With Quote
  #10  
Old October 22nd, 2002, 04:24 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 364 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 26 sec
Reputation Power: 6
I think what Ben is saying,...is if you use sessions don't store important information in them, like passwords

maybe I am wrong, I hope Ben elaborates a bit on this

Reply With Quote
  #11  
Old October 22nd, 2002, 04:27 PM
OKrogius OKrogius is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 8 OKrogius User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally posted by Taelo
I think what Ben is saying,...is if you use sessions don't store important information in them, like passwords

maybe I am wrong, I hope Ben elaborates a bit on this


Either way you look at it, you shouldn't store passwords in plain text. Only hashes made by things like md5.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > question about sessions


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway