Jump to content

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)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.