Custom Login JSON

Discussion forum for MOD Writers regarding MOD Development.
Locked
User avatar
EsmerÖzcan
Registered User
Posts: 83
Joined: Sat Jun 21, 2008 1:46 pm
Location: Germany/Nürnberg
Name: Özcan Akbulut
Contact:

Custom Login JSON

Post by EsmerÖzcan » Fri Sep 13, 2013 12:27 pm

Hello, i have to create a custom login for iOS like Facebook Login

My customlogin.php is

Code: Select all

<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();

$template->set_filenames(array(
    'body' => 'customlogin.html',
));

page_footer();
?>
and my customlogin.html is

Code: Select all

<!-- PHP -->

header('Content-type: application/json');
if($_POST) {
    if($_POST['username'] == 'test' && $_POST['password'] == 'test') {
    echo '{"success":1}';
 } else {
    echo '{"success":0,"error_message":"Username and/or password is invalid."}';
}
}else {    echo '{"success":0,"error_message":"Username and/or password is invalid."}';}

<!-- ENDPHP -->
The field 'test' for the username and password work correctly but i want to check the username and password from the database.

I have tried

Code: Select all

 if($_POST['username'] == '' . $username . '' && $_POST['password'] == '' . $user_password . '')
but i get an invalid error..

I think i have to define $username, but it's still not working :ugeek:

Image
Image

Locked

Return to “[3.0.x] MOD Writers Discussion”