New to php and starting to feel way in over my head. Please help, point me in the right direction here. How do i create a new folder with a index.html like (www.mydomain.com/NEWUSER/index.html) when a user registers for my site and have it do live check for AVAILABILITY?
I want to give my users a unique url for there profile. how then do i automate the creation of x.com/newuser/index.html and write it with the users input from my database at the same time?
User registration question
Moderator: General Moderators
- greyhoundcode
- Forum Regular
- Posts: 613
- Joined: Mon Feb 11, 2008 4:22 am
Re: User registration question
Code: Select all
// Testing if the directory exists
if (file_exists($dirPath))
{
// Already taken
echo 'Please choose a different name...';
}
else
{
// Available
if (mkdir($dirPath))
echo 'New directory created';
else
echo 'Unable to create the directory';
}An alternative approach that might interest you would be that, instead of creating physical directories on the filesystem, you make use of URL rewriting and keep it all in the database. All you would then need is a single view file or template for the profile page.