diff --git a/logic/login.php b/logic/login.php index a516af0..71b83ff 100644 --- a/logic/login.php +++ b/logic/login.php @@ -2,6 +2,7 @@ require 'messages.php'; require 'sanitize.php'; +require './sql/querys.php'; $user = $_POST['user']; $password = $_POST['password']; @@ -14,7 +15,19 @@ if (isset($_POST['submit'])) { if(strlen($password) <= 20){ - sanitize('user', $user); + $c = verifyDB($user, $password); + + if ($c[0][1] === $user && $c[0][2] === $password) { + echo ''; + + } else { + echo error('The User or the Password are wrong. Please try again'); + echo backToPreviusPage(4, '../login.html'); + } } else { echo error('The password has more characters than allowed!'); diff --git a/logic/register.php b/logic/register.php index 85e835b..fcdbdac 100644 --- a/logic/register.php +++ b/logic/register.php @@ -2,6 +2,7 @@ require 'messages.php'; require 'sanitize.php'; +require './sql/querys.php'; $user = $_POST['user']; $password = $_POST['password']; @@ -17,7 +18,11 @@ if (isset($_POST['submit'])) { if (strlen($password) <= 20) { - sanitize('user', $user); + addToDB(sanitize('user', $user), $password); + + echo ''; } else { echo error('The password has more characters than allowed!'); diff --git a/logic/sql/connection.php b/logic/sql/connection.php new file mode 100644 index 0000000..71a33d3 --- /dev/null +++ b/logic/sql/connection.php @@ -0,0 +1,9 @@ + getMessage(); +} + +?> \ No newline at end of file diff --git a/logic/sql/querys.php b/logic/sql/querys.php new file mode 100644 index 0000000..b1758ae --- /dev/null +++ b/logic/sql/querys.php @@ -0,0 +1,30 @@ + prepare('insert into users (user, pass) values (?, ?)'); + echo 'paso 1'; + $add -> bindParam(1, $user, PDO::PARAM_STR); + echo 'paso 2'; + $add -> bindParam(2, $password, PDO::PARAM_STR); + echo 'paso 3'; + $add -> execute(); + echo 'paso 4'; +} + +function verifyDB($user, $password) { + require './sql/connection.php'; + + $verify = $connect -> prepare('select * from users where (user, pass) = (?, ?)'); + echo 'paso 1'; + $verify -> bindParam(1, $user, PDO::PARAM_STR); + echo 'paso 2'; + $verify -> bindParam(2, $password, PDO::PARAM_STR); + echo 'paso 3'; + $verify -> execute(); + echo 'paso 4'; + return $verify -> fetchAll(); +} + +?> \ No newline at end of file diff --git a/styles.css b/styles.css index b86362b..52ecbb9 100644 --- a/styles.css +++ b/styles.css @@ -85,6 +85,20 @@ input:focus { width: 421px !important; background-color: rgb(175, 166, 150); border: 1px rgb(114, 100, 96) solid; + transition:background-color ease-in-out 0.3s; + -webkit-transition:background-color ease-in-out 0.3s; + -moz-transition:background-color ease-in-out 0.3s; + -ms-transition:background-color ease-in-out 0.3s; + -o-transition:background-color ease-in-out 0.3s; +} + +.submit:hover { + background-color: rgb(233, 221, 201); + transition:background-color ease-in-out 0.3s; + -webkit-transition:background-color ease-in-out 0.3s; + -moz-transition:background-color ease-in-out 0.3s; + -ms-transition:background-color ease-in-out 0.3s; + -o-transition:background-color ease-in-out 0.3s; } diff --git a/success-pages/loginS.html b/success-pages/loginS.html new file mode 100644 index 0000000..4b45b2b --- /dev/null +++ b/success-pages/loginS.html @@ -0,0 +1 @@ +

mfasddfmsadofasdmfpadsofma

\ No newline at end of file diff --git a/success-pages/registerS.html b/success-pages/registerS.html new file mode 100644 index 0000000..8f788db --- /dev/null +++ b/success-pages/registerS.html @@ -0,0 +1 @@ +

asdojfnadsjfnasfnadsjfda

\ No newline at end of file