[Gambas-user] HTTP Form

Gianluigi bagonergi at gmail.com
Mon May 16 10:57:43 CEST 2022


Il giorno dom 15 mag 2022 alle ore 23:38 Gianluigi
<bagonergi at gmail.com> ha scritto:
>
>
>
> Il giorno dom 15 mag 2022 alle ore 20:10 T Lee Davidson <t.lee.davidson at gmail.com> ha scritto:
>>
>> On 5/13/22 09:17, T Lee Davidson wrote:
>> > When I get a bit of extra time, I'll try to work up an example that also helps show how a HTML form works server-side.
>>
>> Gianluigi ( and Hans :-) ),
>>
>> ...


Dear Lee,

in the meantime, I renew my thanks and apologize for the drudgery to
which I subject you (one of the heaviest labors is to explain
something to a hard head like mine)

I think I understand the general concept, what I just can't get my
head around is:
Does HTTPForm serve to open an html page or not?
Because if it is for opening a page then I don't understand how you
can do it, here the examples keep returning html code and they don't
open anything '(

Does it happen because you are acting locally?

>>
>>
>> P.S. I was not able to use HttpForm to login in to the BugTracker. Curl appears to choke on submitting a form through a 302
>> redirection due to: "necessary data rewind not possible".


If I use .URL = "http://gambaswiki.org" as the address, I get:

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="refresh" content="0; url=wiki" />
<title>Gambas Wiki</title>
</head>

<body>
</body>
</html>

If instead I use .URL = "http://gambaswiki.org/bugtracker" as the
address, I get:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:v="urn:schemas-microsoft-com:vml">

<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <title>Connexion</title>
  <link rel="icon" href="/icon/app/icon.png" type="image/png">
  <style type="text/css">/*@font-face {
  font-family: 'default-font';
  src: url('/Roboto-Light.ttf');
}*/

:focus {
  outline: none;
}

::-moz-focus-inner { border: 0; }

BODY {
/*font-size: 10pt;*/
/*font-family: default-font;*/
margin: 0;
padding: 0;
}

.bt-header {
display: block;
position: relative;
padding: 0.5em 0.5em 0.5em 1em;
background: white;
}

.bt-title {
display: inline-table;
text-transform: uppercase;
font-weight: normal;
}

.bt-page {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
padding: 2em;
border: solid 4px #E0E0E0;
background-color: #F8F8F8;
box-sizing: border-box;
}

H1,H2,H3 {
margin-top: 0;
margin-bottom: 1em;
font-family: serif;
font-weight: normal;
}

.dialog-title {
background: #DF6B00;
}

TD {
padding: 0.5em;
}

TD.label {
color: gray;
}

INPUT {
  border: solid 1px #C0C0C0;
  padding: 0px 2px;
  vertical-align: middle;
  margin: 0px;
  font-family: sans-serif;
  font-size: 9pt;
  height: 1.8em;
  box-sizing: border-box;
  color: black;
  background-color: white;
width: 100%;
}

HR {
  border-top: solid;
  border-left: none;
  border-bottom: none;
  border-right: none;
  border-width: 1px;
  border-color: #C0C0C0;
  margin-top: 4px;
  margin-bottom: 4px;
margin-left: -6px;
margin-right: -6px;
}

DIV.info {
  display: inline-block;
  /*border: solid #D8D8D8 1px;
  padding: 8px;*/
font-style: italic;
color: gray;
margin: 1em 0;
}

DIV.warning {
  display: inline-block;
  /*border: solid #DF6B00 1px;
  padding: 0.5em 1em;*/
font-style: italic;
color: #DF6B00;
/*background: #DFA36F;*/
margin-top: 1em;
font-weight: bold;
}

INPUT:focus {
  border: solid gray 1px;
  box-shadow: inset #F0F0F0 0 0 1em;
}

BUTTON {
  white-space: nowrap;
  line-height: 1.8em;
  vertical-align: middle;
  margin-right: 6px;
  padding: 0px 6px;
font-size: 85%;
}

DIV.captcha {
display: flex;
border: solid #C0C0C0 1px;
background: white;
font-family: monospace;
box-sizing: border-box;
}

DIV.captcha > IMG {
margin: 4px 4px 5px 5px;
}

SELECT,INPUT,TEXTAREA,TABLE.table,.menu-button {
font-size: inherit;
font-family: inherit;
}

#welcome {
font-size: 200%;
font-weight: bold;
text-shadow: 0 0 0.1em gray;
margin-bottom: 1em;
}

.message {
text-align: center;
max-width: 30em;
}

.buttons {
margin-top: 2em;
text-align: center;
}

#logo {
width: 10em;
margin-bottom: 1em;
}

#logo-asap {
display: none;
}

#warning {
display: none;
}
</style>
</head>

<body onload="load()">

<div id="logo-asap"><a href="http://www.asap-info.com"
target="_blank"><img border="0" src="/icon/app/asap.png"></a></div>



<script type="text/javascript">

function load()
{
document.f.login.focus();}

function get_date()
{
  var d = new Date();
  document.getElementById('date').value = d.getDate() + '/' +
(d.getMonth() + 1) + '/' + d.getFullYear() + ' ' + d.getHours() + ':'
+ d.getMinutes() + ':' + d.getSeconds();
}

