Registration PHP code doesn't work

0 Ali Khiti · July 31, 2014
Hi guys this code of php registration doens't work for me : When I click the submit buttom it just send me to the exact same page...
Here's the code of register.php


<?php
$page_title = "Test";
include 'header.php';

?>

<?php
$submit= @$_POST['submit'];

$fn = strip_tags(@$_POST['fname']);
$un = strip_tags(@$_POST['username']);
$em = strip_tags(@$_POST['email']);
$em2 = strip_tags(@$_POST['email2']);
$pswd = strip_tags(@$_POST['password']);
$pswd2 = strip_tags(@$_POST['password2']);
$d = date("Y-m-d");
if ($submit) {
if ($em==$em2) {

$u_check = mysql_query("SELECT username FROM users WHERE username='$un'");

$check = mysql_num_rows($u_check);

$e_check = mysql_query("SELECT email FROM users WHERE email='$em'");

$email_check = mysql_num_rows($e_check);
if ($check == 0) {
if ($email_check == 0) {

if ($fn&&$un&&$em&&$em2&&$pswd&&$pswd2) {

if ($pswd==$pswd2) {

if (strlen($un)>25||strlen($fn)>25) {
echo "The maximum limit for username/first name/last name is 25 characters!";
}
else
{
if (strlen($pswd)>30||strlen($pswd)<5) {
echo "Your password must be between 5 and 30 characters long!";
}
else
{
$pswd = md5($pswd);
$pswd2 = md5($pswd2);
$query = mysql_query("INSERT INTO users VALUES ('','$un','$fn','$em','$pswd','$d','0')");
die("<h2>Welcome to Welive</h2>Login to your account to get started ...");
}
}
}
else {
echo "Your passwords don't match!";
}
}
else
{
echo "Please fill in all of the fields";
}
}
else
{
echo "Sorry, but it looks like someone has already used that email!";
}
}
else
{
echo "Username already taken ...";
}
}
else {
echo "Your E-mails don't match!";
}
}
?>




<div>
<h2>Register below!</h2>
<div >
<form action="" method="post" accept-charset="utf-8">
<div>
<div>
<input type="text" name="fname" value="" id="email" tabindex="1" placeholder="Your Full Name " />
</div>
<div>
<input type="text" name="username" value="" id="email" tabindex="2" placeholder="Choose a username" />
</div>
<div>
<input type="text" name="email" value="" id="email" tabindex="3" placeholder="Enter your email adress" />
</div>
<div>
<input type="text" name="email2" value="" id="email" tabindex="4" placeholder="Comfirm your email adress" />
</div>
<div>
<input type="password" name="password" value="" id="password" tabindex="5" placeholder="Choose a password" />
</div>
<div>
<input type="password" name="password2" value="" id="password" tabindex="6" placeholder="Comfirm your password" />
</div>
</div>

<div>
<button type="submit" name="submit" class="submit" tabindex="7">Register</button>
</div>
</form>
</div>
</div>

<?php include 'html/footer.php'; ?>

Post a Reply

Replies

- page 2
Oldest  Newest  Rating
0 Ali Khiti · August 1, 2014
Johal they give me this error when I do it
Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\Welive\register.php on line 119
(line 119 is the end of the code)
0 Mathias Frits Rørvik · August 1, 2014
You should not use md5 to store passwords.
-1 JOhaL jaTT · August 3, 2014
Happy to help you........
-2 Ali Khiti · July 31, 2014
Johal, I want to have the activation in the index.php.. Thanks anyway guys
  • 1
  • 2

PHP

107,191 followers
About

Server-side, HTML embedded scripting language used to create dynamic Web pages.

Links
Moderators