0
<form action="login.php" method="post">
Username: <input type='text' name ='username'><br>
Password: <input type="password" name='password'><br>
<input type="submit" value="Log in">
</form>



</body>
</html>
4
Contributors
6
Replies
8
Views
5 Years
Discussion Span
Last Post by James Donovan
0
<?php
$submit = @$_POST['submit'];
//form data
$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)
{

//chechk char length of username and fullname
if (strlen($username)>25||strlen ($fullname)>25)
{
echo ("Length of username or fullname is too long!");
}
else
{
//check password length
if(strlen($password)>25||strlen ($password)<6)
{
 echo ("Password must be  between 6 and 25 characters");
}
else
{
//register the user!

//encrypt password
$password = md5($password);
$repeatpassword = md5($repeatpassword);
// open database
$connect = mysql_connect("localhost","root","");
mysql_select_db("phplogin");  // select database

$queryreg =mysql_query("
INSERT INTO users VALUES ('','$fullname','$username','$password','$date',)
");
die ("You have been registered!<a href='index.php'> Return to Login page</a>");

}


}

}
else
 echo ("Your password do nat match!");
}
else
 echo("Please fill in <b>all</b> fields!");


}
?>
0

hi i wont to create a link in html page to connect in the php pages example:when i click Register in the html page it can lead me in php page

0

check this :

<form action="" method="post" >
name:<input name="fullname" size="25">
username:<input name="username" size="25">
password:<input type="password" name="password" size="25">
repeatpassword:<input type="password"  name="repeatpassword" size="25">
<input type="submit" name="submit" value="Register">

</form>

<?php
if(isset($_POST['submit']))
{
//form data
$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)
{
//chechk char length of username and fullname
if (strlen($username)>25||strlen ($fullname)>25)
{
echo ("Length of username or fullname is too long!");
}
else
{
//check password length
if(strlen($password)>25||strlen ($password)<6)
{
die ("Password must be between 6 and 25 characters");
}
else
{
//register the user!
//encrypt password
$password = md5($password);
//$repeatpassword = md5($repeatpassword);
// open database
$connect = mysql_connect("localhost","root","");
mysql_select_db("phplogin"); // select database
$queryreg =mysql_query("INSERT INTO users VALUES ('','$fullname','$username','$password','$date',)") ;
//++++++++++new lines++++++++++++++++++++++++
if($queryreg)
{
echo "<script>alert('".$alrt13."');</script>";    
echo "<meta http-equiv='refresh' content='0; url=index.php' >";//too login page 
}
}
}
}
else
die ("Your password do nat match!");
}
else
die("Please fill in <b>all</bfields!");
}
}
?>
0

When you click Register button it will bring you to login.php page which I assume is the code from your second post. Does that answer your question?

0

pls add this line before line 51:

$alert13="You have been registered!!";

test it ,if the login page name is login.php ,replace index.php with login.php
in line 52.
it must worked!!!!

0

Thanks for this solution. I just want to post my same question but It was already posted so I get my Ans. via this post.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.