Jump to content

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?



Link to comment
https://forums.phpfreaks.com/topic/11802-posting-to-a-script-in-a-different-dir/
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.
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.
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.
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?
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.