D
D
del9937882016-04-11 19:42:22
PHP
del993788, 2016-04-11 19:42:22

Why can't I log in using dle.api?

Hello. I have a php file like this:

<?php
include ('engine/api/api.class.php');
$request = $dle_api->external_auth( $_POST['ajaxname'],  $_POST['ajaxpass']);
if ($request == true)
    echo 'Вы успешно Авторизировались';
elseif ($request == false)
    echo 'Ошибка! Логин или пароль не совпали!';

On his site there is such js
$(function(){
        $('#ajaxlogin').on( "submit", function(e) {
            e.preventDefault();
            $.ajax({
                type: "POST",
                url: "ajaxlogin.php",
                data: $('#ajaxlogin').serialize(),
                success: function(data){
                    alert(data);
                }
            });
        });
       });

I created a form, I enter my login and password, true is returned, I refresh the page, and I stayed as a guest. Why is that? Where is the mistake?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
nictrace, 2017-12-27
@nictrace

the fact is that on the server side it is not enough to make sure that the password is correct. It is also necessary to write certain values ​​​​to the session, by which the engine recognizes that the user has logged in. Log in via the login form and display the contents of the $_SESSION array

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question