Affiliate Marketing
Forum Search

Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)  
Old 16-08-06
Wardy's Avatar
This is the one
 
Join Date: Aug 2003
Posts: 2,747
Thanks: 14
Thanked 0 Times in 0 Posts
Wardy is an unknown quantity at this point
  php session login pages not hidden

As I seem to be getting quick answers to problems on here rather than some other coding specific forums I thought I'd post my latest problem up here incase anyone has any answers

I have a site that users have to log into to view their own members area.
The site uses sessions so when a user logs in the pages such as www.mysite.com/account.php show the users details.
However, if someone is NOT logged in and they just go to www.mysite.com/account.php they can still view the whole page but with all the bits that contain a users details are empty.

How do I make it so that these pages are not able to be viewed when a user is not logged in and that the user get's prompted to enter their username and password to login and view it properly?

Is it simply a case of do an "if session value = 0 then display log in box"?

Cheers
Wardy
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 16-08-06
Registered User
 
Join Date: Mar 2004
Location: Reading, UK
Posts: 301
Thanks: 0
Thanked 0 Times in 0 Posts
dmorison is an unknown quantity at this point
Normally, you simply inspect one of your session variables (for example a user ID) at the top of the script; and if it is not set issue a header() to redirect the user to the login page. For example, if userID is one of your session variables:

PHP Code:
<?php
  
if (!$HTTP_SESSION_VARS["userID"])
  {
    
header("Location: /login.php");
    exit();
  }
  
// .... rest of script ....
?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 16-08-06
Wardy's Avatar
This is the one
 
Join Date: Aug 2003
Posts: 2,747
Thanks: 14
Thanked 0 Times in 0 Posts
Wardy is an unknown quantity at this point
Nice one mate, that appears to be working a treat.

Cheers
Wardy
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 16-08-06
Northern Monkey's Avatar
Member
 
Join Date: Jan 2004
Location: UK
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Northern Monkey is an unknown quantity at this point
I agree with the posting, that's what I use on my own sites.
__________________
Holiday Villa In<br>
<font size=2>If it moves, kick it. If it doesn't move, kick it till it moves and hen kick it because it moved</font>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting PHP to run on HTML pages scifind Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 13 28-02-07 12:13 PM
Seach Engine Optimisation FAQ [Jan2006] thetafferboy Organic Google Search Optimisation 2 09-01-06 05:11 PM
Whats the correct way to change pages? tomj Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 1 25-06-04 10:20 PM
more pages added getvisible Organic Google Search Optimisation 1 27-01-04 02:50 PM
Spidering of PHP generated pages jokes4mobiles Organic Google Search Optimisation 0 19-09-03 03:17 AM


Affiliate Marketing RSS Feeds - Contact Us - Affiliate Marketing - Archive - Privacy Statement - Top

Content Relevant URLs by vBSEO 3.2.0 RC7