Jump to content


Photo

User have to login


  • Please log in to reply
3 replies to this topic

#1 simple5imon

simple5imon
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 15 September 2006 - 04:10 PM

Ive been searching here but cannot find the coding for this  >:(

I'd like it so, users have to login to gain access to the website pages.
ALSO id like the coding so it shows their name somewhere so they know their logged in!

Hope this is enough info!
Much appreciation  ;)

#2 Wintergreen

Wintergreen
  • Members
  • PipPipPip
  • Advanced Member
  • 107 posts

Posted 15 September 2006 - 04:13 PM

There's a login tutorial on this site that works fine. 

As for making sure they're logged in to view any pages, all you do is make a file called logincheck.php or something, and put this inside
<?
session_start();
if(empty($_SESSION['username'])) {
   header("location: index.php");
}
?>

Then at the top of each page (Except index.php), put this
<?
session_start();
include 'logincheck.php';
?>

This works in conjunction with the login tutorial on the site. 

#3 Wintergreen

Wintergreen
  • Members
  • PipPipPip
  • Advanced Member
  • 107 posts

Posted 15 September 2006 - 04:17 PM

Here's the tutorial:
http://www.phpfreaks...orials/65/0.php

You'll have to change some of the table to fit what you need, which will in turn make it so you need to change some other stuff as well, but it won't be hard.  Since you're doing a site, I doubt you'll have people use their real names, so you don't need a first name or last name, just a username.  Things like that, they're not too hard to watch out for.  Also, you don't need to bother with the marketing stuff, just the membership system. 

#4 simple5imon

simple5imon
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 15 September 2006 - 04:38 PM

Thanks for that Wintergreen, i'll give that a go!  ;)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users