I recently created a registration file based off the script for a login file that I found earlier today. I am trying to make it so that when a user registers, a file is created with the same name as their user ID, but I havn’t been able to figure out how to do this. Any help is appreciated.
For some reason I made a thread a few hours ago and it was suddenly deleted without any sort of warning, I have no idea why though
[php]<?php
ob_start();
$host=“localhost”; // Host name
$username=“root”; // Mysql username
$password=“pass”; // Mysql password
$db_name=“members”; // Database name
$tbl_name=“members”; // Table name
// Connect to server and select databse.
mysql_connect("$host", “$username”, “$password”)or die(“cannot connect”);
mysql_select_db("$db_name")or die(“cannot select DB”);
// Define $myusername and $mypassword
$myusername=$_POST[‘myusername’];
$mypassword=$_POST[‘mypassword’];
$myemail=$_POST[‘myemail’];
// To protect MySQL injection (more detail about MySQL injection)
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myemail = stripslashes($myemail);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$myemail = mysql_real_escape_string($myemail);
$sql=“INSERT INTO $tbl_name (username, password, email) VALUES (’$_POST[myusername]’,’$_POST[mypassword]’,’$_POST[myemail]’)”;
$result=mysql_query($sql);
header(“location:index.php”);
$id;
$file=fopen(“profile’$id’.php”,“x+”);
ob_end_flush();
?>
[/php]