Hey everyone i was wondering if one of you could help me out with an error i am running into with my register.php page. I would really appreciate it!
Here is my entire code from body to /body
------------------------------------------------------------------------------------------------------------------------------------------------
<?php
echo "<h1>Register </h1>";
$submit= $_POST['submit'];
$fullname = strip_tags($_POST['fullname']);
$username = strip_tags($_POST['username']);
$password = strip_tags($_POST['password']);
$repeatpassword = strip_tags($_POST['repeatpassword']);
$date = date("Y-m-d");
if ($submit)
{
//check for existance
if ($fullname&&$username&&$password&&$repeatpassword)
{
if ($password==$repeatpassword)
{
//check char length of username and fullname
if (strlen($username)>25||strlen($fullname)>25);
{
echo "Length of username or fullname is too long!";
}
else
{
if (strlen($password)>25||strlen($password)<6)
{
echo "Password much be between 6 and 25 characters";
}
else
{
//register the user!
// encrypt password
$password = md5($password);
$repeatpassword = md5($repeatpassword);
}
}
}
else
echo"Your password do not match";
}
else
echo"Please fill in <b>all</b> fields!";
}
?>
<p>
<form action='file:///H|/php/WEB PROFOLIO/bevflowershop/register.php' method='POST'>
<table>
<!-- table 1 -->
<tr>
<td>
Your full name:
</td>
<td>
<input type='text' name='fullname'>
</td>
</tr>
<!-- table 2 --->
<tr>
<td>
Choose a username:
</td>
<td>
<input type='text' name='username'>
</td>
</tr>
<!-- table 3 --->
<tr>
<td>
choose a password:
</td>
<td>
<input type='password' name='password'>
</td>
</tr>
<!-- table 4 --->
<tr>
<td>
repeat your password:
</td>
<td>
<input type='password' name='repeatpassword'>
</td>
</tr>
</table>
<p>
<input type='submit' name='submit' value='Register'>
</form>
Running into an error with my register page
Moderator: General Moderators
Re: Running into an error with my register page
And what might the error be? Also, please use syntax tags.
Other observations:
What's the point of this? Why restrict how long a password can be?
md5 is terrible, don't use it. Use bcrypt()
Specify the URL, not the file path
Other observations:
What's the point of this? Why restrict how long a password can be?
Code: Select all
if (strlen($password)>25||strlen($password)<6)
{
echo "Password much be between 6 and 25 characters";
}Code: Select all
$password = md5($password);Code: Select all
<form action='file:///H|/php/WEB PROFOLIO/bevflowershop/register.php' method='POST'>Re: Running into an error with my register page
Thank you Celauran,
Dreamweaver is popping an error on line 39 which is the bolded else statement between. I will look into using bcrypt() i'm pretty new to all of this, so i was just using what i knew md5. This is not for an actually business, just trying to learn.
--------------------------------------------------------------------------------------------------
if (strlen($username)>25||strlen($fullname)>25);
{
echo "Length of username or fullname is too long!";
}
else
{
if (strlen($password)>25||strlen($password)<6)
{
echo "Password much be between 6 and 25 characters";
}
else
{
---------------------------------------------------------------------------------------------
Dreamweaver is popping an error on line 39 which is the bolded else statement between. I will look into using bcrypt() i'm pretty new to all of this, so i was just using what i knew md5. This is not for an actually business, just trying to learn.
--------------------------------------------------------------------------------------------------
if (strlen($username)>25||strlen($fullname)>25);
{
echo "Length of username or fullname is too long!";
}
else
{
if (strlen($password)>25||strlen($password)<6)
{
echo "Password much be between 6 and 25 characters";
}
else
{
---------------------------------------------------------------------------------------------
Re: Running into an error with my register page
Do yourself a favour an dump Dreamweaver in favour of a proper IDE (Netbeans, Eclipse, PHPStorm, etc).
Again, please use syntax tags (the PHP Code button above the compose window).
What does the error say?Dreamweaver is popping an error on line 39
Again, please use syntax tags (the PHP Code button above the compose window).
Re: Running into an error with my register page
Hello again, I did just figure out my problem. Thanks again for your help. I will look into bcrypt()
dpete
dpete