Jump to content
Larry Ullman's Book Forums

Recommended Posts

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

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.

  • Upvote 1
Link to comment
Share on other sites

  • 3 weeks later...

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

 Share

×
×
  • Create New...