Jump to content

[SOLVED] Members Access only HELP


tecmeister

Recommended Posts

its a script that only allows members into an area..

 

 

 

 

 

 

 

okay on your login section you probably set a session,

ie

<?php
session_start();
$_SESSION['UserID'] = 10;//the user id

 

Logout removes its

<?php
session_start();
$_SESSION['UserID'] = 0;//the user id
session_destroy();

 

 

members only checks it

<?php
session_start();
if(empty($_SESSION['UserID']));
{
die("No access, please login first");
}
echo "welcome";

 

 

It is saying:

No access, please login first

 

The login part in on my index.html then it goes to checklogin.php then goes to index.php

 

I put nothing in the first page.

 

Then i put on checklogin:

<?php

session_start();

$_SESSION['UserID'] = 10;//the user id

?>

 

And on index.php i put:

 

<?php

session_start();

if(empty($_SESSION['UserID']));

{

die("No access, please login first");

}

echo "welcome";

?>

 

Is there somthing that i have done wrong?

 

Much appreciated for you help.

would probably need to see more of the code, but i am off to bed..

check that session_start(); is at the start of the code.

 

if you go back to my last post and create 3 files

login.php, members.php & logout.php

with their code

and then goto members.php (it should fail)

then login.php then back to members.php (should load)

 

you say you put the members.php code on the index.php page.. does this page check the login?

if so you should have another page to login, and a different page for members only (well for this example anyway)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.