Created
September 4, 2014 12:38
-
-
Save shohan4556/c14a6f799831da7f6e64 to your computer and use it in GitHub Desktop.
simple user authentication in php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php include_once('db.php'); | |
// Using include_once(), we are including the file db.php By including this file, we automatically get connected to the database. | |
?> | |
<?php | |
$fname=$_POST['fname']; // pass data of firstname field through "POST" method | |
$lname=$_POST['lname']; // pass data of lastname field through "POST" method | |
$email=$_POST['email']; // pass data of email field through "POST" method | |
$pass=$_POST['pass']; // pass data of password field through "POST" method | |
//"INSERT INTO sign_up (first_name,last_name,email,password) VALUES ('$fname','$lname','$email','$pass')" | |
$sql="INSERT INTO sign_up (first_name,last_name,email,password) VALUES ('$fname','$lname','$email','$pass')"; | |
$sry=mysql_query($sql); // mysql query executed | |
if(!$sry) | |
{ | |
echo 'Failed'.mysql_error(); | |
echo "<br /><a href='sign_up.html'>Sign up</a>"; | |
} | |
else | |
{ | |
echo "You are Successfuly signed up !! "; | |
echo "<br /><a href='sign_in.html'>Sign in</a>"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment