Solved

Post to page above wwwroot directory

Posted on 2009-04-14
3
294 Views
Last Modified: 2013-12-13
Hello,

I have created a php page that I would like to POST to a second php script that lives above the root web directory for security reasons. The page living above web root will then interface with a db file and redirect back to a final landing page. However upon submitting the form, a 404 error is displayed and I notice the url shows as looking for the second script page under web root. This sort of thing works on the old non php hosted website so what am I missing? Worth noting is that on both sites I have ftp access to the above web root directories.
0
Comment
Question by:bnrtech
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 34

Accepted Solution

by:
Beverley Portlock earned 500 total points
ID: 24140619
I presume you are attempting to send Apache to this external page via a form action or a header directive?

The only effective way to do this is to "include" or "require" the page outside the web directory into a script that is accessible within the web root. Let us say that "outside.php" is outside the webroot and "inside.php" is inside it then something like this

// inside.php
//
if ( isset( $_POST['submit'] ) ) {
   
    include "outside.php";

}

<form action='inside.php' method='post'>
..... code
<input name='submit' type='submit' value='Do something' />
</form>
0
 
LVL 34

Expert Comment

by:Beverley Portlock
ID: 24140635
" This sort of thing works on the old non php hosted website so what am I missing? "

I forgot to comment on this. It could be that the old site "included" the external folder via a symbolic link or that the webroot was higher up than you thought. It sounds like security is better on your new server.
0
 

Author Closing Comment

by:bnrtech
ID: 31569939
Works like a charm and security is intact, thanks!
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
php hashing methods 3 50
sitemap.xml 3 32
Script or automated way to Download JPG's off a web site 5 21
Why are my javascript files being read from cache 11 12
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question