Jump to content

Archived

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

.josh

posting to a script in a different dir

Recommended Posts

okay so i have a login form that is in /public_html/themes/login.php

and in it i have a simple little form like so:
[code]
<form action='/home/blah/functions/authenticate.php' method='post'>
   Email <input name='User_Email' type="text" size="3" class="login">
   Pw <input name='User_Pw' type="password" size="3" class="login">
   <input type="submit" value=">>">
</form>
[/code]

so as you can see by the action i'm trying to post the variables to a file that is not in /public_html/...

however, when i click on the submit button, i get a 404 error. Now I know that the file really is there and it is spelled correctly, etc.. so what i need to know is if I am simply not using the correct path (and if not, then how do i do it right) or if it is even possible to post data like this?



Share this post


Link to post
Share on other sites
It's all relative ... whenever I want to quickly get the .. and the / sorted out, I use the feature in my editor to let me link to another script and navigate there. Once I have the right relative link to the file I want, it's obvious how to use it.

Share this post


Link to post
Share on other sites
When in doubt, use a full URL.

They'll work even if it's a different domain ;)

Share this post


Link to post
Share on other sites
problem is that it's not in the www or public_html directories. it is like this:

/home/blah/public_html/themes/login.php

wants to post to this:

/home/blah/functions/authenticate.php

Share this post


Link to post
Share on other sites
If you want to check to see whether you're path is correct or not I suggest trying to echo $_SERVER['DOCUMENT_ROOT'] which will let you know what you need. If you're in the right path but it still isn't working check for the files ownership, I think in this case it needs to be accessible by nobody. Finally it might be worth talking to your host if you haven't done this before because I don't think I can run files outside of my public_html, at least last attempt ended in failure...

One more thing, it may not be worth using a function outside your public in this case becaues you'll be revealing to anyone who wants to "view code" your page what your directory structure looks like.

Share this post


Link to post
Share on other sites
i can include the file no problem. i include files in this exact manner. in fact, that's why i used that path in my action, because i can include the file using that path, and it works. so i thought i could post to it just the same. obviously i can't. so what i need to know is, if there is some alternate path i must use to post to it, or if it is not possible to do this at all.

Share this post


Link to post
Share on other sites
Why not post to a dummy page, something like form_data.html in your public directory, thereby avoiding the problem of giving snooping users a glimpse of your structure and then have that page grab the post data and set it to a session or something, then redirect or include the page you really want?

Share this post


Link to post
Share on other sites
well i figured out the answer. The answer is no, you cannot post to a file that is on the same level or under the public_html directory.

p.s.- i already had a workaround for it i was just curious if it was possible.

Share this post


Link to post
Share on other sites

×

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.