How would I go about, in my registrtation script, adding a part where when they sign up, it automatically creates a file called (whatevertheusername).php for profile purposes. Here is my current sign up script:
<? if($username=='' || $fname=='' || $lname=='' || $email=='' || $city=='' || $state=='' || $age=='' || $password=='' || $eula=='no'){ include('emptyfield.php'); } elseif($password!=$password2){ include('nomatchpasswords.php'); } else { mysql_connect('localhost', 'XXXXX', 'XXXXX') or die('Could not connect to MySQL because:'.mysql_error()); mysql_select_db('DB_XXXXXX') or die("Error connecting to DB because:".mysql_error()); mysql_query("INSERT INTO users (username, password, fname, lname, age, email, city, state) VALUES ('$username', '$password', '$fname', '$lname', '$age', '$email', '$city', '$state')"); include('accountsuccess.php'); } ?>
<?
if($username=='' || $fname=='' || $lname=='' || $email=='' || $city=='' || $state=='' || $age=='' || $password=='' || $eula=='no'){
include('emptyfield.php');
} elseif($password!=$password2){
include('nomatchpasswords.php');
} else {
mysql_connect('localhost', 'XXXXX', 'XXXXX') or die('Could not connect to MySQL because:'.mysql_error()); mysql_select_db('DB_XXXXXX') or die("Error connecting to DB because:".mysql_error()); mysql_query("INSERT INTO users (username, password, fname, lname, age, email, city, state) VALUES ('$username', '$password', '$fname', '$lname', '$age', '$email', '$city', '$state')");
include('accountsuccess.php');
} ?>
Any help would be greatly appreciated.
Anyone?
Don't put that in a file, put it in your database.
If for some strange, unknown reason you HAVE to use a file, then please, please, for the love of all that is good, holy, and somewhat secure don't put it in a file ending in .php
Why? Let me re-explain. What I want it to do is, when the user signs up, it makes them a profile page under the directory of profile called $username.php. All it will have is thier profile info for everyone to view. Maybe I am missing something. Can you fill me in?
OK, I thought you were talking about putting user entered data into a .php file (as opposed to script generated/controlled date). But in any case it would still be better to store all of their profile info in a database and then just have a generic profile.php script which would pull out that info and display it. Then, instead of having a seperate script for each user, you just have one script that you pass a username to.