PHP not creating file.
Posted on
16th Feb 2014 07:03 pm by
admin
Its supposed to create a .ini file in the /scriptfiles/users/ with the name they entered into the field then its supposed to create a password in the file in md5 encryption like this "password=32jknfdjkb324" like that but it doesn't create the file?, Heres my code.
Code: [Select]<center>
<form method=post action=register.php?action=register name=s>
<table>
<h1>Register on our SA-MP Server.</h1>
<tr><td>Username:</td><td><input type=text name=username></td></tr>
<tr><td>Password:</td><td><input type=password name=password></td></tr>
<tr><td colspan=2 align=center><input type=submit value=Register></td></tr>
</table>
</form>
</center>
<?php
if ($action == register) {
//cAccounts
//By Chris
//Register accounts and login on websites.
$ftp_host = "randomhostname"; //put the ip / hostname to your ftp here
$ftp_user = "randomuser"; //put your login here
$ftp_pass = "password"; //put your password here
$username = $_POST['username'];
$password = md5($_POST['password']);
$con = ftp_connect($ftp_host) or die("Error: Could not connect to FTP, Check FTP Settings.");
ftp_login($con, $ftp_user, $ftp_pass);
if (file_exists($username)) {
echo "This username already exists!, Please try another.";
} else {
$createfile = "scriptfilesusers$username.ini";
$wrightfile = fopen($createfile, 'w') or die("Error: Cannot create file.");
$wpass = "password=$password";
fwrite($wrightfile, $wpass);
fclose($wrightfile);
}
ftp_close($con);
}
?>
No comments posted yet
Your Answer:
Login to answer
143
52
Other forums
Sort a two dimensional array.
Hi. I've set up a two dimensional array that reads as follows:
Code: $modifiedData = array(
Basic Forum Tutorial
Hi, I'm new to PHP. I want to build a basic forum for my site using PHP and MySQL. I've searched t
Displaying different page content, depending on the logged in user.
Hi all, I am new to ASP.net (and web development in general), and have a question about how I can di
Quick Question about echo value
Hey guys, I'm trying to get something to show differently in one of my scripts. I'm trying to make
Transform value 0 in no and 1 in yes help needed
Hello,
I have this in the table: "value" type int 0 to represent false and 1 to represe
LIMIT $start, 10... how to pass last value queried into next page with GET??
Ok I know how to display the first or last 10 results of a query...
$result = mysql_query(&q
read integers that returns a negative or prints the average
Im trying to finish this homework assignment by tommarow afternoon and I keep getting stuck.
Wr
Check Digits and extracting digits
I think I can figure out the code for this but I am having a very hard time getting past the first s
help with multi-update
Now sure how to ask this really....
10g database if that matters.
I have a customer
Login script (probably a simple error)
dbConfig.php
Code: <?
// Replace the variable values below
// with your specific dat