Skip to content

Instantly share code, notes, and snippets.

@shohan4556
Created September 4, 2014 12:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shohan4556/c14a6f799831da7f6e64 to your computer and use it in GitHub Desktop.
Save shohan4556/c14a6f799831da7f6e64 to your computer and use it in GitHub Desktop.
simple user authentication in php
<?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