Ok this may take some explaining.
When users sign up to my site, a folder is created for them on the FTP to contain all of their pics/ data thats too large for the database etc. I can do that no problem- heres the code Im using:
// set up basic connection
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// check connection
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
exit;
}
//pick the folder
//this is the bit Im stuck on!
//make the dir
$username = $_POST[username];
mkdir("/home/printede/public_html/dating_site/users/a/$username", 0777);
// close the FTP stream
ftp_close($conn_id);
Now that all works as it is, but its not quite exacly what I want to do. you see every user ends up in the folder "a" in users. what I want is for the php to look at the first letter of $username, and create that users folder in the right letter folder (eg "p" folder for user called Purity) or put them in the "other" folder if theyve decided to start their name with a number.
I guess I need to start by finding the first letter in $username, does anyone know how to do that?