Log in

View Full Version : How to create a user registration page and copy files once registered?



bouncer
01-29-2011, 10:14 PM
Hi all , I'm new here.

K so I am creating a site for people to be able to have their own portfolios to showcase their works (images which they upload)

I have the jquery files which is the system to show the works. What I need is to create a user registration so that when someone registers, they enter their:

1. Pick A Username portfolio.com/username

2. Choose A Password

3. Retype Your Password

4. Enter A Valid Email Address

After they click submit, an email is dispatched to them with an activation link. They activate their account. Once they do. ( By the way this all works on a MYSQL database)

Once they activate their account, the site would copy the files from directory:

/home/user/hidden/FILES HERE
to
/home/user/public_html/USERNAME

How would I go about accomplishing this?

Thanks in advance.

EDIT: You can see a similiar site here: http://yourprofolio.com/start
Now thinking about it, to save space it would actually be better if someone could help me out on how to make it so that the portfolios are all hosted from one folder, meaning the system files are in one folder, but the image files for each user are still in their own folders. because copying the portfolio system files to each folder would probably take too much space eventually. So somehow linking it to one folder, yet hosting the images independently on sub folders for each user.

Beverleyh
01-30-2011, 08:58 AM
Use mkdir() to first make the user folder and give it suitable permissions (0755 for example) and then use copy() to copy files into it.
If you're moving files permanently though, use the rename() function.

There's a function here for recursive copying that might help too: http://www.php.net/manual/en/function.copy.php#91010

bouncer
01-30-2011, 04:58 PM
What do you mean permenantly move files to a directory? What I want to do is copy over the files used to host a portfolio. Therefore people would be able to have their own portfolio.

Could you provide me with an example of how it would work upon user activation? So that once the user activates his account, a directory would be created. Along with the registration. (Not too good in php )

Beverleyh
01-30-2011, 07:11 PM
<?php

//.... whatever php code you use to activate your user accounts ....

mkdir("/path/of/directory/to/make", "0755");
copy("/path/of/source/file.txt", "path/of/destination/file.txt");

//.... other stuff

?>
The php manual offers much better examples though so check there -
copy: http://php.net/manual/en/function.copy.php
mkdir: http://php.net/manual/en/function.mkdir.php