I have created some access controlled pages which can be viewed only after logged in. I had to create another page which holds a form where the user is going to fill the details and submit it. But am not able to connect page A to page B so that the user is still logged in.
I try to add the codes that I used in the access controlled pages to the Page B which has a form. But then the page shows internal error 500.
The code that I am using on the access controlled pages is
<?PHP
require_once("./include/membersite_config.php");
if(!$fgmembersite->CheckLogin())
{
$fgmembersite->RedirectToURL("login.php");
exit;
}
?>
When I try to use the same for the Page B which has a form for submission, it doesn't work.
Something is conflicting.
Here is the code on the Page B that works perfectly when the user goes from Page A to page B. But the USER is not logged in on Page B when moving from page A to page B
. I want to show Logged in as "User" on Page B also.
<?PHP
require_once("./separate/include/fgcontactformuser.php");
require_once("./separate/include/captcha-creator.php");
$formproc = new FGContactForm();
$captcha = new FGCaptchaCreator('scaptcha');
$formproc->EnableCaptcha($captcha);
$formproc->AddRecipient('mail.com'); //<<---Put your email address here
$formproc->SetFormRandomKey('H04uLRJh4CY5sR4');
if(isset($_POST['submitted']))
{
if($formproc->ProcessForm())
{
$formproc->RedirectToURL("PageB.php");
}
}
?>
I want the following on the page B
IT should be accessible only when logged in. So when I try to use the code in the blue on the Page B, it does not work. Why
Secondly, the user should be able to submit the form successfully on Page B.
Right now the user is able to submit the form on page B, but he is not logged in.
Please help with this.........
Page A to page B - connect the pages as logged in
Moderator: General Moderators
Re: Page A to page B - connect the pages as logged in
Since you haven't shown us any code that does the logging in or checks for logging in, there's no way to know how it's being done. If you want to post more of your code, PLEASE be sure to use the "PHP Code" button to surround your code with
Code: Select all
tags for readability. Basically, sessions are used to maintain a logged-in state as long as a viewer doesn't close his or her browser. You may want to read this:
http://dhost.info/forums/index.php?topic=11676.0