Skip to content

Instantly share code, notes, and snippets.

@netwons
Last active January 21, 2018 07:52
Show Gist options
  • Save netwons/d09b833e76c1205c33cd2e474f3feb14 to your computer and use it in GitHub Desktop.
Save netwons/d09b833e76c1205c33cd2e474f3feb14 to your computer and use it in GitHub Desktop.
<?php
if(isset($_POST['login'])){
$username=mysqli_real_escape_string($connection,$_POST['username']);
$password=mysqli_real_escape_string($connection,$_POST['password']);
$query=" SELECT * FROM register WHERE username='$username' password='$password' ";
echo $query;
$result=mysqli_query($connection,$query);
$d=encript($password);
if($result){
echo "<br>yes<br>";
$row=mysqli_fetch_array($result);
if($row['username']== $username){
if($row['password']==$d){
echo "welcome to";
}else{
echo "password not barabar";
}
}else{
echo "username no barabar";
}
}else{
echo "<br>result wornig";
}
}else{
echo "no<br>";
}
?>
<?php
$username=$_POST['username'];
$password=$_POST['password'];
//$d=encript($password);
$query=" SELECT * FROM register WHERE username='$username' AND password='$password'";
echo $query;
$result=mysqli_query($connection,$query);
$count=mysqli_num_rows($result);
if($count==1){
header("Location: welcome.php");
}else{
echo "<br>error";
}
?>
<?php
if(isset($_POST['login'])){
$username=$_POST['username'];
$password=$_POST['password'];
$d=encript($password);
$query=" SELECT * FROM register WHERE username='$username' AND password='$d'";
echo $query;
$result=mysqli_query($connection,$query);
//$f=mysqli_num_rows($result);
if($result){
echo "<br>yes<br>";
//if($f!=0){
while($row=mysqli_fetch_assoc($result)){
$dusername=$row['username'];
$dpassword=$row['password'];
}
if($username==$dusername && $d==$dpassword){
echo "Welcome to ";
}else{
echo "wrong username and password";
}
//}else {
//echo "database is zero.";
//}
}else{
echo "no<br>";
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment