O
O
olezko2014-07-27 14:52:54
PHP
olezko, 2014-07-27 14:52:54

How to make a redirect after successful DLE authorization?

On the DLE site, it was required to display the authorization form on a separate page. Brought it out, everything works great. If the authorization was not successful, then an error pops up. But with successful authorization trouble. Login occurs, but there is no transition to the main one. I can't understand the reason.

Сама форма
///////////////
<input name="login_name" id="login_name"value="" tabindex="1" placeholder="Login" type="text" autofocus autocomplete="off" data-required="true" style="background: white;border: 0px;padding: 12px;padding-left: 30px;margin: 0;line-height: 24px;height: 44px; width:300;color: #8e9ba9;font-size: 14px;font-family: "PT Sans", sans-serif; -webkit-border-radius: 4px;-moz-border-radius: 4px;border-radius: 4px;-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box; width: 100%;" />
      </div>
  </div>		
    <br>
    <div class="s-field " >
      <div style="position: relative">
<input  type="password" name="login_password" id="login_password" value="" tabindex="1" placeholder="Password" autofocus autocomplete="off" data-required="true" style="background: white;border: 0px;padding: 12px;padding-left: 30px;margin: 0;line-height: 24px;height: 44px; width:300;color: #8e9ba9;font-size: 14px;font-family: "PT Sans", sans-serif; -webkit-border-radius: 4px;-moz-border-radius: 4px;border-radius: 4px;-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box; width: 100%;" />
      </div>
  </div>

    
   
    
    <br>
<div style="width:300px;margin-left: 0px;margin-right: 0px;">
<div class="section no_padding transparent">

<button name="login" type="hidden" id="login" value="submit" style="width:300px" class="button block big">Войти</button>

<?php

  if( ! defined( 'DATALIFEENGINE' ) ) {
    die( "Hacking attempt!" );
  }
  if( $is_logged ) {
    header( "Location: {$_SERVER['PHP_SELF']}" );
  } else {
    $tpl->load_template( 'login_page.tpl' );
    $tpl->set( '{registration-link}', $PHP_SELF . "?do=register" );
    $tpl->set( '{lostpassword-link}', $PHP_SELF . "?do=lostpassword" );
    $tpl->set( '{login-method}', $config['auth_metod'] ? "E-Mail:" : $lang['login_metod'] );
    $tpl->copy_template = "<form  method=\"post\" action=\"\">\n" . $tpl->copy_template . "
<input name=\"login\" type=\"hidden\" id=\"login\" value=\"submit\" >
</form>";
    $tpl->compile( 'content' );
    $tpl->clear();
  };

?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2014-07-27
@olezko

not an expert on DLE, so I can only advise a direct solution
instead
of specifying

header( "Location: /" );
exit();

or at least just
header( "Location: $_SERVER['PHP_SELF']" );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question