diff --git a/login/dangky.php b/login/dangky.php new file mode 100644 index 0000000..c2f66af --- /dev/null +++ b/login/dangky.php @@ -0,0 +1,34 @@ + 0 ){ +// echo "true"; + return true; + } +// echo "false"; + return false; + } + if( isset( $_POST['username'] ) and isset( $_POST['password'] ) ){ + $check = checkUser( $_POST['username'] ); + $username = $_POST['username']; + $password = $_POST['password']; + if( $check == true ){ + header("location:index.php"); + } else{ + if( $password != "" ){ + $password = md5( $password ); + $sql = "insert into nguoidung set email = '$username', pass = '$password'"; + mysqli_query( $conn, $sql ); + header("location:../signup/"); + } else { + header("location:index.php"); + } + + } + } else { + header("location:index.php"); + } +?> \ No newline at end of file diff --git a/login/index.php b/login/index.php index e9b3f90..80fd031 100644 --- a/login/index.php +++ b/login/index.php @@ -56,7 +56,7 @@

Login to your account

-
+
@@ -74,7 +74,7 @@
diff --git a/signup/dangnhap.php b/signup/dangnhap.php new file mode 100644 index 0000000..ebaa0e7 --- /dev/null +++ b/signup/dangnhap.php @@ -0,0 +1,28 @@ + 0 ){ + $row = mysqli_fetch_array( $result, MYSQL_ASSOC ); + $pass = $row['pass']; + return $pass; + } else return false; + } + if( isset( $_POST['username'] ) and isset( $_POST['password'] ) ){ + $pass = getPassword( $_POST['username'] ); + if( $pass == false ){ + header("location:index.php"); + } else{ + echo $pass; + if( md5( $_POST['password'] ) == $pass ){ + header("location:../index.php"); + } else { + header("location:index.php"); + } + } + } + +?> \ No newline at end of file diff --git a/signup/index.php b/signup/index.php index e9b3f90..de10c62 100644 --- a/signup/index.php +++ b/signup/index.php @@ -46,6 +46,9 @@ +
@@ -56,7 +59,7 @@

Login to your account

-
+