Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - bmartino1

Pages: [1] 2 3 ... 52
1
HFS ~ HTTP File Server / Re: HFS behind Nginx reverse proxy
« on: September 15, 2018, 10:10:24 PM »
Did you bind hfs to a real folder.

I would first set a bind and then eidte or reuse the default template at the root in that folder(hfs.diff.tpl) before the proxy to verify file cashed and load.

Otherwise you will have to settle up IP hfs connect is on

2
HTML & templates / Re: Alternative login form for modern browsers
« on: August 28, 2018, 03:33:10 PM »
thank you leo, the code works fairly well.

I did attempt to add/change css and put form stuff in it as per dany request on what it might have... etc...

here is that code for refference.

Code: [Select]
[unauthorized]

<!-- I should be a EVENT Under the House - "Home icon / " Root Virtual File system!-->
<!-- include css file here-->
    <style> /* below line is write to use google font online  */
@import url(http://fonts.googleapis.com/css?family=Ubuntu);
 
h2{
 background-color: #FEFFED;
 padding: 30px 35px;
 margin: -10px -50px;
 /*text-align:center; */
 border-radius: 10px 10px 0 0;
}
 
hr{
 margin: 10px -50px;
 border: 0;
 border-top: 1px solid #ccc;
 margin-bottom: 40px;
}
 
div.container{
 width: 900px;
 height: 610px;
 margin:35px auto;
 font-family: 'Ubuntu', sans-serif;
}
 
div.main{
 width: 300px;
 padding: 10px 50px 25px;
 /* border: 2px solid gray; */
 border-radius: 10px;
 font-family: raleway;
 float:left;
 margin-top:50px;
}
 
input[type=text],input[type=password]{
 width: 150px;
 height: 40px;
 padding: 5px;
 margin-bottom: 25px;
 margin-top: 5px;
 border: 2px solid #ccc;
 color: #4f4f4f;
 font-size: 16px;
 border-radius: 5px;
}

label{
 color: #464646;
 text-shadow: 0 1px 0 #fff;
 font-size: 14px;
 font-weight: bold;
}

center{
 font-size:32px;
}

.note{
 color:red;
}
 
.valid{
 color:green;
}

.back{
 text-decoration: none;
 border: 1px solid rgb(0, 143, 255);
 background-color: rgb(0, 214, 255);
 padding: 3px 20px;
 border-radius: 2px;
 color: black;
}
 
input[type=button]{
 font-size: 16px;
 background: linear-gradient(#ffbc00 5%, #ffdd7f 100%);
 border: 1px solid #e5a900;
 color: #4E4D4B;
 font-weight: bold;
 cursor: pointer;
 width: 150px;
 border-radius: 5px;
 padding: 10px 0;
 outline:none;
}
 
input[type=button]:hover{
 background: linear-gradient(#ffdd7f 5%, #ffbc00 100%);
}

.fugo{
 float:right;
} </style>

<script>
function NewLogin() {
  var xhr = new XMLHttpRequest();
  var ThisFolder = window.location;
  var ThisUser = document.getElementById("usr").value;
  var ThisPass = document.getElementById("psw").value;
  var LoginToken = ThisUser+':'+ThisPass;
  xhr.open("GET", "/~login", true);
  xhr.withCredentials = true;
  xhr.setRequestHeader("Authorization", 'Basic ' + btoa(LoginToken));
  xhr.onreadystatechange = function() {
    if (xhr.readyState == 4 && xhr.status == 200) {
      if (window.location.href.indexOf("~login") != -1) {
        window.location.replace('/?success');
        } else {
          window.location.replace(ThisFolder);
      };
    }
    if (xhr.readyState == 4 && xhr.status == 401) {
      alert("Invalid credentials! \(Wrong username or password\)");
    }
  }
  xhr.send();
}
</script>
<h1>{.!Unauthorized.} {.!&#47; Please login&hellip;.}</h1>
{.!Either your user name and password do not match, or you are not permitted to access this resource..}<br>
{.!Please login to access to your account, and check if you have the correct permissions to continue..}<br>
<br>

<div class="container">
  <div class="main">
  <div align="left">
<!-- <h2>Login Form</h2><hr/> -->
<!-- <form id="form_id" name="myform"> -->
<fieldset id='login'>
  <legend><img src="/~img27"> {.!Login.}</legend>
  <center>
  <label for="uname">User Name :</label></br>
    <input type='text' class="form-control" id='usr' tabindex="1" size='15' placeholder=" Username" value="" required><br>
    <span class='error-message' id='uname-error'></span>

<label>Password :</label></br>
<input type='password' class="form-control" id='psw' tabindex="2" size='15' placeholder=" Password" value="" required><br>
    <span class='error-message' id='pw-error'></span>

<input type='button' tabindex="3" class="btn btn-default" id='lognow' style="width:110px;" value="{.!Login.}" onclick="NewLogin();">
    <span class='error-message' id='submit-error'></span>

<!--    <label><input type="checkbox" checked="checked" name="remember"> Remember me </label> -->
<!-- <button type="button" class="cancelbtn">Cancel</button> <span class="psw">Forgot <a href="#">password?</a></span> -->
<!-- </form> -->

 </center>
</fieldset>
</div>
  </div>
</div>
<br>
</br>
<!-- Did I work? -->
<p> User: %user% @ IP: %ip% </p>
</div>

i had did a test of 2 vitural folder eacch with 1 acount acess split between 2 accounts.

the unathoruzed code will log you in 1 for that folder (it doen't keep you loged in if i leave to another area.)

also the only way i could eror was to click ont he resouce and hit cancle
thus i hit the even t created 404 login.
but you err wrong credential broungh back the default login box (had to hit cancle) before i saw the alert.

other wise, exclent code, and thank you for this.

Also looks like o need to relearn the xml httl request and HTML code :/
https://stackoverflow.com/questions/28238514/login-form-valiation-using-xmlhttprequest

3
HTML & templates / Re: No cookies for a certain folder?
« on: August 28, 2018, 02:32:49 PM »
I was wondering if it were possible, probably with hfs.events, to have no cookies issued or attempted for a certain folder? 
Perhaps it is a folder of support graphics, such as wallpapers; or, perhaps HFS is pulling dual duty also supporting a wholly different website in addition to its normal duties.  Or, in my case, I need to do that for markup speed testing.

i don't know if it removes the cookie, mars has code that edits the session id withi is the cookie..:
then rejeto rescenlty add header removal stuff like this code here:

http://rejetto.com/forum/index.php?topic=13046.msg1063940#msg1063940
http://rejetto.com/forum/index.php?topic=11705.0

i don't know if the header option removes the actual cookie or if it removes its signature form the webpage...

...
if this is about potential logout function???.. thers lots of stuff on the forum:
http://rejetto.com/forum/index.php?action=search2;params=YWR2YW5jZWR8J3wwfCJ8YnJkfCd8MjEsMzYsMjIsMzcsMjgsMjQsMzQsMjcsMzMsMiwzLDIwLDE2LDE1LDIzLDEyLDEzfCJ8c2hvd19jb21wbGV0ZXwnfHwifHN1YmplY3Rfb25seXwnfHwifHNvcnR8J3xyZWxldmFuY2V8Inxzb3J0X2RpcnwnfGRlc2N8InxzZWFyY2h8J3xsb2dvdXQ=

http://rejetto.com/forum/index.php?pretty;board=hfs-~-http-file-server;topic=hfs-logout.0
http://rejetto.com/forum/index.php?topic=6855.msg1061486#msg1061486

(lost on the forum some wher :/ )
*Looking for 2 specifc posts...
i remember a breakdown and code examples with another user, myself, rejetto chimed in.. in witch we thought reverse logic for logout might work, talking about logout and and anothe post regarding the cookie ssid

And then there was a with hfs for someone regarding basic cockie creation.. issue with it, in itch mars had info and code regarding the cookie (and its recreations/deletion)
Some other links:
http://rejetto.com/forum/index.php?topic=11558.0
http://rejetto.com/forum/index.php?topic=11489.msg1059657#msg1059657
http://rejetto.com/forum/index.php?topic=11705.msg1061000#msg1061000
http://rejetto.com/forum/index.php?topic=11751.msg1061334#msg1061334

4
Pусский / Re: Вопросы по HFS
« on: August 27, 2018, 08:05:41 PM »
google translate :\



it in the hfs menu

http://www.rejetto.com/wiki/index.php/HFS:_IP_masks

ip mask

To exclude an IP, put a backslash \ before it:

so i want to allow only ip 192.168.1.254
i would have a mask of "\192.168.1.254"

and to ban all other ip i would have a mask of ???
i asume " *.*.*.* " 

see pictures

Гугл переводчик :/

это в меню hfs

http://www.rejetto.com/wiki/index.php/HFS:_IP_masks

ip-маска

Чтобы исключить IP, поместите обратную косую черту \ перед ней:

поэтому я хочу разрешить только ip 192.168.1.254
у меня была бы маска "\ 192.168.1.254"

и запретить все другие ip у меня будет маска ???
i asume "*. *. *. *"

см. фотографии
Gugl perevodchik :/

eto v menyu hfs

http://www.rejetto.com/wiki/index.php/HFS:_IP_masks

ip-maska

Chtoby isklyuchit' IP, pomestite obratnuyu kosuyu chertu \ pered ney:

poetomu ya khochu razreshit' tol'ko ip 192.168.1.254
u menya byla by maska "\ 192.168.1.254"

i zapretit' vse drugiye ip u menya budet maska ???
i asume "*. *. *. *"

sm. fotografii

5
HTML & templates / Re: Simple contact template
« on: August 27, 2018, 08:03:06 PM »
@Leo,

I believe i have enough info no on how to write the correct content to a text file for a true el structure...
The original eml file you have in your original post was missing JavaScript variables, and in the end would not work after code fixes and changes I made, before I started the validation implementation.

I was having a hard time finding a good true example to put the data together, as i find the macro write for this to be a tad easier then the xml post, ill re edit the eml after i change things around and fix what i have on my end. at that point, i'm will to leave it alone, (Because now i know what i'm trying to write/put data content together :p )

thank you for the clarification and example file i have here:

https://www.online-convert.com/file-format/eml

file: https://cdn.online-convert.com/example-file/document/eml/example.eml

Code: [Select]
Return-Path: <time2talk@online-convert.com>
X-Original-To: time2help@online-convert.com
Delivered-To: time2help@online-convert.com
Received: from vwp0096.webpack.hosteurope.de (vwp0096.webpack.hosteurope.de [87.230.60.103])
by tectrend.de (Postfix) with ESMTPS id AFFC171C0091
for <time2help@online-convert.com>; Wed, 17 Feb 2016 08:11:25 +0100 (CET)
Received: from p549a9204.dip0.t-ipconnect.de ([84.154.146.4] helo=[192.168.2.107]); authenticated
by vwp0096.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
id 1aVwGj-0002PO-95; Wed, 17 Feb 2016 08:11:25 +0100
From: Online-Convert.com <time2talk@online-convert.com>
Subject: =?UTF-8?Q?_EML Example File?=
References: <time2talk@online-convert.com>
To: Online-Convert.com <time2help@online-convert.com>
Message-ID: <56C41D18.3060102@online-convert.com>
Date: Wed, 17 Feb 2016 08:11:20 +0100
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101
 Thunderbird/38.5.1
MIME-Version: 1.0
In-Reply-To: <1SOLws-0BH0K00@online-convert.com>
Content-Type: multipart/alternative;
 boundary="------------050008080707050500070109"
X-bounce-key: webpack.hosteurope.de;time2talk@online-convert.com;1455693085;1ff5b968;

This is a multi-part message in MIME format.
--------------050008080707050500070109
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit

**
EML test file
Purpose: Provide example of this file type
Document file type: EML
Version: 1.0
Remark:

Example content:
The names "John Doe" for males, "Jane Doe" or "Jane Roe" for females, or "Jonnie Doe" and "Janie Doe" for children, or just "Doe" non-gender-specifically are used as placeholder names for a party whose true identity is unknown or must be withheld in a legal action, case, or discussion. The names are also used to refer to acorpse or hospital patient whose identity is unknown. This practice is widely used in the United States and Canada, but is rarely used in other English-speaking countries including the United Kingdom itself, from where the use of "John Doe" in a legal context originates. The names Joe Bloggs or John Smith are used in the UK instead, as well as in Australia and New Zealand.

John Doe is sometimes used to refer to a typical male in other contexts as well, in a similar manner to John Q. Public, known in Great Britain as Joe Public, John Smith or Joe Bloggs. For example, the first name listed on a form is often John Doe, along with a fictional address or other fictional information to provide an example of how to fill in the form. The name is also used frequently in popular culture, for example in the Frank Capra film Meet John Doe. John Doe was also the name of a 2002 American television series.

Similarly, a child or baby whose identity is unknown may be referred to as Baby Doe. A notorious murder case in Kansas City, Missouri, referred to the baby victim as Precious Doe. Other unidentified female murder victims are Cali Doe and Princess Doe. Additional persons may be called James Doe, Judy Doe, etc. However, to avoid possible confusion, if two anonymous or unknown parties are cited in a specific case or action, the surnames Doe and Roe may be used simultaneously; for example, "John Doe v. Jane Roe". If several anonymous parties are referenced, they may simply be labelled John Doe #1, John Doe #2, etc. (the U.S. Operation Delego cited 21 (numbered) "John Doe"s) or labelled with other variants of Doe / Roe / Poe / etc. Other early alternatives such as John Stiles and Richard Miles are now rarely used, and Mary Major has been used in some American federal cases.



File created by http://www.online-convert.com
More example files: http://www.online-convert.com/file-type
Text of Example content: Wikipedia (http://en.wikipedia.org/wiki/John_Doe)
License: Attribution-ShareAlike 3.0 Unported (http://creativecommons.org/licenses/by-sa/3.0/)

Feel free to use and share the file according to the license above.




--------------050008080707050500070109
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit

<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <font style="font-family: arial,helvetica,sans-serif;" size="2"> </font><b><font
        color="#660b23" face="Arial"> </font></b> <font
      style="font-family: arial,helvetica,sans-serif;" size="2">
      <div style="POSITION: relative">
<h2>EML test file</h2>
Purpose: Provide example of this file type<br>
Document file type: EML<br>
Version: 1.0<br>
Remark:<br><br>

Example content:<br>
The names "<b>John Doe</b>" for males, "<b>Jane Doe</b>" or "<b>Jane Roe</b>" for females, or "Jonnie Doe" and "Janie Doe" for children, or just "Doe" non-gender-specifically are used as placeholder names for a party whose true identity is unknown or must be withheld in a legal action, case, or discussion. The names are also used to refer to acorpse or hospital patient whose identity is unknown. This practice is widely used in the United States and Canada, but is rarely used in other English-speaking countries including the United Kingdom itself, from where the use of "John Doe" in a legal context originates. The names Joe Bloggs or John Smith are used in the UK instead, as well as in Australia and New Zealand.
<br><br>
John Doe is sometimes used to refer to a typical male in other contexts as well, in a similar manner to John Q. Public, known in Great Britain as Joe Public, John Smith or Joe Bloggs. For example, the first name listed on a form is often John Doe, along with a fictional address or other fictional information to provide an example of how to fill in the form. The name is also used frequently in popular culture, for example in the Frank Capra film Meet John Doe. John Doe was also the name of a 2002 American television series.
<br><br>
Similarly, a child or baby whose identity is unknown may be referred to as Baby Doe. A notorious murder case in Kansas City, Missouri, referred to the baby victim as Precious Doe. Other unidentified female murder victims are Cali Doe and Princess Doe. Additional persons may be called James Doe, Judy Doe, etc. However, to avoid possible confusion, if two anonymous or unknown parties are cited in a specific case or action, the surnames Doe and Roe may be used simultaneously; for example, "John Doe v. Jane Roe". If several anonymous parties are referenced, they may simply be labelled John Doe #1, John Doe #2, etc. (the U.S. Operation Delego cited 21 (numbered) "John Doe"s) or labelled with other variants of Doe / Roe / Poe / etc. Other early alternatives such as John Stiles and Richard Miles are now rarely used, and Mary Major has been used in some American federal cases.
<br><br>


File created by <a href="http://www.online-convert.com" target="_blank">http://www.online-convert.com</a><br>
More example files: <a href="http://www.online-convert.com/file-type" target="_blank">http://www.online-convert.com/file-type</a><br>
Text of Example content: <a href="http://en.wikipedia.org/wiki/John_Doe" target="_blank">Wikipedia</a><br>
License: <a href="http://creativecommons.org/licenses/by-sa/3.0/" target="_blank">Attribution-ShareAlike 3.0 Unported</a><br><br>

Feel free to use and share the file according to the license above.<br>
          <br>
        </font><br>
        <br>
      </div>
    </font>
  </body>
</html>

--------------050008080707050500070109--

it looks like we will be construing a eml html webpage of sorts to fill in true header and message content. Now that i also have the uscert rf288 mimetype, i can look deeper into the bare min for the eml file and write constrution.

atm i will leave the code alone as i'm also on a curtent time crunch.

6
Pусский / Re: Вопросы по HFS
« on: August 25, 2018, 02:47:15 AM »
I'm not aware of a specific Russian only build. It is possible now to use the initiative and hfs to do a language transition to Russian.

Try the language specific board? http://rejetto.com/forum/index.php?board=39.0

@Leo would be better at potential explanation to a post of the language stuff as it is floating around.


As to security right mouse click the folder in hfs.
Properties
Access tab
Add account

*Folder auth access will then be required to access files.

7
Final code revision for form auth:

https://stackoverflow.com/questions/3079031/login-form-for-http-basic-auth

Code: [Select]
<!DOCTYPE html>
<!-- I should be in a VITURAL FOLDER! called AUTH -->
<html>
<head>
<meta charset=UTF-8 />
<meta name="viewport" content="width=device-width, initial-scale=1">
    <title>HFS Login Form</title>
<link rel="stylesheet" href="/?mode=section&id=style.css" type="text/css">
    <script type="text/javascript" src="/?mode=jquery"></script>
<link rel="shortcut icon" href="/favicon.ico">
<style class='trash-me'>
.onlyscript, button[onclick] { display:none; }
</style>
    <script>
    // this object will store some %symbols% in the javascript space, so that libs can read them
    HFS = { folder:'{.js encode|%folder%.}', number:%number%, paged:{.!option.paged.} };
    </script>
<script type="text/javascript" src="/?mode=section&id=lib.js"></script>
</head>

[box login]
<fieldset id='login'>
<legend><img src="/~img27"> {.!User.}</legend>
<center>
{.if| {.length|%user%.} |{:
            %user%
            {.if|{.can change pwd.} |
                <button onclick='changePwd.call(this)' style='font-size:x-small;'>{.!Change password.}</button>
            .}
            :}
            | <a href="~login">Login</a>
        .}
</center>
</fieldset>       

[lib.js|no log]
<script>
function changePwd() {
    ezprompt(this.innerHTML, {type:'password'}, function(s){
        if (s) ajax('changepwd', {'new':s}, getStdAjaxCB([
            "!{.!Password changed, you'll have to login again..}",
            '>~login'
        ]));
    });
}//changePwd
</script>

[]
<!-- Fix Permission to folder upload access (hfs macro) for login to authenticate may not be needed -->
{.set item|%folder%|add upload=@anyone.}

<!-- include css file here-->
    <style> /* below line is write to use google font online  */
@import url(http://fonts.googleapis.com/css?family=Ubuntu);
 
h2{
 background-color: #FEFFED;
 padding: 30px 35px;
 margin: -10px -50px;
 text-align:center;
 border-radius: 10px 10px 0 0;
}
 
hr{
 margin: 10px -50px;
 border: 0;
 border-top: 1px solid #ccc;
 margin-bottom: 40px;
}
 
div.container{
 width: 900px;
 height: 610px;
 margin:35px auto;
 font-family: 'Ubuntu', sans-serif;
}
 
div.main{
 width: 300px;
 padding: 10px 50px 25px;
 border: 2px solid gray;
 border-radius: 10px;
 font-family: raleway;
 float:left;
 margin-top:50px;
}
 
input[type=text],input[type=password]{
 width: 100%;
 height: 40px;
 padding: 5px;
 margin-bottom: 25px;
 margin-top: 5px;
 border: 2px solid #ccc;
 color: #4f4f4f;
 font-size: 16px;
 border-radius: 5px;
}

label{
 color: #464646;
 text-shadow: 0 1px 0 #fff;
 font-size: 14px;
 font-weight: bold;
}

center{
 font-size:32px;
}

.note{
 color:red;
}
 
.valid{
 color:green;
}

.back{
 text-decoration: none;
 border: 1px solid rgb(0, 143, 255);
 background-color: rgb(0, 214, 255);
 padding: 3px 20px;
 border-radius: 2px;
 color: black;
}
 
input[type=button]{
 font-size: 16px;
 background: linear-gradient(#ffbc00 5%, #ffdd7f 100%);
 border: 1px solid #e5a900;
 color: #4E4D4B;
 font-weight: bold;
 cursor: pointer;
 width: 100%;
 border-radius: 5px;
 padding: 10px 0;
 outline:none;
}
 
input[type=button]:hover{
 background: linear-gradient(#ffdd7f 5%, #ffbc00 100%);
}

.fugo{
 float:right;
} </style>

<!-- include javascript file here-->
    <script>

var attempt = 3; //Variable to count number of attempts

//Below function Executes on click of login button
function validate(){
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;

if ( username == "" && password == ""){
alert ("Login successfully");
window.location = "/"; //redirecting to other page
return false;
}
else{
attempt --;//Decrementing by one
alert("You have left "+attempt+" attempt;");

//Disabling fields after 3 attempts
if( attempt == 0){
document.getElementById("username").disabled = true;
producePrompt('Disabled', 'uname-error', 'red');
document.getElementById("password").disabled = true;
producePrompt('Disabled', 'pw-error', 'red');
document.getElementById("login").disabled = true;
producePrompt('Disabled', 'submit-error', 'red');
return false;
}
}
}

function submitted() {
var name = document.getElementById("username").value
var pw = document.getElementById("password").value
var ip = %ip%
var path = AUTH
document.location = "http://"+"name"+":"+"password"+"@"+"ip"+"path";
return true
}
</script>
     

  <body>
<div class="container">
  <div class="main">
<h2>Login Form</h2><hr/>
<form id="form_id" method="post" name="myform">
  <label for="uname">User Name :</label></br>
  <input type="text" class="form-control" tabindex="1" placeholder="Please Enter Your Username" name="username" id="username" required /></br>
<span class='error-message' id='uname-error'></span>

  <label>Password :</label></br>
  <input type="password" class="form-control" tabindex="2" placeholder="Please Enter Your Password" name="password" id="password" required /></br>
<span class='error-message' id='pw-error'></span>

  <input type="button" name="Login" tabindex="3" class="btn btn-default" value="Login" id="submit" onsubmit="Submitted()"/>
  <!-- onclick="Validate()" -->
    <span class='error-message' id='submit-error'></span>

<!--    <label><input type="checkbox" checked="checked" name="remember"> Remember me </label> -->
<!-- <button type="button" class="cancelbtn">Cancel</button> <span class="psw">Forgot <a href="#">password?</a></span> -->
</form>
  </div>
</div>
</br>
<!-- Didi I work? -->
<p> User: %user% @ IP: %ip% </p>
<!-- HFS Built in via default template -->
<div id='panel'>
{.$box login.}
</div>

<!-- <script> $.ajax({
   'url': 'http://host.com/',
   //'otherSettings': 'othervalues',
   username: $("username").val(),
   password: $("password").val()
   },
   sucess: function(result) {
     alert('done');
   }
});
</script>
Ajax pass username and password via url example: admin:mysecret@127.0.0.1/AUTH
https://stackoverflow.com/questions/3079031/login-form-for-http-basic-auth
-->
 </body>
</html>

i see no advantage for HFS using a form over the default browser basic auth for login credentials.
*as to my knowdlge regardless of the webcode, hfs source code would need to be updated to improve or select auth encoding for login credentiasl. Base64(although encodeing via default broswer login auth is still concerdised clear text to packet sniffers...) Any form would be under the same issue with authentication. Stunnel would be required or other way to send credentials via a secure conections...

this is as far as i can take this code atm.

hfs default template has some base code along with jqurey and other with the html form code, it could be done, but it is beyond my codeing skills atm.

i recall a old hfs function that had the username and passwords in the url, probally pass login credentials via url as example:
username:password@IP/Folder
admin:mysecret@127.0.0.1/AUTH

Good luck with futher form code and login credentials stufff. :/

(as to your erro page nonstop reequest, as i agree a 404 error should stop, i see a faster / easier fix.)

add html header option to redirect page to a end page
A error404 vitural folder with a differnet template tap of a 404 picture. thus stoping the nostop error...

8
That uses a browser's built in (or not) basic auth pop-up login box.  Support for that is diminishing.  We need an html login form instead. 

I think it would be elegant to add a real html login form into the error handler [unauthorized] section, because it is the default landing page for all browsers that don't have a basic auth login box built in.  So, then, instead of a nonstop error, you'd just log in (with a real login form).  It is very nice when error pages actually solve errors.  However, still need that login form. 
Code for it should probably have form and post tags.

So I'm looking into this more and more,  and getting a bit more Info to attempt to begin codeing and testing this form login page...

Login form for HFS...
website key notes and code sources:

http://blog.stevensanderson.com/2008/08/25/using-the-browsers-native-login-prompt/
https://www.w3schools.com/howto/howto_css_login_form.asp
https://www.formget.com/javascript-login-form/
HFS default template...
?raybob script for filezilla
?stunnel for security? ...

Looks like it will be a basic form page with Passing macro credentials of the users to hfs.

Rayboy; Has some similar code from fhfs for filezilla...

ATM, it looks like there will be a need for a basic stunnel config as regardless of encoding, it still clear text over the internet....

////////////////////////////////////////
ATM , But not finding a good solution/way to parse that to hfs for the ability to login nor pas its credentials?

Mars/Rejeto might have some answer/Clues.
*(may even have to have a special link hard coded to hfs (but this may become insecure/ create a vulnerability...

So, here is a sample of that code (still writing and some what untested, but to show you what i have atm:

Code will uses basic browser form to pass authentication ... ATM still using hfs default template code and login link...

Working form, but no parse macro code atm...:

Code: [Select]

<!DOCTYPE html>
<!-- I should be in a VITURAL FOLDER! called AUTH -->
<html>
<head>
<meta charset=UTF-8 />
<meta name="viewport" content="width=device-width, initial-scale=1">
    <title>HFS Login Form</title>
<link rel="stylesheet" href="/?mode=section&id=style.css" type="text/css">
    <script type="text/javascript" src="/?mode=jquery"></script>
<link rel="shortcut icon" href="/favicon.ico">
<style class='trash-me'>
.onlyscript, button[onclick] { display:none; }
</style>
    <script>
    // this object will store some %symbols% in the javascript space, so that libs can read them
    HFS = { folder:'{.js encode|%folder%.}', number:%number%, paged:{.!option.paged.} };
    </script>
<script type="text/javascript" src="/?mode=section&id=lib.js"></script>
</head>

[box login]
<fieldset id='login'>
<legend><img src="/~img27"> {.!User.}</legend>
<center>
{.if| {.length|%user%.} |{:
            %user%
            {.if|{.can change pwd.} |
                <button onclick='changePwd.call(this)' style='font-size:x-small;'>{.!Change password.}</button>
            .}
            :}
            | <a href="~login">Login</a>
        .}
</center>
</fieldset>       

[lib.js|no log]
<script>
function changePwd() {
    ezprompt(this.innerHTML, {type:'password'}, function(s){
        if (s) ajax('changepwd', {'new':s}, getStdAjaxCB([
            "!{.!Password changed, you'll have to login again..}",
            '>~login'
        ]));
    });
}//changePwd
</script>

[]
<!-- Fix Permission to folder upload access (hfs macro) for login to authenticate may not be needed -->
{.set item|%folder%|add upload=@anyone.}

<!-- include css file here-->
    <style> /* below line is write to use google font online  */
@import url(http://fonts.googleapis.com/css?family=Ubuntu);
 
h2{
 background-color: #FEFFED;
 padding: 30px 35px;
 margin: -10px -50px;
 text-align:center;
 border-radius: 10px 10px 0 0;
}
 
hr{
 margin: 10px -50px;
 border: 0;
 border-top: 1px solid #ccc;
 margin-bottom: 40px;
}
 
div.container{
 width: 900px;
 height: 610px;
 margin:35px auto;
 font-family: 'Ubuntu', sans-serif;
}
 
div.main{
 width: 300px;
 padding: 10px 50px 25px;
 border: 2px solid gray;
 border-radius: 10px;
 font-family: raleway;
 float:left;
 margin-top:50px;
}
 
input[type=text],input[type=password]{
 width: 100%;
 height: 40px;
 padding: 5px;
 margin-bottom: 25px;
 margin-top: 5px;
 border: 2px solid #ccc;
 color: #4f4f4f;
 font-size: 16px;
 border-radius: 5px;
}

label{
 color: #464646;
 text-shadow: 0 1px 0 #fff;
 font-size: 14px;
 font-weight: bold;
}

center{
 font-size:32px;
}

.note{
 color:red;
}
 
.valid{
 color:green;
}

.back{
 text-decoration: none;
 border: 1px solid rgb(0, 143, 255);
 background-color: rgb(0, 214, 255);
 padding: 3px 20px;
 border-radius: 2px;
 color: black;
}
 
input[type=button]{
 font-size: 16px;
 background: linear-gradient(#ffbc00 5%, #ffdd7f 100%);
 border: 1px solid #e5a900;
 color: #4E4D4B;
 font-weight: bold;
 cursor: pointer;
 width: 100%;
 border-radius: 5px;
 padding: 10px 0;
 outline:none;
}
 
input[type=button]:hover{
 background: linear-gradient(#ffdd7f 5%, #ffbc00 100%);
}

.fugo{
 float:right;
} </style>

<!-- include javascript file here-->
    <script>

var attempt = 3; //Variable to count number of attempts

//Below function Executes on click of login button
function validate(){
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;

if ( username == "" && password == ""){
alert ("Login successfully");
window.location = "/"; //redirecting to other page
return false;
}
else{
attempt --;//Decrementing by one
alert("You have left "+attempt+" attempt;");

//Disabling fields after 3 attempts
if( attempt == 0){
document.getElementById("username").disabled = true;
producePrompt('Disabled', 'uname-error', 'red');
document.getElementById("password").disabled = true;
producePrompt('Disabled', 'pw-error', 'red');
document.getElementById("login").disabled = true;
producePrompt('Disabled', 'submit-error', 'red');
return false;
}
}
}
</script>
     

  <body>
<div class="container">
  <div class="main">
<h2>Login Form</h2><hr/>
<form id="form_id" method="post" name="myform">
  <label for="uname">User Name :</label></br>
  <input type="text" class="form-control" tabindex="1" placeholder="Please Enter Your Username" name="username" id="username" required /></br>
<span class='error-message' id='uname-error'></span>

  <label>Password :</label></br>
  <input type="password" class="form-control" tabindex="2" placeholder="Please Enter Your Password" name="password" id="password" required /></br>
<span class='error-message' id='pw-error'></span>

  <input type="button" name="Login" tabindex="3" class="btn btn-default" value="Login" id="submit" onclick="validate()"/>
    <span class='error-message' id='submit-error'></span>

<!--    <label><input type="checkbox" checked="checked" name="remember"> Remember me </label> -->
<!-- <button type="button" class="cancelbtn">Cancel</button> <span class="psw">Forgot <a href="#">password?</a></span> -->
</form>
  </div>
</div>
</br>
<!-- Didi I work? -->
<p> User: %user% @ IP: %ip% </p>
<!-- HFS Built in via default template -->
<div id='panel'>
{.$box login.}
</div>

 </body>
</html>

actual code is still a mess atm...

I still need hfs info suchas a link/symbol to pass code into. NOT a easy task nor a simple thing to do.

10
@DJ: It looks like the 'forEach' function is not recognized. I've tested several not-so-updated browsers:

In Chrome 31 (old version), the console shows this error:
Code: [Select]
Uncaught TypeError: Object #<NodeList> has no method 'forEach' (index):130
In Firefox 24 ESR (old version), the console shows this error:
Code: [Select]
TypeError: document.querySelectorAll(...).forEach is not a function
In Firefox (another old version), the console shows this error:
Code: [Select]
Error: document.querySelectorAll(".option_button").forEach is not a function
In KMeleon (an old fork of Firefox), the console shows this error:
Code: [Select]
Error: TypeError: document.querySelectorAll(...).forEach is not a function
On QtWeb (an old fork of Chrome), the console shows this error:
Code: [Select]
TypeError: 'undefined' is not a function (evaluating 'document.querySelectorAll(".option_button").forEach(function(o){o.onclick=function(){window.alert(o.value)}})')
Differences:

In Throwback7rev2.tpl there is no modal dialog at all (and the 'Uncaught TypeError' shows up on the console only once, when loading the page).

In Throwback7rev2.2.tpl the modal dialog shows up, but the file doesn't get deleted (it asks: 'Delete filename.xxx?', but when clicking on 'OK' the 'Uncaught TypeError' shows up again on the console (this error also appears when loading the page).

It would be great if we can use another function compatible with those browsers. I'm not expert on these matters, but perhaps using for loop instead of forEach, could solve this problem (or else using another methods). ???

or setup if statement to check if it can run then run if it can
https://www.w3.org/community/webed/wiki/Optimizing_content_for_different_browsers:_the_RIGHT_way

Why feature detection is better
Feature detection is a much better way to do things — instead of seeing what browser is accessing the content and serving appropriate code, the idea here is to query the browser to detect whether it supports the features our content relies on, and then serve content as appropriate. Let's take HTML5 video as an example. You could detect support using some simple code such as this:

javascript code:
Code: [Select]
if(!!document.createElement('video').canPlayType === true) {
  // run some code that relies on HTML5 video
} else {
  // do something else
}

This is much more future proof, because existing browsers that support HTML5 video will run the correct code, and future browsers that support HTML5 video will do as well. You don't have to keep updating your code each time a new browser is released.

11
HTML & templates / Re: Simple contact template
« on: August 10, 2018, 04:33:23 AM »
As Per Leo Request.

Here is the post for the EML code

Using the xml final draft upgrades to the orginal eml version provided via leo:
Info and orgnall eml template write, and fixes from other codes/sources, i have finished my final working draft of the eml code

*This code is still a work in progress as there are some edits and sugestions about this on the post...

Current errors:

Form doesn't clear when finished after submit is clicked, but message is sent and written
-- I believe in the end of the code where the alert box is should be a clear end code... (as it should clear the form after a successful submit)


here is the code for view/quick review
Code: [Select]
<!DOCTYPE html>
<html>
<!-- Rejeto HFS Macro Commands via LEO sends to hfs via text (XML) -->
<!-- Fix Permission to folder upload access (hfs macro)? -->
{.set item|%folder%|add upload=@anonymous.}

<head>
<meta charset=UTF-8 />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Contact Form using JavaScript</title>   
</head>

<!-- include css file here -->
<!--   <link rel="stylesheet" href="/Contact/form.css"/>   -->
<style type="text/css">
/* below line is write to use google font online  */
@import url(http://fonts.googleapis.com/css?family=Ubuntu);
* {
margin: 0;
padding: 0;
}

body {
font-size: 62.5%;
        font-family: 'Ubuntu', sans-serif;
}

p {
font-size: 1.3em;
margin-bottom: 15px;
}

#page-wrap {
width: 660px;
background: white;
padding: 20px 50px 20px 50px;
margin: 20px auto;
min-height: 300px;
height: auto !important;
height: 300px;
}

#contact-area {
width: 600px;
margin-top: 25px;
}

#contact-area input, #contact-area textarea {
padding: 5px;
width: 471px;
        font-family: 'Ubuntu', sans-serif;
font-size: 1.4em;
margin: 0px 0px 10px 0px;
border: 2px solid #CCC;
}

#contact-area textarea {
height: 90px;
}

#contact-area textarea:focus, #contact-area input:focus {
border: 2px solid #FC0;
}

#contact-area button.submit-button {
width: 100px;
height: 30px;
float: right;
cursor: default;
color: buttontext;
text-align: center;
padding: 2px 6px 3px;
box-sizing: border-box;
align-items: flex-start;
border: 0px outset buttonface;
-webkit-appearance: push-button;
        font-family: 'Ubuntu', sans-serif;
font-size: 1.4em;
white-space: pre;
}

label {
float: left;
text-align: right;
margin-right: 15px;
width: 100px;
padding-top: 5px;
font-size: 1.4em;
}

/* -------------------------------------
    CSS for sidebar (optional)
---------------------------------------- */
div#fugo{
float:right;
}
</style>

<body>
<div id="page-wrap">
<p><h1>&laquo; Contacting the Server Administrator &raquo;</h1></p>
<div id="contact-area">
<!-- <form method="GET"> -->
<!-- https://www.w3schools.com/tags/att_input_type.asp -->
<label for="contact-name">Full Name:</label>
<input type="text" tabindex="1" class="form-control" name="NameA" id="NameB" placeholder="Please Enter Your Full Name.." onkeyup='validateName()'>
            <div style="text-align: right"><span class='error-message' id='name-error'></span></div>

<label for="contact-email">Email Address:</label>
            <input type="email" tabindex="2" class="form-control" name="MailA" id="MailB" placeholder="Please Enter a valid Email (your@email.com) " onkeyup='validateEmail()'>
            <div style="text-align: right"><span class='error-message' id='email-error'></span></div>

<label for="contact-subject">Subject:</label><br />
            <input type="text" tabindex="3" class="form-control" name="SubjectA" id="SubjectB" placeholder="Ex: I Have Experienced an Error" onkeyup='validateSubject()'>
            <div style="text-align: right"><span class='error-message' id='subject-error'></span></div>

<label for='contactMessage'>Your Message:</label><br />
            <textarea name="MessageA" id="MessageB" rows="20" cols="20" class="form-control" tabindex="4" placeholder="Please Detail your needs - Enter a brief message" onkeyup='validateMessage()'></textarea>
            <div style="text-align: right"><span class='error-message' id='message-error'></span></div>
            <br /><br />
<div style="text-align: right"><span class='error-message' id='submit-error'></span></div>
<br />
<button id="SendMe" name="SubmitMessage" OnMouseOver='return validateForm()' class="submit-button" tabindex="5" onclick="sendMessage(); return false">{.!Submit.}</button>
<!-- ?cani have both in a single line or will one parse out before the other? buton onclick validation became OnMouseOver / a html embeded javascript function -->
<!-- </form> -->
</div>
</div>

<!-- Validation code using Leos ids -->

<script type="text/javascript">
//Creates box and validate textbox content for a name
function validateName() {

  var name = document.getElementById('NameB').value;

  if(name.length == 0) {

    producePrompt('Name is required', 'name-error' , 'red')
    return false;

  }

  if (!name.match(/^[A-Za-z]*\s{1}[A-Za-z]*$/)) {

    producePrompt('First and Last name, please.','name-error', 'red');
    return false;

  }

  producePrompt('Valid', 'name-error', 'green');
  return true;

}

//Creates box and validate textbox content for a Email Subject
function validateSubject() {

  var submessage = document.getElementById('SubjectB').value;
  var required = 2;
  var left = required - submessage.length;

  if (left > 0) {
    producePrompt(left + ' characters are left, At least 2 characters are required for the Subject','subject-error','red');
    return false;
  }

  producePrompt('Valid', 'subject-error', 'green');
  return true;

}

//Creates box and validate textbox content for a valid Email

function validateEmail () {

  var email = document.getElementById('MailB').value;

  if(email.length == 0) {

    producePrompt('Email Invalid','email-error', 'red');
    return false;

  }

  if(!email.match(/^[A-Za-z\._\-[0-9]*[@][A-Za-z]*[\.][a-z]{2,4}$/)) {

    producePrompt('Email Invalid', 'email-error', 'red');
    return false;

  }

  producePrompt('Valid', 'email-error', 'green');
  return true;

}

//Creates box and validate textbox content for Email Message - Text to save to file later?
function validateMessage() {
  var message = document.getElementById('MessageB').value;
  var required = 10;
  var left = required - message.length;

  if (left > 0) {
    producePrompt(left + ' more characters are required, Please Provide More deails for the server admin','message-error','red');
    return false;
  }

  producePrompt('Valid', 'message-error', 'green');
  return true;

}

//Secondary Code for JS validation(hide validation content box):
function jsShow(id) {
  document.getElementById(id).style.display = 'block';
}

function jsHide(id) {
  document.getElementById(id).style.display = 'none';
}

//ON Sybmit button button click/ Mouse Over action(Validate form passes)://ON button click action:
var booleanXCHECK = false;
//use to check validation and change boolean value to check before writes ...

function validateForm() {
    if (!validateName() || !validateSubject() || !validateEmail() || !validateMessage())
{
        jsShow('submit-error');
        producePrompt('Please fix errors to submit.', 'submit-error', 'red');
        setTimeout(function(){jsHide('submit-error');}, 5000);
        return false;

    }
else
{
//Change alert for message sent successfully
        //producePrompt('Sent Successfully', 'Submit-error', 'green');
        jsShow('submit-error');
        producePrompt('Mesage Passed Validation.', 'submit-error', 'green');
        setTimeout(function(){jsHide('submit-error');}, 2000);
        return booleanXCHECK = true;
return true;
    }
}

//Populates the HTML span tag
function producePrompt(message, promptLocation, color) {

  document.getElementById(promptLocation).innerHTML = message;
  document.getElementById(promptLocation).style.color = color;


}


</script>

<!-- How we will write this to hfs:-->
<script type="text/javascript">
//variables to pass latter
var LoggedInUser = '[%user%]';
var LoggedUserIP = '%ip%';
</script>


<script>
document.getElementById("SendMe").onclick = function () {
//alert("your check is :"+booleanXCHECK );
//check value in code in event of issues that needs resolved fail/pass true

if (booleanXCHECK === true) {
//if statement add to check before running write code... as this code should just run after validation...


var Today = new Date(); 
var OwnTZ = -(Today.getTimezoneOffset()/60);
var Offset = new Date().getTimezoneOffset();
var MyDate = new Date((new Date).getTime()+3600*OwnTZ*1e3).toUTCString().replace(/ GMT$/,"");
Offset = (Offset<0?"+":"-")+Pad(parseInt(Math.abs(Offset/60)),2)+""+Pad(Math.abs(Offset%60),2);
function Pad(number,length){for(var tz=""+number;tz.length<length;)tz="0"+tz;return tz};
MyFullLocalTime = MyDate+' '+Offset;

var GetName = document.getElementById("NameB").value;
var GetMail = document.getElementById("MailB").value;
var GetSubject = document.getElementById("SubjectB").value;
var GetMessage = '\n'+document.getElementById("MessageB").value+'\n';
//GetMessage=GetMessage.replace(/([^\r])\n/g, "$1\r\n");
//atempt to fix single line text saved to 1 single string... (i think eml write is oky as a 1 line string...)
var TextCurrentLength = document.getElementById("MessageB").value.length;

var Header0 = 'Received: from '+LoggedInUser+' ('+LoggedUserIP+')'+'\n';
var Header1 = 'From: "'+GetName+'" <'+GetMail+'>'+'\n';
var Header2 = 'To: "HFS Server Administrator"'+'\n';
var Header3 = 'Subject: '+GetSubject+'\n';
var Header4 = 'Date: '+MyFullLocalTime+'\n';
var Header5 = 'MIME-Version: 1.0'+'\n';
var Header6 = 'Content-Type: text/plain; charset=UTF-8'+'\n';
var Header7 = 'Content-Length: '+TextCurrentLength+'\n';
var Header8 = 'Content-Transfer-Encoding: 8bit'+'\n';
var Header9 = 'X-Originating-IP: '+LoggedUserIP+'\n';
var Header10 = 'X-Mailer: HFS Custom template'+'\n';
var FullHeaders = Header0+Header1+Header2+Header3+Header4+Header5+Header6+Header7+Header8+Header9+Header10;


var formData = new FormData();

// JavaScript file-like object
var content = FullHeaders+GetMessage; // Message content...
var blob = new Blob([content], { type: "text/plain"});

formData.append("webmasterfile", blob, "%folder%New-Message-{.time|yyyy.mm.dd'-at-'hh.nn.ss.}.eml");

var request = new XMLHttpRequest();
request.open("POST", "./");  //enable upload in contact
request.send(formData);

//disabled as it is now apart of the javascript
alert("Message sent!");
//can become the a message on the page instead of an alert box...
//jsShow('submit-error');
//producePrompt('Mesage SENT.', 'submit-error', 'green');
//setTimeout(function(){jsHide('submit-error');}, 2000);
return true;

}
else { return false; }

}
</script>

</body>
</html>

log:
10:13:54 AM 127.0.0.1:52301 Requested GET /
10:13:54 AM 127.0.0.1:52302 Requested GET /?mode=jquery
10:13:56 AM 127.0.0.1:52305 Requested GET /contact/
10:14:40 AM 127.0.0.1:52305 Uploading New-Message-2018.08.28-at-10.13.56.eml
10:14:40 AM 127.0.0.1:52305 Fully uploaded New-Message-2018.08.28-at-10.13.56.eml - 317 @ 23.8 KB/s
10:14:40 AM 127.0.0.1:52305 Requested POST /contact/
10:15:10 AM 127.0.0.1:52305 Requested GET /
10:15:10 AM 127.0.0.1:52305 Requested GET /?mode=jquery
10:15:12 AM 127.0.0.1:52305 Requested GET /contact/

example file:
file name:New-Message-2018.08.28-at-10.13.56

------------
Received: from [] (127.0.0.1)
From: "brandon " <myemail@test.com>
To: "HFS Server Administrator"
Subject: test
Date: Tue, 28 Aug 2018 10:20:08 -0500
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Length: 48
Content-Transfer-Encoding: 8bit
X-Originating-IP: 127.0.0.1
X-Mailer: HFS Custom template

failed mesage baox validation(auto passes???...)

------------

see pictures and finaly eml draft code atached

12
HTML & templates / Re: Simple contact template
« on: August 10, 2018, 03:50:58 AM »
AS Per Leo Request.

Here is the post for the XML code

Key Notes to codes/ help:
//////////////////////////
Code: [Select]
<!-- Rejeto HFS Macro Commands via LEO sends to hfs via text (XML) -->
<!-- Fix Permission to folder upload access (hfs macro)? -->
{.set item|%folder%|add upload=@anonymous.}

^ code will affect the folder the file is loading form, which needs to be the same folder for the path.

http://www.rejetto.com/wiki/index.php?title=HFS:_scripting_commands

Example: {.set item|private files|hide=0|comment=you should never see this!.}
access / delete / upload
you can set permissions on the item, by specifying a list of usernames.
Example: set item|videos|upload=robert will give account robert the ability to upload files in /videos.
Moreover, you can prefix permission by add or remove. In the previous example you set the upload permission. If mike already had upload permission, it is now lost. To add robert instead of just overwriting, you should {.set item|videos|add upload=robert.}. Now mike is happy too. As well, if you change your mind, and want to revoke your grant, just set item|videos|remove upload=robert.
You can specify more than one username this way: robert;mike;rupert.
Special usernames are @anonymous @any account @anyone.

*right now it is set for anyone and anythings, might be safer for @any account...
//////////////////

There is no User intervention required, after re-examining the original code and fixing variables, i have a %folder% parse working with data write... I shouldn't have changed the post wirte and file name append...)

SETUP:
I assume you created a real folder named "contact" > Right Mouse Click Properties > Different Template Tab > Pasted in the
code...

*There were changes done that is different to the JavaScript validation code and form html code to make this work a bit smother.
--See comments

XML Final Draft write option:

Code: [Select]
<!DOCTYPE html>
<html>
<head>
<meta charset=UTF-8 />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Contact Form using JavaScript</title>   
</head>


<!-- include css file here -->
<!--   <link rel="stylesheet" href="/Contact/form.css"/>   -->
<style type="text/css">
/* below line is write to use google font online  */
@import url(http://fonts.googleapis.com/css?family=Ubuntu);


* {
margin: 0;
padding: 0;
}

body {
font-size: 62.5%;
        font-family: 'Ubuntu', sans-serif;
}

p {
font-size: 1.3em;
margin-bottom: 15px;
}

#page-wrap {
width: 660px;
background: white;
padding: 20px 50px 20px 50px;
margin: 20px auto;
min-height: 300px;
height: auto !important;
height: 300px;
}

#contact-area {
width: 600px;
margin-top: 25px;
}

#contact-area input, #contact-area textarea {
padding: 5px;
width: 471px;
        font-family: 'Ubuntu', sans-serif;
font-size: 1.4em;
margin: 0px 0px 10px 0px;
border: 2px solid #CCC;
}

#contact-area textarea {
height: 90px;
}

#contact-area textarea:focus, #contact-area input:focus {
border: 2px solid #FC0;
}

#contact-area button.submit-button {
width: 100px;
height: 30px;
float: right;
cursor: default;
color: buttontext;
text-align: center;
padding: 2px 6px 3px;
box-sizing: border-box;
align-items: flex-start;
border: 0px outset buttonface;
-webkit-appearance: push-button;
        font-family: 'Ubuntu', sans-serif;
font-size: 1.4em;
white-space: pre;
}

label {
float: left;
text-align: right;
margin-right: 15px;
width: 100px;
padding-top: 5px;
font-size: 1.4em;
}

/* -------------------------------------
    CSS for sidebar (optional)
---------------------------------------- */
div#fugo{
float:right;
}
</style>

<body>

<div id="page-wrap">
<p><h1>&laquo; Contacting the Server Administrator &raquo;</h1></p>

<div id="contact-area">
<form method="GET">
<label for="contact-name">Full Name:</label>
<input type="text" tabindex="1" class="form-control" id="contact-name" name="name" placeholder="Please Enter Your Full Name.." onkeyup='validateName()'>
            <div style="text-align: right"><span class='error-message' id='name-error'></span></div>

<label for="contact-email">Email Address:</label>
            <input type="email" tabindex="2" class="form-control" id="contact-email" name="email" placeholder="Please Enter a valid Email (your@email.com) " onkeyup='validateEmail()'>
            <div style="text-align: right"><span class='error-message' id='email-error'></span></div>

<label for="contact-subject">Subject:</label><br />
            <input type="subject" tabindex="3" class="form-control" id="contact-subject" name="subject" placeholder="Ex: I Have Experienced an Error" onkeyup='validateSubject()'>
            <div style="text-align: right"><span class='error-message' id='subject-error'></span></div>

<label for='contactMessage'>Your Message:</label><br />
            <textarea class="form-control" rows="20" cols="20" id='contact-message' tabindex="4" name='message'  placeholder="Please Detail your needs - Enter a brief message" onkeyup='validateMessage()'></textarea>
            <div style="text-align: right"><span class='error-message' id='message-error'></span></div>
            <br /><br />
<div style="text-align: right"><span class='error-message' id='submit-error'></span></div>
<br />
<button id="SendMe" name="SubmitMessage" OnMouseOver='return validateForm()' class="submit-button" tabindex="5" >Submit</button>
<!-- buton onclick became OnMouseOver / a html embeded javascript function -->
</form>
</div>
</div>
<!-- include JavaScript file here -->
<!-- <script src="/Contact/form.js"></script> -->

<script type="text/javascript">
//Creates box and validate textbox content for a name
function validateName() {

  var name = document.getElementById('contact-name').value;

  if(name.length == 0) {

    producePrompt('Name is required', 'name-error' , 'red')
    return false;

  }

  if (!name.match(/^[A-Za-z]*\s{1}[A-Za-z]*$/)) {

    producePrompt('First and Last name, please.','name-error', 'red');
    return false;

  }

  producePrompt('Valid', 'name-error', 'green');
  return true;

}

//Creates box and validate textbox content for a Email Subject
function validateSubject() {

  var submessage = document.getElementById('contact-subject').value;
  var required = 2;
  var left = required - submessage.length;

  if (left > 0) {
    producePrompt(left + ' At least 2 characters are required for the Subject','subject-error','red');
    return false;
  }

  producePrompt('Valid', 'subject-error', 'green');
  return true;

}

//Creates box and validate textbox content for a valid Email

function validateEmail () {

  var email = document.getElementById('contact-email').value;

  if(email.length == 0) {

    producePrompt('Email Invalid','email-error', 'red');
    return false;

  }

  if(!email.match(/^[A-Za-z\._\-[0-9]*[@][A-Za-z]*[\.][a-z]{2,4}$/)) {

    producePrompt('Email Invalid', 'email-error', 'red');
    return false;

  }

  producePrompt('Valid', 'email-error', 'green');
  return true;

}

//Creates box and validate textbox content for Email Message - Text to save to file later?
function validateMessage() {
  var message = document.getElementById('contact-message').value;
  var required = 10;
  var left = required - message.length;

  if (left > 0) {
    producePrompt(left + ' more characters are required, Please Provide More deails for the server admin','message-error','red');
    return false;
  }

  producePrompt('Valid', 'message-error', 'green');
  return true;

}

//Secondary Code for JS validation(hide validation content box):
function jsShow(id) {
  document.getElementById(id).style.display = 'block';
}

function jsHide(id) {
  document.getElementById(id).style.display = 'none';
}

//ON button click action:
var booleanXCHECK = false;
//use to check validation and change boolean value to check before writes ...

function validateForm() {
    if (!validateName() || !validateSubject() || !validateEmail() || !validateMessage())
{
        jsShow('submit-error');
        producePrompt('Please fix errors to submit.', 'submit-error', 'red');
        setTimeout(function(){jsHide('submit-error');}, 5000);
        return false;

    }
else
{
//Change alert for message sent successfully
        //producePrompt('Sent Successfully', 'Submit-error', 'green');
        jsShow('submit-error');
        producePrompt('Mesage Passed Validation.', 'submit-error', 'green');
        setTimeout(function(){jsHide('submit-error');}, 2000);
        return booleanXCHECK = true;
return true;
    }
}


//Populates the HTML span tag
function producePrompt(message, promptLocation, color) {

  document.getElementById(promptLocation).innerHTML = message;
  document.getElementById(promptLocation).style.color = color;


}


</script>

<!-- Rejeto HFS Macro Commands via LEO sends to hfs via text (XML) -->
<!-- Fix Permission to folder code is curently in for file upload access (hfs macro) -->
{.set item|%folder%|add upload=@anyone.}
<!-- @any account or @anyone, in the event they go here while loged in as a user ... should write either way-->

<script>
document.getElementById("SendMe").onclick = function () {

if (booleanXCHECK === true) {
//if statement add to check before running write code... as this code should just run after validation...

//alert("your check is :"+booleanXCHECK );
//check value in code in event of issues that needs resolved fail/pass true

var Headers = '\n---------------------------\n';
var GetName = 'Name: '+document.getElementById("contact-name").value;
var GetMail = 'Email: '+document.getElementById("contact-email").value;
var GetSubject = 'Subject: '+document.getElementById("contact-subject").value;

var GetMessage = 'Message:\n\n'+document.getElementById("contact-message").value+'\n';
GetMessage=GetMessage.replace(/([^\r])\n/g, "$1\r\n");
//atempt to fix single line text saved to 1 single string...

var FullDataString = Headers+'\n'+GetName+'\n'+GetMail+'\n'+GetSubject+'\n'+GetMessage+'\n'+Headers;
FullDataString = FullDataString.replace(/([^\r])\n/g, "$1\r\n");
//atempt to fix single line text saved to 1 single string...

var content = FullDataString;
//content writes fine issues is with variable passed to blob in witch content loses the "/n" new lines...
//alert("your check is :"+content );
//check content before transfer to blob before data append...

var blob = new Blob([content], { type: "text/plain"});
var formData = new FormData();

//---------------OLD Apend Line -----------
// JavaScript file-like object file name
//formData.append("webmasterfile", blob, "New-Message-{.time|yyyy.mm.dd'-at-'hh.nn.ss.}.txt");

//var request = new XMLHttpRequest();
//request.open("POST", "/contact"); 
//upload acess must be enabled for write to work... (fixed via in tempalte macro comand...)
//Path Must be same path that %folder% points to (the folder where the code is located! 
//request.send(formData);
// ------------------------------------------

formData.append("webmasterfile", blob, "%folder%New-Message-{.time|yyyy.mm.dd'-at-'hh.nn.ss.}.txt");

var request = new XMLHttpRequest();
request.open("POST", "./");  //enable upload in contact
request.send(formData);


//disabled as it is now apart of the javascript
alert("Message sent!");
//can become the a message on the page instead of an alert box...
//jsShow('submit-error');
//producePrompt('Mesage SENT.', 'submit-error', 'green');
//setTimeout(function(){jsHide('submit-error');}, 2000);

}
else { return false; }
}
</script>

</body>
</html>

log example:
7:40:41 AM 127.0.0.1:51207 Requested GET /
7:40:41 AM 127.0.0.1:51209 Requested GET /?mode=jquery
7:40:42 AM 127.0.0.1:51207 Requested GET /Contact/
7:41:02 AM 127.0.0.1:51207 Uploading New-Message-2018.08.26-at-07.40.42.txt
7:41:02 AM 127.0.0.1:51207 Fully uploaded New-Message-2018.08.26-at-07.40.42.txt - 150 @ 13.3 KB/s
7:41:06 AM 127.0.0.1:51210 Requested GET /Contact/?name=Brandon+Martino&email=my@test.com&subject=ff&message=i+pass+validation&SubmitMessage=
7:41:06 AM 127.0.0.1:51209 Requested GET /Contact/

file content example:

file name:New-Message-2018.08.26-at-07.40.42

---------------------------

Name: Brandon Martino
Email: my@test.com
Subject: ff
Message:

i pass validation


---------------------------



attached is the xml template code

13
HFS ~ HTTP File Server / Re: VFS settings to another PC ?
« on: August 07, 2018, 11:54:26 PM »
http://rejetto.com/forum/index.php?topic=4393.0

when moving the vfs and folder/file directoirs do appear, you have to fix there file locaiotn.

FORM THE FAQ!

Quote:

What does the "hand" icon represent in the file system tree? 
If you see an icon that looks like a hand, it means that HFS could not find/access the original source file. HFS hides the file from the web interface until it can successfully access this file.

14
HFS ~ HTTP File Server / Re: Running the latest version as a service
« on: August 06, 2018, 05:28:40 PM »
http://rejetto.com/forum/index.php?topic=4713.msg1059193#msg1059193

I detaulted the best I could. It's not natively support...

You have to use other apps/tools to make it a service.

And have hfs pre setup(no changes) to run from it's vfs/ini

.... Not familiar with that exe. Look I. The post above...

15
HFS ~ HTTP File Server / Re: Pls support Unicode searching, thank you!
« on: August 04, 2018, 04:18:56 PM »
It's on the Todo lost. There some unicorr Pascal and other edits to get this working fully.

http://www.rejetto.com/hfs/?f=todo

Unicode wiri and super is fine ATM.

Pages: [1] 2 3 ... 52