[Pro] Forms & JavaScript Sniffing

Please open this login page on my site (it’s in Japanese):

http://kiramek.com/install-database/

Type anything into the two fields and hit RETURN. That will produce the error page which is in English – note the red error text.

Here’s the situation. I have a hosted FileMaker IWP database, but they won’t allow me to skin the login page because it’s a shared server. So I worked around that limitation by creating my own Japanese login page (the above URL). That login page works great. But the problem is if the user enters either a wrong ID or PSW or both, you will see that English login page (with the red error text).

Can JavaScript be used to sniff the page that would normally appear after you click the Login/Submit button? The intent here is, if the JS sees some or all of the content of that RED text, the JS would then display an equivalent Japanese error message on the existing page and NOT show that English login page at all. But if the JS does NOT sniff out that red error text, it should assume there is no login error and display the next page.

How can this be accomplished?

Thank you,

James Wages


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Is the error page one that you made, or one that came with the login system? The only way that JavaScript can affect a page is if it is in that page. Browsers and the JavaScript language enforce a “Same Origin Policy”, and one page cannot alter the contents of another.

Walter

On May 18, 2015, at 12:44 AM, JDW email@hidden wrote:

Please open this login page on my site (it’s in Japanese):

http://kiramek.com/install-database/

Type anything into the two fields and hit RETURN. That will produce the error page which is in English – note the red error text.

Here’s the situation. I have a hosted FileMaker IWP database, but they won’t allow me to skin the login page because it’s a shared server. So I worked around that limitation by creating my own Japanese login page (the above URL). That login page works great. But the problem is if the user enters either a wrong ID or PSW or both, you will see that English login page (with the red error text).

Can JavaScript be used to sniff the page that would normally appear after you click the Login/Submit button? The intent here is, if the JS sees some or all of the content of that RED text, the JS would then display an equivalent Japanese error message on the existing page and NOT show that English login page at all. But if the JS does NOT sniff out that red error text, it should assume there is no login error and display the next page.

How can this be accomplished?

Thank you,

James Wages


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Walter,

Once you enter an ID and PSW and hit return (or click the Submit button), those pieces of data are sent to the host provider who hosts the FileMaker database. If the ID and/or PSW are incorrect, the host provider’s server will display its standard login page (which is in English) and place red error text atop that page.

What I did was build a replacement login page in Freeway that takes the user’s ID and PSW and fires those off to the server of the host provider. That allows me to show our Japanese users a Japanese login page. And so long as the ID & PSW are correct, the FileMaker database will display as the “next page” in the browser.

But when the ID and/or PSW are incorrect, the server displays its standard login page, which is in English, and which no Japanese reader can understand. And since this is a shared server, I cannot create a custom login page on the host provider’s server. So I am trying to work around their limitation.

I understand about the “same origin policy,” but what I want to know is if JavaScript has the capability (or some other scripting language I can use on my ServerLogistics web host) that will load a URL but sniff the page at that URL prior to displaying it, and if it contains certain text, then I would not display that page and instead stay put. But if after sniffing that page, if there is no error text detected, then the script would allow the page to display.

In other words, I have succeeded in providing a Japanese login page. But it isn’t complete success if the error page is in English.

I don’t necessarily wish to “control” the host server (of my FM Pro database). I just want to SNIFF IT OUT and then determine if I should display the page the server is sending or not display it.

–James Wages


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I think Walter is telling you that you can only sniff the Error page from within the Error page - so if you cant add code to that page then the answer is No.

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Really?!!!

So it’s impossible to load another HTML page within the existing page???

If you can load another webpage within the existing webpage, using I-frames or whatever, I don’t see why it would be impossible to sniff the contents of that Iframed webpage and then make a decision on what to do based upon that sniffing. The only difference in what I’m saying is that I want that other webpage hidden from view until the JavaScript code can make a decision on what to do next.

James Wages


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

But your login page doesn’t load the error page in an iFrame - it just submits to it!

Besides a page in an iFrame is still totally separate from the containing page and you cannot sniff inside it.

The containing page and the content in an iFrame are still on different domains no matter how it appears.

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

JavaScript automatically prevents scripts on one server from accessing properties of documents on a different server.
Simply stated, the SOP states that JavaScript code running on a web page may not interact with any resource not originating from the same web site.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Dave is right; that’s the issue. You could use PHP to proxy the response page into your own domain (and language) and you wouldn’t need JavaScript at that point at all. Unlike JS, PHP has no compunctions about origin. But you would have to manage the whole form submission and read (and translate) the response, most likely using the cURL library in PHP. It’s not a copy/paste thing I could show you in a mailing list post.

