Hello. I have made the following registration section to my login, which appears to be working fine, its adding everything to the database as I intended. OK its not very secure and more validation is needed, but its good for the time being.
I'm trying to keep things simple so I can learn better, but from the examples I have come accross on the internet for the next part, checking if the username and password.. errr, well basically im lost, they go into encryption and all sorts, which makes me wanna poke my eyes out.
could anyone perhaps write me up the compairing code) or some pseudocode for the logging in section, to see if indeed we are authenticated or not. This doesn't need to be a highly secure system , its just for me learning.
Thanks a lot - MoFish
I'm trying to keep things simple so I can learn better, but from the examples I have come accross on the internet for the next part, checking if the username and password.. errr, well basically im lost, they go into encryption and all sorts, which makes me wanna poke my eyes out.
could anyone perhaps write me up the compairing code) or some pseudocode for the logging in section, to see if indeed we are authenticated or not. This doesn't need to be a highly secure system , its just for me learning.
Thanks a lot - MoFish
Code:
<?
$errormsg = 'please fill in your registration details below';
if (isset($_POST['submit'])){
$name = $_POST['name'];
$password = $_POST['password'];
$location = $_POST['location'];
$email = $_POST['email'];
$query = "insert into `user_details` (`name`, `password`, `location`, `email`) values ('$name', '$password', '$location', '$email')";
if ($name == "" || $password == "" || $location == "" || $email == "") {
$errormsg = 'please fill in all the fields';
} else {
if (mysql_query($query)){
$errormsg = 'thanks for registering ' . $name;
} else {
$errormsg = 'error adding to database';
}
}
}
echo "<p style='background-color:FFFFCC; border: 1px dotted;'>$errormsg</p>";
?>