![]() |
|
[PHP] Directory traversal and file inclusion problem - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Web Development (https://hackforums.net/forumdisplay.php?fid=183) +---- Thread: [PHP] Directory traversal and file inclusion problem (/showthread.php?tid=3124089) |
Directory traversal and file inclusion problem - trollster - Dec 25, 2012 Hello everyone, I followed Alex's register and login series from PHP Academy. I made one like his just the same way just that my CSS files were different. Now this is my problem. My bootstrap folder contains css, js and img folders. My core folder contains init file, database folder having connect file and functions folder having general functions and user functions files. My includes folder contains the header, footer, navbar and all, along with an overall folder having overall header and overall footer. All the files included above are linked and relative to the index. I created a new folder called forums in the root directory and I put an index file inside it. I just put the path as include '../core/init.php', include '../includes/overall/header.php', etc. Just added two dots to traverse back and then include the files and styles but I am getting all sorts of warnings and errors. I want to create a new folder in the root directory and include all these files, functionality and styles. Please help me do this. Thank You! * - Pillows - Dec 25, 2012 Maybe if you could show us the code in question we could help you better. * - YERANUK - Dec 25, 2012 We can't really help you, witout you telling us what these errors are. The most obvious ones would be your relative paths are incorrect. Try using absolute paths and see if that works out for you. * - trollster - Dec 25, 2012 PHP Code That's my code inside the forums folder placed in the root directory. And these are my errors. Code Warning: include(includes/head.php): failed to open stream: No such file or directory in C:\xampp\htdocs\Study\TestSite\includes\overall\header.php on line 5So the content is displayed but not the styles, not the functionality. May be if you still can't figure out, I will zip the whole folder and give you. Here's the link. http://www.mediafire.com/?4zhfh7r8me95n0w * - badbrains - Dec 25, 2012 (Dec 25, 2012 09:51 PM)trollster Wrote:See that following slash (/includes)? That doesn't work in PHP :( I'm assuming that's why you're getting an error. * - Pillows - Dec 25, 2012 If you add a beginning slash php will think its an absolute path. * - trollster - Dec 25, 2012 Then how do I get rid of the problem? * - Pillows - Dec 25, 2012 Get rid of the beginning slash? So then php will take it as a relative path. * - trollster - Dec 25, 2012 Got the same bunch of errors. Could you please check out the files I put in that link? |