Google Community
Latest Forums Rules Resources
Custom Search

Go Back   Google Community > Webmaster Forums > Web Design, Coding & Programming Forum

GoogleCommunity Sponsor

Reply
 
LinkBack Thread Tools Display Modes
Old 09-30-2004, 08:51 PM   #1 (permalink)
Senior Googler
 
Join Date: Jul 2004
Location: australia
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
pleasant
Send a message via AIM to pleasant Send a message via MSN to pleasant
members only

how can i amke a page so only logged in people can view it?
pleasant is offline   Reply With Quote
 
Sponsored Links
Old 09-30-2004, 09:47 PM   #2 (permalink)
Senior Googler
 
Join Date: Sep 2004
Location: Bosom of Dixie
Posts: 201
Thanks: 0
Thanked 0 Times in 0 Posts
Ashes
Send a message via ICQ to Ashes Send a message via AIM to Ashes Send a message via MSN to Ashes
Assign a cookie when the person logs in, and then check that cookie's contents when they view the page.

If the user has the cookie, with the right content (password, username, whatever), then they can view the page.

If not, they get served with a page asking them to log in.
Ashes is offline   Reply With Quote
Old 09-30-2004, 10:50 PM   #3 (permalink)
Google Guru
 
Join Date: Jul 2004
Location: India
Posts: 2,399
Thanks: 0
Thanked 1 Time in 1 Post
cvrk3
ashes, i forgot i posted a message of welcome to earlier Your posts are of quality, informative and also enjoyable!! keep it up and you have the ability to get to 10000 posts earlier than me. All the best
cvrk3 is offline   Reply With Quote
Old 09-30-2004, 10:51 PM   #4 (permalink)
Senior Googler
 
Join Date: Sep 2004
Location: Bosom of Dixie
Posts: 201
Thanks: 0
Thanked 0 Times in 0 Posts
Ashes
Send a message via ICQ to Ashes Send a message via AIM to Ashes Send a message via MSN to Ashes
Thank you so much. :)

Additionally I forgot to mention that if you don't want to use cookies, you can also do it with php sessions.
Ashes is offline   Reply With Quote
Old 09-30-2004, 11:59 PM   #5 (permalink)
Senior Googler
 
Join Date: Jul 2004
Location: australia
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
pleasant
Send a message via AIM to pleasant Send a message via MSN to pleasant
im asking how do i do it like the code to put on the page
pleasant is offline   Reply With Quote
Old 10-01-2004, 12:01 AM   #6 (permalink)
Google Guru
 
Join Date: Aug 2004
Location: Toronto, Ontario, Canada.
Posts: 2,395
Thanks: 0
Thanked 0 Times in 0 Posts
Eric
Send a message via ICQ to Eric Send a message via AIM to Eric Send a message via MSN to Eric Send a message via Yahoo to Eric
I think I have a solution...

Well, how you will get the cookie writing to work, you decide, but you can write cookies in the following way:-
Code:
<?PHP
  setcookie("username",$name);
?>
And you can read them using this code:
Code:
<?PHP
  $_COOKIE['username'];
?>
Well you can use the $_COOKIE to display pages only to logged on members like this:
Code:
<?PHP
  if(isset($_COOKIE['username'])
  {
  include "./members.html";
  }
  else
  {
  echo "Sorry you are not logged on!";
  }
?>
Sorry if there are any errors, I just wrote it in a hurry without testing...
Eric is offline   Reply With Quote
Old 10-01-2004, 10:14 AM   #7 (permalink)
Senior Googler
 
Join Date: Sep 2004
Location: Bosom of Dixie
Posts: 201
Thanks: 0
Thanked 0 Times in 0 Posts
Ashes
Send a message via ICQ to Ashes Send a message via AIM to Ashes Send a message via MSN to Ashes
We really shouldn't be coding for you. I'd be glad to help you work out your code and find and fix errors, but I won't write it for you.

If this is something you want to use, then you should either learn the technology or hire someone to do it for you.

If you'd like to learn, then this is the documentation for setcookie.
Ashes is offline   Reply With Quote
Reply

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Similar Threads
Thread Thread Starter Forum Replies Last Post
Hello to all members cashblogs Introduce Yourself 4 11-07-2007 08:57 PM
100 Members intelliot GC Announcements 26 01-02-2006 12:09 PM
Platinum Members andrew247 GC Announcements 5 11-27-2005 10:37 PM
Tip for all members ... DarkMan Chit Chat 0 09-23-2005 07:32 AM


All times are GMT -8. The time now is 05:27 AM.


Powered by vBulletin®
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© 2004–2007 Google Community