function checkAutoAuthentication()
{
  var xhr = new XMLHttpRequest();
  var url = document.location.hostname;

  xhr.open( 'GET', 'https://' + url + '/Shibboleth.sso/Session', false);
  xhr.send(null);
  if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200)
  {
    //console.log("xhr response : " + xhr.responseText);
    var x = document.getElementById("switchModeAuth");
    x.style.display = "block";

    var n = xhr.responseText.indexOf("A valid session was not found");

    // Ce code permet uniquement de revenir par défaut sur le mode ADFS
    // et proposer la connexion ADFS
    if(n == -1){
      if(window.location.pathname.search(/^\/guygle-adfs/) == -1 ){
        // Ici on est authentifié par l'AD et donc on force /guygle-adfs
        var url =
window.location.pathname.replace(/^\/guygle/,'/guygle-adfs') +
window.location.search;
        window.location.href = url;
      }
    }
  }
  else
    console.log("Error");
}

function switchLocalAuth()
{
  var xhr = new XMLHttpRequest();
  var url = document.location.hostname;
  //console.log("switchLocalAuth" + url);
  //console.log("send XMLHttpRequest");
  xhr.open( 'POST', 'https://' + url + '/Shibboleth.sso/Logout', false);
  xhr.send(null);

  if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200)
    window.location.href = '/guygle';
}

function switchADFSAuth()
{
  window.location.href = '/guygle-adfs'
}

</script>

<body class="body" onload="load()">

<div class="bt-page"><div>

<div id="welcome">Gambas Bug Tracker</div>

<div id="login-frame">

<div align="center"><img id="logo"
src="/bugtracker/img/logo.png?domain=bugtracker"></div>

<form action="/bugtracker" name="f" method="post">

<table border="0" cellspacing="0" cellpadding="0">
<tr><td class="label">
Login
</td><td>
<input maxlength="64" id="login" name="login" tabindex="1" value="Cicciobello">
</td></tr><tr><td class="label">
Password
</td><td>
<input type="password" maxlength="32" id="password" name="password"
tabindex="2">
</td></tr><tr><td colspan="2">
<div class="buttons">
<button type="submit" name="connect" value="Login" tabindex="3"
id="button">Login</button>
<button type="button" onclick="click_register();">Register >></button>
</div>
</td></tr>

</table>

<input type="hidden" name="date" id="date" value="">

</form>

<div class="message"><div class="warning"></div>
</div>

</div>

<div id="register-frame" style="display:none">

<form action="/bugtracker?register" name="r" method="post">

<table border="0" cellspacing="0" cellpadding="0">
<tr><td class="label">
Login
</td><td width="100%">
<input type="text" name="rlogin" value="" maxlength="32">
</td></tr><tr><td class="label">
Password
</td><td>
<input type="password" name="rpassword" value="" maxlength="32">
</td></tr><tr><td class="label">
Confirm password
</td><td>
<input type="password" name="cpassword" value="" maxlength="32">
</td></tr><tr><td class="label">
First name
</td><td>
<input type="text" name="fname" value="" maxlength="64">
</td></tr><tr><td class="label">
Last name
</td><td>
<input type="text" name="lname" value="" maxlength="64">
</td></tr><tr><td class="label">
E-mail
</td><td>
<input type="text" name="email" value="" maxlength="64">
</td></tr><tr><td class="label">
Confirm e-mail
</td><td>
<input type="text" name="cemail" value="" maxlength="64">
</td></tr>
</table>

<div class="info">Prove that your are a human by entering the
following words.</div>

<div align="center">
<table border="0" cellspacing="0" cellpadding="0">
<tr><td colspan="2">
<div class="captcha"><img src="/bugtracker/captcha?key=125177179"></div>
</td></tr><tr><td colspan="2">
<input type="text" name="captcha" value=""
style="width:100%;font-family:monospace;">
</td></tr><tr><td>
</table>
</div>

<input type="hidden" name="key" value="125177179">

<div class="buttons">
<button type="submit" name="register" value="Register" tabindex="3"
id="button">Register</button>
<button type="button" onclick="click_register();">Cancel</button>
</div>

<div class="info">A mail will be sent to your e-mail address with a
confirmation link.
<br>You will have to click on that link to activate your account.</div>

</form>

<div class="message"></div>

</div>

</div></div>

<script type="text/javascript">
function click_register()
{
var login = document.getElementById('login-frame');
var frame = document.getElementById('register-frame');

if (frame.style.display != "block")
{
frame.style.display = 'block';
login.style.display = 'none';
document.r.rlogin.focus();
}
else
{
window.location.href = '/bugtracker';
}
}

if (window.location.search == '?register')
click_register();

</script>

</body>


<div id="warning" align="center">
  <b>IMPORTANT :</b>
  Afin d'optimiser la rapidité d'affichage des cartes, nous vous
conseillons d'utiliser Omogen<br>
  avec
  <a href="http://www.mozilla-europe.org/fr/firefox/"
target="_blank">Mozilla Firefox</a>, <a
href="https://www.google.com/chrome" target="_blank">Google
Chrome</a>,
  <a href="https://www.apple.com/fr/safari/" target="_blank">Apple
Safari</a> ou éventuellement Internet Explorer 9.
  <p>
  Les versions 6 et 7 d'Internet Explorer peuvent poser des problèmes
d'affichage et sont déconseillées.
  L'usage d'Internet Explorer 8 est possible si le mode de
compatibilité est <i>désactivé</i>, mais il
  ralentit très fortement l'affichage des cartes et des objets
associés. Le facteur de ralentissement est fonction de votre
ordinateur
  et ne peut donc pas être généralisé.
  <p>
  <a href="http://www.omogen.pro" target="_blank">Omogen</a> 1.22.0
(master) © ASAP / <a href="http://gambas.sourceforge.net"
target="_blank">Gambas</a> 3.16.90

</div>

</body>
</html>

Regards
Gianluigi


More information about the User mailing list