[RESOLVED] writing to directories
i have my script set up so that everyone who registers is added to the users txt file and a directory folder is created for them
how can i make th created directories with writing permissions so i can have it write the user and pass to the users.txt and write the first name last name and email to the directory folder?
Re: writing to directories
mkdir("path/to/dir-named-$user", 0700);
well sumwhere alongthat ...lol..
Re: writing to directories
lol im new so leaving me to figure out wat u meant is kinda hard
Re: writing to directories
Re: writing to directories
Re: writing to directories
okay... well lets say i had a member signup... and i wanted to give him his own folder to do with at he please... such as a image host...
well here's a lil singup file i made... a year ago
i tested it... and it works.. b4 today... idk how... but its never given me errors till just now... and i use it modified mind you in alot of my script... i just added _POST[] n well the _SERVER ****.. to make it not give errors...
PHP Code:
<?php
switch (@$_GET['step']) {
case "2":
//replace username and password with your mysql name and password
$conn = mysql_connect("localhost","Admin","blah"); #STICK YOUR OWN GODDAMN INFO IN HERE Example: mysql_connect("localost","Admin","yeah");
//select the database
$db = mysql_select_db("donald_duck"); #put db there
//insert the values
#Check to see if username is in use
$sql = "SELECT * FROM users WHERE username = \"$_POST[usrname]\"";
$inuse = mysql_query($sql)
or die(mysql_error());
$check = @mysql_fetch_array($inuse);
if($check["username"] == NULL) {
$result= MYSQL_QUERY("INSERT INTO users (id, username, password)".
"VALUES ('NULL', '$_POST[usrname]', '$_POST[password]')");
mkdir("$_SERVER[DOCUMENT_ROOT]/$_POST[usrname]", 0777);
echo("
$_POST[usrname] has been successfully added.<br><br>
<b>Username:</b> $_POST[usrname]<br>
<b>Password:</b> $_POST[password]<br>
if you are a team member you will have access to
$_SERVER[DOCUMENT_ROOT]/$_POST[usrname]");
}
else {
echo("
<center> Sorry, but that name is already in use. <font size=2 face=verdana><b><br>Go <a href=signup.php>back</a> and try again</font></b></center>
");
}
break; default:
echo"<form action=signup_en.php?step=2 method=post>
<table width=100% border=0>
<tr>
<td width=12%>Username Desired:</td>
<td width=88%><input type=text name=usrname size=25></td>
</tr>
<tr>
<td>Password Desired:</td>
<td><input type=password name=password size=26></td>
</tr>
<tr>
<td><input type=submit value=submit name=submit></td>
<td></td>
</tr>
</table>
</form>";
break;
}
?>
Re: writing to directories
only problem with that is my servers so bootleg it supports php but not MySQL
Re: writing to directories
my script does give them the folder though for all their stuff but i cant get that folder to be written in im guessing it would ahve to make a txt in the folder inorder tow rite cause ive never opened a folder and seen writing lol
Re: writing to directories
OooOo... if your host cant support mysql i'd try a friend of mine... at MyAtom.net. He build his own database. called Atom_DB. its a text file system. and just as powerful. When you msg him. Tell him PlaGuE sent you. oh and btw... im a team member of myatom.net
Re: writing to directories
ok but anyway even though my server doesnt support MySQL my computer does but i have a program called xampp that came with php 5 and mysql and a few other things in 1 and i dont no where to go to set the password for the MySQL user nor do i no how to make a new account for it. could u help me out?
Re: writing to directories
i'll make a new thread for this question