Skip to content

Instantly share code, notes, and snippets.

@shohan4556
Created September 4, 2014 12:41
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/4c70af50ac81a09071b3 to your computer and use it in GitHub Desktop.
Save shohan4556/4c70af50ac81a09071b3 to your computer and use it in GitHub Desktop.
<?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.
session_start(); //starting session
?>
<?php
// table name 'sign_up'
$email=$_POST['email'];
$pass=$_POST['pass'];
$sql="select count(*) from sign_up where (email='$email' and password='$pass');";
// $sql = "SELECT count(*) FROM phplogin WHERE(username='".$uname."' and password='".$pass."')";
// select count(*) from sign_up where (email='$email' and password='$pass');
$qury=mysql_query($sql);
$result=mysql_fetch_array($qury);
if ($result[0]>0) {
# code...
echo "SUCCESSFULLY Login!!";
$_SESSION['email']=$email;
echo "<br/> Welcome ". $_SESSION['email']. "!";
echo "<br /><a href='logout.html'>Log Out</a>";
} else {
echo " <br/> Login Failed";
echo "<br /><a href='sign_in.html'>Sign Up</a>";
echo "<br /><a href='sign_up.html'>Sign In</a>";
# code...
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment