PDA

View Full Version : Registration system problem


RealEfect
07-13-2011, 10:58 AM
Hi everyone, i want to create registration system by myself and i don't want to look to already created systems in the internet.I started now learning php, because i want to make my website better, but there is many problems with this system about which i was talking now.So my code is this in index.php file:
<html>
<head>
<title>Php page</title>
</head>
<body>
<?php
?>
<form action="register.php" method="post">
<input type="text" name="nickname" /></ br>
<input type="password" name="pass" method="post" /></br>
<input type="submit" value="Register" /></form>
</body>
</html>

And now this registration.php file, which should do all regitration stuff:
<html>
<head>
<title>Php register system</title>
</head>
<body>
<?php
$nickname= $_POST['nickname'];
$password=$_POST['password'];
$data5=$nickname;
$data6=$password;
$registration=$data6 . ".txt";
$data1=fopen($registration, 'r');
$data2=fread($data1,filesize($registration));
fclose($data1);
$data3=fopen($registration, 'w');
$data4=fwrite($data3,$data5);
$data7=fwrite($data3,$data6);
fclose($data3);
if($data5 == $data2 && $data6 == $data2)
{
echo "You already logged in!";
}
elseif($data5 != $data2 && $data6 != $data2)
{
echo $data4 . $data7;
echo "Your user was successfuly created!";
}
?>
</body>
</html>

Yes, i know it's very simple, but i really want to do it myself, but now actually i can't solve without help.I get many errors when register with my system and click register button.Maybe you know what is wrong here?

edbr
07-14-2011, 01:55 AM
what are the errors ?

i assume $data5=$nickname;
$data6=$password; are queries to your data base. are they correct?