<?xml version="1.0"?>
<!--
 -  
 -  $Id$
 -
 -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 -  project.
 -  
 -  Copyright (C) 1998-2018 OpenLink Software
 -  
 -  This project is free software; you can redistribute it and/or modify it
 -  under the terms of the GNU General Public License as published by the
 -  Free Software Foundation; only version 2 of the License, dated June 1991.
 -  
 -  This program is distributed in the hope that it will be useful, but
 -  WITHOUT ANY WARRANTY; without even the implied warranty of
 -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 -  General Public License for more details.
 -  
 -  You should have received a copy of the GNU General Public License along
 -  with this program; if not, write to the Free Software Foundation, Inc.,
 -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 -  
 -  
-->
<html>
  <head>
    <link href="../demo.css" type="text/css" rel="stylesheet"/>
  </head>
  <body>
    <v:page name="login_demo" xmlns:v="http://www.openlinksw.com/vspx/">
      <H4>VSPX login control</H4>
      <v:login name="logincontrol" realm="vspx" mode="url" user-password-check="sql_user_password_check">
        <v:template type="if-no-login">
          <p>You are not logged in</p>
        </v:template>
        <v:login-form name="loginform" required="1">
          <table class="tableentry">
            <tr>
              <td>name</td>
              <td>
                <v:text name="username" value="" xhtml_maxlength="20" xhtml_size="10"/>
              </td>
            </tr>
            <tr>
              <td>pass</td>
              <td>
                <v:text name="password" value="" xhtml_size="10" xhtml_maxlength="20" type="password"/>
              </td>
            </tr>
            <tr align="center">
              <td colspan="2">
                <v:button action="simple" name="login" value="Log In"/>
              </td>
            </tr>
          </table>
        </v:login-form>
        <v:template type="if-login">
          <p>Welcome to VSPX login demo</p>
          <p>SID: <?vsp http (self.sid); ?>
          </p>
          <p>UID: <?vsp http_value (connection_get ('vspx_user')); ?>
          </p>
          <p>How many time page is posted under login : <?vsp http_value ( coalesce (connection_get ('ctr'), 0) ); ?>
          </p>
          <?vsp connection_set ('ctr', coalesce (connection_get ('ctr'), 0) + 1); ?>
          <v:button name="submitbtn" action="simple" value="OK"/>
          <v:button name="logoutbtn" action="logout" value="Logout"/>
        </v:template>
      </v:login>
    </v:page>
  </body>
</html>
