<?php
  function loginForm()
  {
	   global $txt;
	   //print_r($txt);

    $html = '';

    // Alerts on actions
    if (isset($_GET['error']))
    {
      if ($_GET['error'] == 'login')
      {
        $html .= '<div class="alert alert-warning">';
          $html .= '<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>&nbsp;' . $txt['wrongLogin'] . '.';
        $html .= '</div>';
      }
    }
    else if (isset($_GET['accountMailSent']))
    {
      $html .= '<div class="alert alert-info" role="alert">';
        $html .= $txt['accountMailSent'];
      $html .= '</div>';
    }
    else if (isset($_GET['accountCreated']))
    {
      $html .= '<div class="alert alert-success" role="alert">';
        $html .= $txt['accountCreated'];
      $html .= '</div>';
    }

	if (isset($_GET['autologout']))
	{
	  $html .= '<div class="alert alert-info" role="alert">';
		$html .= $txt['autologout'];
	  $html .= '</div>';
	}

    $html .= '<form role="form" name="form-login" id="form-login" method="post" action="php/login.php">';

      $html .= '<div class="row">';
        $html .= '<div class="col-md-3">';

          $html .= '<div class="form-group">';
            $html .= '<label for="username">' . $txt['username'] . '</label>';
            $html .= '<input class="form-control" type="text" name="username" required>';
          $html .= '</div>';

          $html .= '<div class="form-group">';
            $html .= '<label for="password">' . $txt['password'] . '</label>';
            $html .= '<input class="form-control" type="password" name="password" required>';
          $html .= '</div>';

          $html .= '<div class="form-group">';
            $html .= '<button class="btn btn-primary">' . $txt['connexionBtn'] . '</button>';
          $html .= '</div>';
        $html .= '</div>';
      $html .= '</div>';

    $html .= '</form>';

    $html .= '<p class="top-buffer-20"><small><a href="' . $_SERVER['PHP_SELF'] . '?oubli">' . $txt['forgot'] . '</a></small></p>';

    $html .= '<p class="top-buffer-20">' . $txt['createAccount'] . '</p>';

    $html .= '';

    return $html;
  }
?>
