.josh Posted June 12, 2006 Share Posted June 12, 2006 okay so i have a login form that is in /public_html/themes/login.phpand 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? Quote Link to comment https://forums.phpfreaks.com/topic/11802-posting-to-a-script-in-a-different-dir/ Share on other sites More sharing options...
AndyB Posted June 12, 2006 Share Posted June 12, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/11802-posting-to-a-script-in-a-different-dir/#findComment-44720 Share on other sites More sharing options...
poirot Posted June 12, 2006 Share Posted June 12, 2006 When in doubt, use a full URL.They'll work even if it's a different domain ;) Quote Link to comment https://forums.phpfreaks.com/topic/11802-posting-to-a-script-in-a-different-dir/#findComment-44724 Share on other sites More sharing options...
.josh Posted June 12, 2006 Author Share Posted June 12, 2006 problem is that it's not in the www or public_html directories. it is like this:/home/blah/public_html/themes/login.phpwants to post to this:/home/blah/functions/authenticate.php Quote Link to comment https://forums.phpfreaks.com/topic/11802-posting-to-a-script-in-a-different-dir/#findComment-44727 Share on other sites More sharing options...
Buyocat Posted June 12, 2006 Share Posted June 12, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/11802-posting-to-a-script-in-a-different-dir/#findComment-44730 Share on other sites More sharing options...
.josh Posted June 12, 2006 Author Share Posted June 12, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/11802-posting-to-a-script-in-a-different-dir/#findComment-44735 Share on other sites More sharing options...
Buyocat Posted June 12, 2006 Share Posted June 12, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/11802-posting-to-a-script-in-a-different-dir/#findComment-44739 Share on other sites More sharing options...
.josh Posted June 12, 2006 Author Share Posted June 12, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/11802-posting-to-a-script-in-a-different-dir/#findComment-44742 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.