Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function(){
- $('#form').submit(function(){
- $.ajax({
- type: 'POST',
- url: 'ajax/login.php',
- dataType: 'text',
- data: $('#form').serialize(),
- traditional: true,
- success: function(response) {
- if (response == 'yes') {
- $("#oKmessage").fadeIn(1000);
- $("#form").hide(1000);
- window.location.reload();
- } else if (response == 'no') {
- $("#nomessage").fadeIn(1000);
- $("#form").hide(1000);
- } else
- $("#emptymessage").fadeIn(1000);
- $("#form").hide(1000);
- },
- error: function(response) {
- /* ошибка соединения с интернетом */
- }
- });
- return false;
- })
- });
- <?php
- require "../core.php";
- if (isset($_POST["username"]) && isset($_POST["password"])) {
- if ($_POST["username"] != '' or $_POST["password"] != '') {
- $username = mysqli_real_escape_string($connect, $_POST["username"]);
- $password = hash('sha256', $_POST["password"]);
- $check = mysqli_query($connect, "SELECT username, password FROM
- `players` WHERE `username`='$username' AND password='$password'");
- if (mysqli_num_rows($check) > 0) {
- session_start();
- $_SESSION['username'] = $username;
- $autch = 'yes';
- } else {
- $autch = 'no';
- }
- echo $auth;
- }
- }
- ?>
- if (isset($_POST["signin"])) {
Add Comment
Please, Sign In to add comment