<?vsp 
--  
--  $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
--  
--  
 http_rewrite(); http_header('Content-type: text/vnd.wap.wml\r\n');

   declare _user_name, _login_ok varchar;
  declare _sid varchar;
  declare _err long varchar;
  declare l_fname, l_lname, l_return_email, l_state, l_tel, l_country varchar;
  declare _random1 integer;

  _random1 := rnd(9999999);
  _sid := '';
  _sid := get_keyword('SESS', params);
  l_fname := get_keyword('FIRSTNAME', params);
  l_lname := get_keyword('LASTNAME', params);
  l_return_email := get_keyword('RETURN_EMAIL', params);
  l_state := get_keyword('STATE', params);
  l_tel := get_keyword('TEL', params);
  l_country := get_keyword('COUNTRY', params);

   _login_ok := 'NO';

 if (_sid   <> '')
 {
  for select _username, _userpass from wapsession where sid = _sid  do
  {
   _login_ok := 'YES';
   _user_name := _username;
   update wapsession set _time_last_active = datestring ( now() ) where  sid = _sid;
   update wapsetting set _fname = l_fname, _lname = l_lname, _return_email = l_return_email, _state = l_state, _tel = l_tel, _country = l_country where _username = _user_name;
  }
  }else{
    _login_ok := 'NO';
  }

if (_login_ok = 'YES')
{  http_rewrite(); http_header('Content-type: text/vnd.wap.wml\r\n');
?><?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">


<wml>
  <card id="page1" title="Personal Data Updated">
   <onevent type="onenterforward">
          <refresh>
   <setvar name="fname1" value=""/>
   <setvar name="lname1" value=""/>
   <setvar name="return_email1" value=""/>
   <setvar name="state1" value=""/>
   <setvar name="tel1" value=""/>
   <setvar name="country1" value=""/>
          </refresh>
   </onevent>
     <do type="accept" label="Mail Menu">
    <go href="checkmail.vsp?SESS=<?=_sid?>&amp;OPEN=Inbox&amp;REF=<?=_random1?>"/>
   </do>
   <p>Personal Data Updated</p>
        <p><a href="checkmail.vsp?SESS=<?=_sid?>&amp;OPEN=Inbox&amp;REF=<?=_random1?>" title="Mail Menu">Mail Menu</a></p>
  </card>
</wml>
<?vsp
}else{  http_rewrite(); http_header('Content-type: text/vnd.wap.wml\r\n');
?><?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">


<wml>
  <card id="P1" title="Wrong" >
    <p mode="nowrap">
   Wrong Login
    </p>
  </card>
</wml>
<?vsp
}
?>

