Hello friends,
You can now log in to the mod harbour web app with a password or pattern lock.
Best regards,
Otto
function main
TEMPLATE
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=320, user-scalable=no, initial-scale=1.0, maximum-scale=1.0" />
<title>Pattern Lock</title>
<link rel="stylesheet" type="text/css" href="_style/patternlock.css"/>
<script src="_script/patternlock.js"></script>
<script>
function submitform(){
alert("PW you entered " + document.getElementById("password").value);
return true;
}
</script>
<style>
body{
text-align:center;
font-family:Arial, Helvetica, sans-serif;
}
</style>
</head>
<body>
<form method="post" onsubmit="return submitform()">
<h2>Please login</h2>
<div>
<input type="password" id="password" name="password" class="patternlock" />
<input type="submit" value="login"/>
</div>
</form>
</body>
</html>
ENDTEXT
return
//----------------------------------------------------------------------------//
<script>
function submitform(){
If document.getElementById("password").value="1234";
<a href=principal.prg></a>;
Else ;
alert("Error, intente de nuevo");
Endif;
return true;
}
</script>
function main
TEMPLATE
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=320, user-scalable=no, initial-scale=1.0, maximum-scale=1.0" />
<title>Pattern Lock</title>
<link rel="stylesheet" type="text/css" href="_style/patternlock.css"/>
<script src="_script/patternlock.js"></script>
<script>
function submitform(){
alert("PW you entered " + document.getElementById("password").value);
if (document.getElementById("password").value=="123") {
window.open("http://www.google.com/");
} else {
alert("Error, intente de nuevo");
}
return true;
}
</script>
<style>
body{
text-align:center;
font-family:Arial, Helvetica, sans-serif;
}
</style>
</head>
<body>
<form method="post" onsubmit="return submitform()">
<h2>Please login</h2>
<div>
<input type="password" id="password" name="password" class="patternlock" />
<input type="submit" value="login"/>
</div>
</form>
</body>
</html>
ENDTEXT
return
//----------------------------------------------------------------------------//
function main
TEMPLATE
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=320, user-scalable=no, initial-scale=1.0, maximum-scale=1.0" />
<title>Pattern Lock</title>
<link rel="stylesheet" type="text/css" href="_style/patternlock.css"/>
<script src="_script/patternlock.js"></script>
<script>
function submitform(){
alert("PW you entered " + document.getElementById("password").value);
if (document.getElementById("password").value=="123") {
window.open( "http://www.google.com", '_blank').focus();
} else {
alert("Error, intente de nuevo");
}
return true;
}
</script>
<style>
body{
text-align:center;
font-family:Arial, Helvetica, sans-serif;
}
</style>
</head>
<body>
<form method="post" onsubmit="return submitform()">
<h2>Please login</h2>
<div>
<input type="password" id="password" name="password" class="patternlock" />
<input type="submit" value="login"/>
</div>
</form>
</body>
</html>
ENDTEXT
return
//----------------------------------------------------------------------------//
<form action="save.prg?customer" method="post">
...
<button id="save" type="submit" class="btn btn-primary float-right">Save changes</button>
/*
Harbour Module for Apache
Autor: Lailton Fernando Mariano - <lailton@harbour.com.br>
Sample: Simple login
*/
#xtranslate HTML => #pragma __text| AP_RPuts(%s)
memvar hForm
function Main()
if loadForm()
// here we can check the credential
if getForm( "username" ) == "lailton" .and. getForm( "password" ) == "harbour"
page_home()
return nil
else
msgAlert( "User or password is not valid" )
endif
reload()
else
page_login()
endif
return nil
function page_home()
HTML
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<title>Harbour for Web</title>
</head>
<body style="padding:100px;">
<div class="jumbotron">
<h1 class="display-4">Welcome to the future!</h1>
<p class="lead">New mod_harbour for Apache!</p>
<hr class="my-4">
<p>Let us move on to the future together!</p>
<p>It is harbour for Apache!</p>
<a class="btn btn-primary btn-lg" href="form.prg" role="button">Back to login</a>
</div>
</body>
</html
ENDTEXT
return nil
function page_login()
HTML
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<title>Harbour for Web</title>
</head>
<body style="padding:100px;">
<form method="post">
<div class="form-group">
<label for="inputUsername">Email address</label>
<input type="text" class="form-control" id="inputUsername" placeholder="Benutzername" name="username">
<small class="form-text text-muted">Use the username "lailton" </small>
</div>
<div class="form-group">
<label for="inputPassword">Password</label>
<input type="password" class="form-control" id="inputPassword" placeholder="Password" name="password">
<small class="form-text text-muted">Password is "harbour"</small>
</div>
<button type="submit" class="btn btn-primary">Connect</button>
</form>
</body>
</html
ENDTEXT
return nil
function msgAlert( cMsg )
? "<script>alert('"+cMsg+"');</script>"
return nil
function reload()
? "<script>document.location.href = document.location.href;</script>"
return nil
function loadForm()
public hForm := AP_PostPairs()
return len( hForm ) > 0
function getForm( cKey )
local cVal := ""
if hb_HHasKey( hForm, cKey )
cVal := hForm[ cKey ]
endif
return cVal
function main
TEMPLATE
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>Form test</h1>
<form action="save.prg?customer" method="post">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<button id="save" type="submit" class="btn btn-primary float-right">Save changes</button>
</body>
</html>
ENDTEXT
return
//----------------------------------------------------------------------------//
save.prg
[code]
function main
? "<HR>"
? "AP_Body()"
? AP_Body()
? "<HR>"
? "AP_Method()"
? AP_Method()
? "<HR>"
? "AP_UserIP() --> cUserIP returns the IP, as string, of the client"
? AP_UserIP()
? "<HR>"
? "AP_HeadersIn() //--> Hash returns a hash with all headers pairs, key and value"
? AP_HeadersIn()
? "<HR>"
? "AP_FileName() --> cFileName returns the filename.prg provided to Apache by the client"
? ValToChar(AP_FileName())
? "<HR>"
? "AP_GetPairs() --> Hash returns a hash with all GET pairs, key and value "
? ValToChar(AP_GetPairs())
? "<HR>"
? "AP_Args() --> cArgs returns the args provided to Apache by the client if any "
? ValToChar( AP_Args() )
? "<HR>"
? "AP_PostPairs() --> Hash returns a hash with all POST pairs, key and value"
? ( AP_PostPairs() )
return
//----------------------------------------------------------------------------//
[/code]
Users browsing this forum: No registered users and 18 guests