<?vsp 
--  
--  $Id: handset.vsp,v 1.2 2006/08/15 19:30:34 source Exp $
--  
--  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
--  project.
--  
--  Copyright (C) 1998-2006 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 _random1 integer;

  _random1 := rnd(9999999);

  _sid := '';
  _sid := get_keyword('SESS', 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;
  }
  }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="Update Handset Details">
     <do type="accept" label="Update">
     <go href="handset_update.vsp?SESS=<?=_sid?>&amp;MODEL=$(model1:e)&amp;ROWS=$(rows1:e)&amp;COLS=$(cols1:e)&amp;MSGSIZE=$(msgsize1:e)&amp;MSGLIST=$(msglist1:e)"></go>
   </do>
   <do type="help" label="Options">
  <go href="#opt"/>
   </do>
   <?vsp
    for select * from wapsetting where _username = _user_name do {
   ?>
     <p>Phone Model:<input name="model1" value="<?=_phone_model?>" maxlength="30" /></p>
     <p>Lines of Display:<input name="rows1" value="<?=_display_rows?>" maxlength="30" /></p>
     <p>Characters Per Line:<input name="cols1" value="<?=_display_cols?>" maxlength="30" /></p>
     <p>Email Message Size:<input name="msgsize1"  value="<?=_msg_size_to_read?>" maxlength="30" /></p>
     <p>Email Message Per Screen:<input name="msglist1"  value="<?=_num_msg_to_list?>"  maxlength="30" /></p>
   <?vsp } ?>
        <p><a href="handset_update.vsp?SESS=<?=_sid?>&amp;MODEL=$(model1:e)&amp;ROWS=$(rows1:e)&amp;COLS=$(cols1:e)&amp;MSGSIZE=$(msgsize1:e)&amp;MSGLIST=$(msglist1:e)" title="Update">Update</a></p>
            <p><a href="checkmail.vsp?SESS=<?=_sid?>&amp;REF=<?vsp http(sprintf('%d',_random1));?>&amp;OPEN=Inbox" title="Cancel">Cancel</a></p>
  </card>

  <card id="opt" title="Options">
     <do type="options" label="Exit">
      <go href="#page1"/>
     </do>
  <p><a href="setting.vsp?SESS=<?=_sid?>&amp;REF=<?=_random1?>" title="Setting">Setting Menu</a></p>
       <p mode="nowrap"><a href="checkmail.vsp?SESS=<?=_sid?>&amp;REF=<?vsp http(sprintf('%d',_random1));?>&amp;OPEN=Inbox" title="Mail Menu">Mail Menu</a></p>
  <p><a href="logout.vsp?SESS=<?=_sid?>" title="Logout">Logout</a></p>
  <p><a href="#page1" title="Exit">Exit</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
}
?>
