| |
pleasant Senior Googler


Joined: 31 Jul 2004 Location: australia 1094.80 GC$
Items
|
Posted: Thu Sep 30, 2004 8:51 pm Post subject: members only |
|
|
|
how can i amke a page so only logged in people can view it? _________________
 |
|
| Back to top |
|
|
Ashes Senior Googler


Joined: 26 Sep 2004 Location: Bosom of Dixie 1601.05 GC$
Items
|
Posted: Thu Sep 30, 2004 9:47 pm Post subject: |
|
|
|
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. _________________ This is a sig. Isn't it nice?
pushing through [dot] com |
|
| Back to top |
|
|
cvrk3 Google Guru

Joined: 05 Jul 2004 Location: India 16443.40 GC$
Items
|
Posted: Thu Sep 30, 2004 10:50 pm Post subject: |
|
|
|
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  |
|
| Back to top |
|
|
Ashes Senior Googler


Joined: 26 Sep 2004 Location: Bosom of Dixie 1601.05 GC$
Items
|
Posted: Thu Sep 30, 2004 10:51 pm Post subject: |
|
|
|
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. _________________ This is a sig. Isn't it nice?
pushing through [dot] com |
|
| Back to top |
|
|
pleasant Senior Googler


Joined: 31 Jul 2004 Location: australia 1094.80 GC$
Items
|
Posted: Thu Sep 30, 2004 11:59 pm Post subject: |
|
|
|
im asking how do i do it like the code to put on the page _________________
 |
|
| Back to top |
|
|
Eric Better than you


Joined: 12 Aug 2004 Location: Toronto, Ontario, Canada. 2491.35 GC$
Items
|
Posted: Fri Oct 01, 2004 12:01 am Post subject: 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... _________________ "A lie gets halfway around the world before the truth has a chance to get it's pants on." - Winston Churchill
Last edited by Eric on Fri Oct 01, 2004 8:59 pm; edited 1 time in total |
|
| Back to top |
|
|
Ashes Senior Googler


Joined: 26 Sep 2004 Location: Bosom of Dixie 1601.05 GC$
Items
|
Posted: Fri Oct 01, 2004 10:14 am Post subject: |
|
|
|
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. _________________ This is a sig. Isn't it nice?
pushing through [dot] com |
|
| Back to top |
|
|
Sponsored Links
|
Posted: 5 Dec 2008 9:06 am Post subject: Advertisements |
|
|
|
|
|
|
| Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Host your free forums with Invision Plus.net forum web hosting with your own subdomain.
alexisBlue v1.2 // Theme Created By: Andrew Charron // Icons in Part By: Travis Carden
|
|
|
|
|