Current location: Hot Scripts Forums » Programming Languages » PHP » Suggestions on logins...I'm lost


Suggestions on logins...I'm lost

Reply
  #1 (permalink)  
Old 12-30-03, 06:47 PM
mdhall's Avatar
mdhall mdhall is offline
Aspiring Coder
 
Join Date: Oct 2003
Posts: 510
Thanks: 1
Thanked 1 Time in 1 Post
Suggestions on logins...I'm lost

I'm setting up a program and am stuck on the member log in area. I can't seem to set up sessions on my home puter system for some reason. I'd like some suggestions on this, if anyone is interested in helping out. The link below will go to a page to explain what I need to set up, and maybe give you a better idea of how I can get this going. I'm totally stuck. I'm sure someone can give me an idea of how to go about this in the best way as far as what I need to do. Thnx.

http://www.mdhwebdesign.com/FPCPro/fpc_help.php
Reply With Quote
  #2 (permalink)  
Old 12-31-03, 02:09 AM
blaw's Avatar
blaw blaw is offline
Junior Code Guru
 
Join Date: Dec 2003
Location: Vancouver, BC, Canada
Posts: 550
Thanks: 0
Thanked 0 Times in 0 Posts
Hi there,

I went to the link you gave, but all I can say is to start a session, you need to have

Code:
session_start();
and NOT what you said in the above link (missing underscore _ ):

Code:
session start();
Other than that, I am not sure exactly what kind of errors/symptoms you are getting. After starting a session and assign (or register, whatever) the values to $_SESSION array, try print_r($_SESSION) to see if they have been really assigned. If not, try eching session_id() to see if the session has even been started, etc. That way you can start narrowing down your problem.

Also, if you post your code here, I or someone else can take a look and that may be faster sometimes.

By the way, you had me laugh when you said "baby in a strip bar" (no offence, of course. It's just so funny). =)

Good night.
__________________
Blavv =|
Reply With Quote
  #3 (permalink)  
Old 12-31-03, 09:50 AM
mdhall's Avatar
mdhall mdhall is offline
Aspiring Coder
 
Join Date: Oct 2003
Posts: 510
Thanks: 1
Thanked 1 Time in 1 Post
I'll attach the code I've been trying to use. What happens is, I can register as a member, and log in. Once done, I get to a basic welcome page which shows my username, gives 2 links to go to, and a logout option. However, if I click on a link or logout, I get the message that I'm not logged in, even though it originally showed my username after logging in. This is happening on all the scripts I try...either it doesn't hold a session, or the session never starts, or who knows what is happening. I'm ready to say the Hell with it..every tutorial or script is different and just leads to confusion.
Attached Files
File Type: txt login.txt (11.6 KB, 161 views)
Reply With Quote
  #4 (permalink)  
Old 12-31-03, 12:59 PM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
one thing to know about sessions ...
ALWAYS add session_start() in all your pages if you want to use them ..
maybe that's the problem ..
don't depend on requiring that check_login.php to start the session in all your pages .. because the session may not start for some reasons and you wouldn't notice if you turned the errors off ..
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]

Last edited by NeverMind; 12-31-03 at 01:02 PM.
Reply With Quote
  #5 (permalink)  
Old 12-31-03, 01:38 PM
mdhall's Avatar
mdhall mdhall is offline
Aspiring Coder
 
Join Date: Oct 2003
Posts: 510
Thanks: 1
Thanked 1 Time in 1 Post
I am using session_start() at the very beginning of each page, however it simply isn't working. Its like it will take the session to the welcome page and show my username, but when clicking on the other links, I'm told I'm not logged in.
Reply With Quote
  #6 (permalink)  
Old 12-31-03, 02:45 PM
fusian fusian is offline
Newbie Coder
 
Join Date: Oct 2003
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by mdhall
I am using session_start() at the very beginning of each page, however it simply isn't working. Its like it will take the session to the welcome page and show my username, but when clicking on the other links, I'm told I'm not logged in.

have you tried setting the session and storing it as a cookie?
__________________
------------------
Fusian
www.efusian.co.uk
mail@efusian.co.uk
------------------
Linux Disks and Open Source Software is Available in our eStore now! Checkout at http://www.efusian.co.uk
Reply With Quote
  #7 (permalink)  
Old 12-31-03, 02:48 PM
mdhall's Avatar
mdhall mdhall is offline
Aspiring Coder
 
Join Date: Oct 2003
Posts: 510
Thanks: 1
Thanked 1 Time in 1 Post
Thats where I'm lost..I dont know whats causing this or what I need to add to make this work. I've read about using cookies, not using cookies, putting sessons into a temp folder, putting them in mysql...ready to pull my hair out and give up on it.
Reply With Quote
  #8 (permalink)  
Old 12-31-03, 02:56 PM
fusian fusian is offline
Newbie Coder
 
Join Date: Oct 2003
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by mdhall
Thats where I'm lost..I dont know whats causing this or what I need to add to make this work. I've read about using cookies, not using cookies, putting sessons into a temp folder, putting them in mysql...ready to pull my hair out and give up on it.

HEHE, coding can be like that, but when it eventually works you'll feel why you put yourself through it! It's always worth it in the end.

The easiest way is cookies, if your getting a little out of your depth, then I'd advise treading water and sticking with one method, forget the rest for now - you don't need the extra thinking stress.

Ok, think about it logically, find you need to establish a session, and setup the session variables. Once you have done this, your need to set a cookie and store the session data in there.

When logging out, all you need to do is destroy the session and unset the cookie.
__________________
------------------
Fusian
www.efusian.co.uk
mail@efusian.co.uk
------------------
Linux Disks and Open Source Software is Available in our eStore now! Checkout at http://www.efusian.co.uk
Reply With Quote
  #9 (permalink)  
Old 01-01-04, 02:06 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
maybe it's a problem in your browser after all
can you run it online and let me test it ?
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]

Last edited by NeverMind; 01-01-04 at 02:11 AM.
Reply With Quote
  #10 (permalink)  
Old 01-01-04, 09:13 AM
mdhall's Avatar
mdhall mdhall is offline
Aspiring Coder
 
Join Date: Oct 2003
Posts: 510
Thanks: 1
Thanked 1 Time in 1 Post
Quote:
Originally Posted by NeverMind
maybe it's a problem in your browser after all
can you run it online and let me test it ?
I set up up, go to "register" and give it a shot.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Suggestions and ideas for Content management livingwithadd PHP 5 11-14-03 04:38 AM
Thoughts & suggestions appreciated mdhall Website Reviews 0 11-11-03 12:02 PM
HotScripts.com Member Logins relledge Announcements 0 08-08-03 05:35 PM
newbie seeking suggestions cassady PHP 2 07-02-03 02:48 PM
Lost listings? raz0 Hot Scripts Forum Questions, Suggestions and Feedback 6 06-22-03 09:47 AM


All times are GMT -5. The time now is 07:49 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.