Web Design Forum: Logging in/out users - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Logging in/out users Rate Topic: -----

#1 User is offline   daniel7912 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 207
  • Joined: 24-February 10
  • Reputation: 1
  • Gender:Male
  • Location:Wisbech, Cambridgeshire
  • Experience:Intermediate
  • Area of Expertise:Designer/Coder

Posted 15 March 2010 - 09:40 AM

Hi,

I've been following this tutorial: http://www.phpeasyst...opview.php?id=6

and have kind of managed to create a simple logging in function to my website.

But, when I try to log in and include the code:

if(!session_is_registered(myusername)){
header("location:index.php?user_ID=$user_ID");
}


I get the following error messages, and the page doesnt display anything apart from the errors:

Notice: Use of undefined constant myusername - assumed 'myusername' in C:\wamp\www\new_portfolio\login_success.php on line 11

Deprecated: Function session_is_registered() is deprecated in C:\wamp\www\new_portfolio\login_success.php on line 11


How can I fix this?

Thanks for any help.
0

#2 User is offline   daniel7912 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 207
  • Joined: 24-February 10
  • Reputation: 1
  • Gender:Male
  • Location:Wisbech, Cambridgeshire
  • Experience:Intermediate
  • Area of Expertise:Designer/Coder

Posted 15 March 2010 - 09:50 AM

View Postdaniel7912, on 15 March 2010 - 09:40 AM, said:

Hi,

I've been following this tutorial: http://www.phpeasyst...opview.php?id=6

and have kind of managed to create a simple logging in function to my website.

But, when I try to log in and include the code:

if(!session_is_registered(myusername)){
header("location:index.php?user_ID=$user_ID");
}


I get the following error messages, and the page doesnt display anything apart from the errors:

Notice: Use of undefined constant myusername - assumed 'myusername' in C:\wamp\www\new_portfolio\login_success.php on line 11

Deprecated: Function session_is_registered() is deprecated in C:\wamp\www\new_portfolio\login_success.php on line 11


How can I fix this?

Thanks for any help.


Ahh I think I may have fixed my own problem...I replaced the if session_is_registered part with 'if(isset($_SESSION['myusername']))' and it seems to be working OK now.
0

#3 User is offline   webdesigner93 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,976
  • Joined: 22-September 09
  • Reputation: 222
  • Gender:Male
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 15 March 2010 - 06:30 PM

View Postdaniel7912, on 15 March 2010 - 09:50 AM, said:

Ahh I think I may have fixed my own problem...I replaced the if session_is_registered part with 'if(isset($_SESSION['myusername']))' and it seems to be working OK now.


You can also just write it like this

if($_SESSION['myusername']){


}


0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users