Running into an error with my register page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dpete
Forum Newbie
Posts: 3
Joined: Fri Mar 23, 2012 11:05 am

Running into an error with my register page

Post by dpete »

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>
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Running into an error with my register page

Post by Celauran »

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?

Code: Select all

if (strlen($password)>25||strlen($password)<6)
{
    echo "Password much be between 6 and 25 characters";	
}
md5 is terrible, don't use it. Use bcrypt()

Code: Select all

$password = md5($password);
Specify the URL, not the file path

Code: Select all

<form action='file:///H|/php/WEB PROFOLIO/bevflowershop/register.php' method='POST'>
dpete
Forum Newbie
Posts: 3
Joined: Fri Mar 23, 2012 11:05 am

Re: Running into an error with my register page

Post by dpete »

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

{

---------------------------------------------------------------------------------------------
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Running into an error with my register page

Post by Celauran »

Do yourself a favour an dump Dreamweaver in favour of a proper IDE (Netbeans, Eclipse, PHPStorm, etc).
Dreamweaver is popping an error on line 39
What does the error say?

Again, please use syntax tags (the PHP Code button above the compose window).
dpete
Forum Newbie
Posts: 3
Joined: Fri Mar 23, 2012 11:05 am

Re: Running into an error with my register page

Post by dpete »

Hello again, I did just figure out my problem. Thanks again for your help. I will look into bcrypt()

dpete
Post Reply