0 members and 1,877 guests
No Members online
» Site Navigation
» Stats
Members: 35,443
Threads: 103,072
Posts: 826,684
Top Poster: cc.RadillacVIII (7,429)
|
-
Code:
<html>
<head>
<title></title>
</head>
<body><?php
echo"<align='center'>Registration Form</align>";
echo"<p><form name='registration'>Username:<input type='text' name='Username' maxlength='20'><p>";
echo"<p>Password:<input type='password' name='Password' maxlength='20'></p>";
echo"<p><form action='post'><input type='submit' input name='registration' value='Register'></form></p>";
$name = $_post['$Username'];
$pass = $_post['$Password'];
$myFile = "name.php";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData='$Username';
fwrite($fh, $stringData);
$stringData='$Password';
fwrite($fh, $stringData);
fclose($fh);
?>
</body>
</html>
Can you guys adjust this code so that it creats a new file with the Username and Password saved in there?
I kno it's not a safe way to do it, but I'm learning PHP now... Wrote this script myself btw.
-
Resident father figure.
-
I already followed several tutorials, but it just won't work..
-
you problable don't have permissions set correctly on the server. write a small php script that writes a file. if they file isn't created you don't have permission to do so on the server.
Resident father figure.
-
I got that right now... But the prob is now that the file doesn't save the Username and Password, it's just an empty file... I kno it's not safe, but it's just to practice a bit.
-
Dont you need a server that runs PHP and MySQL?
-
<div class='quotetop'>QUOTE(BlackOut @ Apr 21 2006, 06:23 PM) [snapback]166392[/snapback]</div>
Dont you need a server that runs PHP and MySQL?
[/b]
Just PHP
I'm drunk wo I can't really hep much. but suffieccced to say you need to put the write command into the same page as the password acceptance page, and use th e paddword vairable and the usernemrna variable for the file diet.
Resident father figure.
-
Sorry for reviving such an old thread, but i'd thought i'd shed some light on this, there is SO much wrong in this code.
Code:
<html>
<head>
<title></title>
</head>
<body>
<?php
echo '<div align="center">Registration Form</div>';
echo '<p><form name="registration" action="" method="post">Username:<input type="text" name="Username" maxlength="20"><p>';
echo '<p>Password:<input type="password" name="Password" maxlength="20"></p>';
echo '<p><input type="submit" name="registration" value="Register"></form></p></p>';
// This will get you some nice warnings if you have error-reporting on E_ALL & E_NOTICE.
$name = $_POST['Username']; // Dunno what you were trying here.
$pass = $_POST['Password']; // same as above.
$myFile = "users.txt";
$fh = fopen($myFile, 'a') or die('can't open file'); // dont truncate file, add to end.
fwrite($fh, $name . ':' . $pass); // add users in the username:password syntax (cleartext(!))
fclose($fh);
?>
</body>
</html>
Similar Threads
-
By luigi in forum The Void
Replies: 24
Last Post: 06-04-2006, 08:32 PM
-
By DrksYd665 in forum Sigs & Manips
Replies: 3
Last Post: 12-07-2005, 09:17 PM
-
By Invision in forum The Void
Replies: 7
Last Post: 05-08-2005, 09:19 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|