Friday, July 08, 2011

FileMaker TIP: Getting Rid Of The IWP Login Page

If you use the Instant Web Publishing (IWP) feature in FileMaker to expose your database(s) via the Internet, there may be times when you want to disable the default login screen, or change the design of it, or even allow the user to "automatically" login as a guest via a web link.


When you first enable Instant Web Publishing (on your FileMaker Server Advanced) - and you navigate to the default address (http://YourServerIPAddress/fmi/iwp/res/ipw_home.html) you'll see a screen that looks like this:



However, it's pretty easy to create a login form that you can put on your own site, or even create a HTML link that will allow users to go directly into the database as either a specified authenticated user or a guest.

If you want to have a form that allows them to enter a user name and password like the above form, then it's pretty simple to create a html form (or add code to an existing page in your site). Here's the code you'll need:


There are two things you need to change: in the "action" part where it says "localhost/fmi..." change that to be the URL (or IP address) of your FileMaker Server machine where the database is open, AND change "db=Web_Tester" to "db=YourDatabase" where YourDatabase is the exact name of your database (minus the ".fp7" extension).

If you want your users to just be able to login as a guest - there's a slightly modified version of the same form:


If you would rather provide a link rather than a form - here's the code for the Guest access:


You still must change the "localhost" to your own IP and URL and also change "Web_Tester" to the name of your database - but do not change anything else or the link won't work. FileMaker must have the "dbpath" variable url encoded or the link will simply not work.

It IS possible to have a link that will automatically login with a specified account - it's very similar to the guest link above:


Notice that there is an account name and password variable in there. So, you can just replace name=Admin with the name of your account and put in the password after password= (but before the &).

IMPORTANT NOTE: If you choose to use an authenticated account to "auto login" - make very sure you thoroughly test your application and apply the correct permissions for that account for all the various CRUD functions (create, update, delete) - as well as to any scripts, calculations or functions that would expose data or functionality that you wouldn't want everyone to have access to. This is especially important because the account name and password will be in plain text for the whole world to see! The last thing you need is your (or your customer's) data hijacked. So be careful and test, test, test!

13 comments:

Alistair said...

Hi Bob
This is what I was looking for. Thanks
But would like to go one more step?
I have a field that is in a runtime solution, I want to put it into a new record in an iwp database within the runtime one.
That is without the user need to do it?
Is it possible?
Alistair

Bob Cusick said...

Hey Alistair - thanks for the comment! I'm not sure what it is you're looking for (sorry for being dense). Can you drop me an email at bob [dot] cusick [at] gmail [dot] com - I'd be happy to help if I can!

Cheers,

Bob

Angus Cameron said...

Bob,
I tried using your form for user login but adapting it to Filemaker 9 Advanced (not server) It seems to almost work and accepts the user name and password but does not then actually open my database.
Is there a simple step I am missing, please?
Angus Cameron

Bob Cusick said...

Agnus,

You need to specify the database name *exactly* like the physical file name. Chances are - you have a SPACE in the file name. In the HTML code replace the space with "%20" like this:

My File With Space should be:
My%20File%20With%20Spaces

Scot said...

Hi Bob,

These are great tips! Do you have any advise for catching login errors using your examples? I am interested in creating a custom login page, but would also like an error page to match. Is it possible to modify or replace the default iwp_auth.html file?

Thanks,

Scot

David Lopez said...

Hi Bob,

Thanks for the solution, it works great!

I have a few questions,

Is there a way to catch error on this solution? because I'm working on a server that host my file, but they don't let me go to the iwp_auth.html file and modify it, so I have to make it work by my self.
And another question, do you know any way that when the IWP end session or the user exit the file by the script the filemaker doesn't get you to the default iwp_auth.html login?

Thanks for your help.

David

Chris said...

I'm trying this on a solution that is hosted on a FMP 12 Server that has the Web Publishing set up and it's not working. I'm not sure if I typed something wrong or what the problem is. Does this still work on FMP12? I can get to the site and manually enter the info, but not this method of hard coding the un and pw in the link.

Unknown said...

Hey Bob,

This works fine but I get a internal server error dialog that pops up. If I click ok then the database opens fine.

How do I get rid of the internal server dialog.

I use your exact code - I am using Filemaker server 12 advanced.

Regards
Simon

Bob Cusick said...

Looks like this "broke" in FMP 12 (which I'm not yet using). When I get a "spare" moment, I'll see if it can be resolved or not (I suspect it's an enhanced security measure in FMP 12)

Unknown said...

Thanks a lot, this worked like a charm for me on FMServer 12!

Tom Wallace said...

Worth noting that if the 'Guest' account is the only account with IWP privileges the login form is bypassed. Useful if you want seamless access to your database via the web.

Anonymous said...

Did anyone manage to solve the Filemaker 12 issue? I would love to get this working on a Database that I created (with 1200 users). The biggest hassle I have is trying to get people's passwords sent to them - the ability to send in a generated link that will log them in automatically will save me literally days of hassle!

Unknown said...

IWP Need Help Customizing (Default) Home Page???

I've read all posts on this. We are hosting on FMS 12 Advanced.

I'm trying to modify the existing iwp_home.html with a new banner -- iwp_banner.gif and logo -- iwp_logo.png



We located where these images are stored:

/Program Files/FileMaker/FileMaker Server/Web Publishing/publishing-engine/wpc/Resources/iwpres/images

Changes work OK, except IWP renders the text: "Instant Web Publishing" super-imposed over the iwp_banner.gif

We have reviewed iwp_home.html and iwp_auth.html (mostly JavaScript) and don't see where this text is generated. How can we change ""Instant Web Publishing" to our client's customized text title: "Client Name Here" ?

We also assume that any changes to iwp_home.html and iwp_auth.html would be uploaded to:

/Program Files/FileMaker/FileMaker Server/Web Publishing/IWP

Any help will be appreciated. Thanks so much...

Web Analytics