Walter

On May 19, 2015, at 5:36 PM, DeltaDave email@hidden wrote:

JavaScript automatically prevents scripts on one server from accessing properties of documents on a different server.
Simply stated, the SOP states that JavaScript code running on a web page may not interact with any resource not originating from the same web site.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thank you, Walter. I knew it HAD to be possible, even if it was something other than JS. I merely titled this post as “JavaScript” thinking it might be able to do what I wanted it to do. But it’s clear that it cannot — so be it.

I really don’t care if it is JS, PHP or the man on the moon… I seek a realistic solution to accomplish the ultimate goal: to bypass the English Login and Error content on a hosted FM Pro database and display Japanese content instead.

Since I host on ServerLogistics, I can run PHP.

Because it’s not a copy/paste thing, Walter, what website would you point me to me to help guide my brain in getting started in PHP with cURL? I obviously cannot become an expert on PHP in a matter of days, so if you know what I should specifically focus on, I would appreciate your advice.

Thanks,

James W.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

The php.net manual page on cURL functions is a good start. http://php.net/manual/en/book.curl.php

Walter

On May 19, 2015, at 8:08 PM, JDW email@hidden wrote:

Thank you, Walter. I knew it HAD to be possible, even if it was something other than JS. I merely titled this post as “JavaScript” thinking it might be able to do what I wanted it to do. But it’s clear that it cannot — so be it.

I really don’t care if it is JS, PHP or the man on the moon… I seek a realistic solution to accomplish the ultimate goal: to bypass the English Login and Error content on a hosted FM Pro database and display Japanese content instead.

Since I host on ServerLogistics, I can run PHP.

Because it’s not a copy/paste thing, Walter, what website would you point me to me to help guide my brain in getting started in PHP with cURL? I obviously cannot become an expert on PHP in a matter of days, so if you know what I should specifically focus on, I would appreciate your advice.

Thanks,

James W.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

And sorry for pointing you at the learning cliff/curve – there really is a world of difference between simple in-page scripting and programming a proxy.

Walter

On May 20, 2015, at 7:46 AM, Walter Lee Davis email@hidden wrote:

The php.net manual page on cURL functions is a good start. http://php.net/manual/en/book.curl.php

Walter

On May 19, 2015, at 8:08 PM, JDW email@hidden wrote:

Thank you, Walter. I knew it HAD to be possible, even if it was something other than JS. I merely titled this post as “JavaScript” thinking it might be able to do what I wanted it to do. But it’s clear that it cannot — so be it.

I really don’t care if it is JS, PHP or the man on the moon… I seek a realistic solution to accomplish the ultimate goal: to bypass the English Login and Error content on a hosted FM Pro database and display Japanese content instead.

Since I host on ServerLogistics, I can run PHP.

Because it’s not a copy/paste thing, Walter, what website would you point me to me to help guide my brain in getting started in PHP with cURL? I obviously cannot become an expert on PHP in a matter of days, so if you know what I should specifically focus on, I would appreciate your advice.

Thanks,

James W.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
List Options | FreewayTalk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thank you, Walter, I will give it some study.

In the meantime I wish to add that my database host provider does offer Custom Web Publishing plans for FileMaker Pro databases (instead of the IWP hosting plan) I use now. The CWP allows people knowledgeable in PHP to do pretty much anything they want and have FTP access to the server too. And for people who don’t know PHP so well, they suggest purchasing Dreamweaver and FM Studio, the latter of which is taught here:

http://fmwebschool.com/fmstudio_user_videos.php

But after going through the first half of those videos, it seems to be doing a heck of a lot more than I ever intend to do. My aim is simple: I want a custom login page in Japanese. That’s it. I just wish the solution was equally as simple.

Anyway, I’ll give that PHP/cURL manual some study.

Thanks for your advice.

–James Wages


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Well, I gave up on that book.curl.php document you linked for me because it was putting me to sleep. I found an instructional book on PHP at the following link, which has really captured my interest:

http://www.hackingwithphp.com/2/6/0/how-php-is-written

I started off with the HISTORY section and worked my way through to “How PHP is written.” The way the author explains it is simple enough for my measly brain to understand. So far so good.

–James W.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options