Jump to content

Recommended Posts

As I have said in previous posts. I am creating a membership system and am wanting to hide the processing file.

Say a user logs in. The login form posts to process.php?action=login. The problem with this is with the way that I have the errors handled  here is an example.

[code]if(!$_SESSION['username']){
if($error){
echo $error;
include("index.php");
}else{
echo "You are logged in.";
include("../account.php");
  }
    }else{
echo "<html><head><title>Welcomce Back</title></head>Welcome back ". $_SESSION['username'] .".<a href=index.php>Click here</a> to proceed.";
}[/code]

I thought, for a brief moment, that a javascript redirect would be best. After some research I know now that is retarded..lol

I want to hide the process.php from the end user. If there is an error the login.php is included with the echoed error and the user sees the process.php in there browser. I would rather redirect them back to the login.php file and use an if statement to print what ever error there may be.

Also, I want to do the same thing with a sucessful login. I want to redirect the user to account.php

At first, I thought using some if statements with header() would be best. This will work fine for the error handling. Here is a brief example

[code]  if ($error=='username') {
  header('Location: http://www.owpt.biz/home/login.php?showerror=username');
} else ($error=='password') {
  header('Location: http://www.owpt.biz/home.login.php?showerror=password');
} [/code] [b]Note[/b] untested.

However, after further research it would make it difficult for me to pass session variables this way for a sucessful login. This is what the manual had to say about this issue

[code]Note: Session ID is not passed with Location header even if session.use_trans_sid is enabled. It must by passed manually using SID constant.[/code]

Now I am looking for a better way of acheiveing this. Any suggestions would be great.

Link to comment
https://forums.phpfreaks.com/topic/13721-hiding-a-backend-processing-file/
Share on other sites

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.