B4J Question WebSocket Server problem

TomDuncan

Active Member
Licensed User
Longtime User
Hi All,
I am developing a web server app and I am having problems with a dynamically generated page.
It will be used for Admin login.
I create the page asking for name and password etc.
When ok the page is rebuilt with Comment fields.

All OK till now.
However when I create the form Things like checkboxes will not allow to be pressed and
what is a real pain is that my TinyMCE is not available in mt textarea fields.
However if I but these outside the generated area, then all is fine.

Have included a B4J demo to show this.

It is 900k so too big for here so I have it on my site.
http://ctd.noip.me/downloads/test_site.zip


The default page has comments at the bottom and the tinymce is fine.
The /admin/index.html page is where the error occurs.
I have put a dummy textarea at the bottom of the page as well.

Any thoughts.
Tom
 

TomDuncan

Active Member
Licensed User
Longtime User
The problem and reason I thought this way was that, no html files are on the server until you are logged in.
I thought it would be a safer way to go.
With multiple pages someone could find the html file then load it.
What would be a way around this?

Tom
 
Upvote 0

TomDuncan

Active Member
Licensed User
Longtime User
or can I place them in a folder outside the www folder then do a call to ../Admin/admin.html or something like that
 
Upvote 0

Roycefer

Well-Known Member
Licensed User
Longtime User
You have a couple options. You can filter access to the statics folder and sub-folders with a Filter. Or you can create a Handler for each html page. For example, if you don't want a user having unauthorized access to Hello.html, you can store it in Folder1 (which is outside your statics folder). Then, create a Handler called "Hello" that will execute
B4X:
resp.Write(File.ReadString(Folder1, "Hello.html"))
in its Handle sub. The advantage to this set up is that you can modify Hello.html on the fly by using string replacement:
B4X:
resp.Write(File.ReadString(Folder1, "Hello.html).Replace("##USER##", username))
Which is not so easily done when serving up static pages from the statics folder. Also, just going to ".../Hello.html" won't give them the html file, if that's about what you are worried.

But note, anyway you cut it, they'll still be able to see the source code for the page in their browser by clicking on "Inspect Element" or whatever the equivalent is for their browser. There's no easy way around that, as far as I know.
 
Upvote 0

TomDuncan

Active Member
Licensed User
Longtime User
Will have a look.
The string replacement is where I am having the problem.
I build the page just with login details.
Then after success rebuild with the admin stuff.
I thought it was a good idea.
But will try the other folder idea and build the values only on runtime.

Tom

I suppose if I pre-design the page with the elements.
Change the values then show it, it should work.
 
Upvote 0

TomDuncan

Active Member
Licensed User
Longtime User
Had a brief look around.
Are their demos of this in use.
I know I am a slow learner, but nice to see a demo of what I want to achieve.

Tom
 
Upvote 0
Top