Dark Prince Posted October 19, 2011 Share Posted October 19, 2011 Ok seems like the world wide web is starting to go the way of folders so I want to keep with the trend, in my script folders are created using the mkdir function then an index file pertaining to that type of folder is copied from another existing folder. Now what I need to do is get the new folders name to be used as a value in php for that index file that was just copied to it, to know where from the database to get its information instead of having www.website.com/page.php?someid=whatever I want to have www.website.com/folder Link to comment Share on other sites More sharing options...
Craig-UK Posted October 19, 2011 Share Posted October 19, 2011 To make this work you don't actually have to create folders. You can trick the URL for it to look like it's accessing a folder using .htaccess RewriteEngine on RewriteBase / RewriteRule ^([A-Za-z0-9]+)/?$ page.php?folder=$1 I think that is all you need, but someone might need to correct it. Simply get that page.php script to read from the database and show the required info. If you do need to create folders then to get the value, save the folder name when creating it by either giving it a value and passing it through the script or giving a session it's value. Although these aren't the best of ways. Hopefully I understood your question correctly as it's quite vague. 1 Link to comment Share on other sites More sharing options...
Dark Prince Posted November 4, 2011 Author Share Posted November 4, 2011 not exactly what im looking for, i need to use the getcwd function then strip everything but the folder name and make it a value, the reason is when someone signs up a folder is created with there username and an index file is copied to it, now that index file needs to know what user info to pull from the database by using the foldername this way that page can be loaded without having to follow links or sending information through the server or browser and can be accessed through the address bars. Link to comment Share on other sites More sharing options...
Dark Prince Posted November 5, 2011 Author Share Posted November 5, 2011 I'm thinking of using the array_pop(explode"/", getcwd)) would this work and what's the best way of using it? Link to comment Share on other sites More sharing options...
Larry Posted November 7, 2011 Share Posted November 7, 2011 If I understand you correctly, pathinfo() is probably the right function to use. Link to comment Share on other sites More sharing options...
Recommended Posts