PHP URL Encoding (FileMaker IWP) - php

I have hosted a FileMaker database on the web using FileMaker Instant Web Publishing. I am trying to access it directly - as in bypass the login page - using the php command header().
This is the code I am currently using.
header("location: http://<serverIPaddress>/fmi/iwp/cgi?dbpath=%2Ffmi%2Fiwp%2Fcgi%3F-db%3D<databasename>%26-startsession&acct=account&name=<username>&password=<password>&login=Login&-authdb");
I got this code from here: http://lnx.acidsoft.net/problemsolved/bypass-filemaker-iwp-login-via-url.html
I don't believe the FileMaker part is as relevant, since accessing the database works fine when I remove all the other encoding stuff, I just can't bypass the login that way.
I believe it might be more of a problem with how the URL is structured and me not having enough experience to know how certain browsers or what language I'm using will affect the URL.
When I currently try to execute it, I get two dialog boxes.
First, I get one that says:
Bad Request
The server could not process your request due to a missing command: "”.
The second one says:
Bad Request
The server could not process your request because your session has timed out, been closed, or communication with the server has been lost.
Please reselect the database to begin a new session.
If you cannot open the database, please contact your database administrator.
Any ideas? I am using a button to call the .php file that calls this particular line, and I'm testing it on Safari and Google Chrome.

Kevin, I had same exact problem. Found an example of a working link here:
https://community.filemaker.com/thread/73562?start=0&tstart=0
...and the difference with my (failed) URL was the = in the url should be encoded to %3D
For me, having the actual = symbol made the link not work.
http://<DATABASE IP OR HOSTNAME>/fmi/iwp/cgi?dbpath=%2Ffmi%2Fiwp%2Fcgi%3F-db%3D<DATABASE NAME>%26-startsession&acct=account&name=<USERNAME>&password=<PASSWORD>&login=Login&-authdb
Good luck!

Related

If the WebView in my Xcode app works why would it not work in my Android app?

Today I started my first android app using "Android Studio". I have created a WebView app that displays a PHP scripts which has a HTML form with one input field and a submit button. Once the correct user code is entered the PHP script checks if the user code is correct. If correct opens another PHP script displaying data. At least that what it should do.
I already have a App written in Mac Xcode which works as expected and accessing the PHP using a browser works find.
The PHP script using PHP SESSION variables but the Android app does not seem to like them.
The problem seems to be related to how cookies are handled by Android's WebView.
By default, cookies are not enabled, therefore even if PHP tries to store the session_id, it cannot retrieve it later, and this causes a new session to start.
On SO you can find many answers that explain you how to enable cookies for WebView. See for example this one: How to enable cookies in Android WebView?.

PHP script loads for browser but not Android App

I'm working on a simple geolocation tracker based on this project and OsmAnd. OsmAnd uses URL parameters to send geolocation data to the web service, which then writes it to a file. The URL input into OsmAnd looks like
http://example.com/tracker.php?key=j2R1nrQ&lat={0}&lon={1}&timestamp={2}&hdop={3}&altitude={4}&speed={5},
where the {#} is replaced by the location data by OsmAnd.
I have confirmed that OsmAnd is pinging my site with correctly formed data. If I open the link in a browser, it is correctly writing the data to the file, but when the app on my phone pings the page, it is not. PHP is run on the server, right? So why would it make a difference that an app on my phone is pinging the site vs. my browser?
I figured it out. The app was generating a 406 error on the server, which is caused by Apach Mod_security. Disabling Mod_security solved the issue.

Filemaker with PHP

Im using Filemaker API in PHP to retrieve the records from Filemaker Pro 11 Advance Database.
But its showing error:
Error: Communication Error: (22) The requested URL returned error: 404 - This can be due to an invalid username or password, or if the FMPHP privilege is not enabled for that user.
Though I have set all Extend Privileges and gave it to user.
Please anyone can help me...
Although you mention you've taken care of this, whenever I've come across this problem it's been because the user being used to log in with PHP doesn't have the fmphp extended privilege set.
First know which user you're trying to log in as in PHP. Then, in FileMaker choose File>Manage>Security from the menu bar. Take a look at the Accounts tab and note the privilege set assigned to your web user. Click the Privilege Sets tab and double-click on this privilege set in the list. In the Extended Privilege list on the bottom right make sure there is a checkbox next to "Access via PHP Web Publishing".
While you're there, double-check the password you're working with. It has to be either you're not working with the right extended privilege set or you're not logging in with the right credentials.
I am pretty sure you must have resolved this by now but if you have not here is another suggestion. I had the same issue today and had all the extended privileges set.
The issue was with FileMaker API. Make sure the Php FM API being used is of the same version as the FileMaker server in which your db is hosted. FM Server 11 will require API released for FMS 11. I was using the last standalone API released for FMS 9 and hence it did not work. On updating php to FMAPI 13 I was able to connect and get the layouts.
The FileMaker API for PHP package was included as a .zip file in the following location:
For IIS (Windows): drive:\Program Files\FileMaker\FileMaker Server\Web Publishing\FM_API_for_PHP_Standalone.zip
For Apache (Mac OS): /Library/FileMaker Server/Web Publishing/FM_API_for_PHP_Standalone.zip
Double check your connection params, it should look something like this...
// filemaker server connection param
$connection =& new FileMaker('DBName', 'http://www.domain.com');
$connection->setProperty('username', 'youruser');
$connection->setProperty('password', 'yourpass');
First, check if the PHP API is installed and running.
On the server, go to http://localhost - You will see a screen telling the PHP API is running. If you see something else, you probably have to dig into the installation of the PHP API - possibly redeploy the server and checking off the PHP API. See that the server passes the web-server test.
Next, Check that the user that logs on to the server has the right privilege set. We usually create a second account for the PHP API, where the privileges are set correctly to MODIFY records, and VIEW Layouts, and of course have the fmphp attribute set.
If you still cannot connect, try from the web-server to do a
wget http://fmhost_ip/
cat index.html
see that you get something that can resemble a FileMaker API running page (look at the HTML code output).
Make sure you get the "FileMaker Database Server Website" landing page on the url (without the /fmi/... address), My issue was using another domain/sub-domain that IIS was using for another website.
I know this is really old. But in addition to the ISAPI fix. I needed to add a URL rewrite rule. The pattern needed to be:
^fmi/(.*)
And the rewrite URL needed to be:
http://localhost:16020/fmi/{R:1}
With those in place, the PHP API started working again.
after a few hours trying i found a solution to comunicate the php with the IIS... on your IIS manager, just need to add to your default web site, in ISAPI Filters, and add this executable... "C:\Program Files\FileMaker\FileMaker Server\Web Publishing\publishing-engine\web-server-support\iis\isapi_redirect.dll" - with anuy name

Problem with Digital Certificates using OpenLayers and Javascript

I'm developing a project using Javascript, PHP and OpenLayers. A lot of maps are loaded using and HTTPS connection against an external OGC server.
When I try to load the map using HTTPS, they doesn't load (instead of, they show me an "Error loading the map, try again later").
I think that the problem is because of Digital Certificate. If I load directly from the server (using a WMS call) like this (look the last parameter):
https://serverurl/ogc/wms?service=WMS&version=1.1.0&request=GetMap&layers=ms1:lp_anual_250&styles=&bbox=205125.0,3150125.0,234875.0,3199875.0&width=306&height=512&srs=EPSG:4326&format=application/openlayers
The browser ask me for my authorization to see it. If i accept the Digital Certificate, I can see the map. After that, and because of my browser now accepts the certificate, I can see my own map from my own application.
So, the question is: Is there any way to ask for the Digital Certificate mannually when the user access to my web?
Thanks in advance!
PS: solutions using PHP are welcome too because I'm using CodeIgniter to load views
You could try opening the WMS URL in a div or perhaps a hidden iframe - that may cause the browser to pop up its 'Unknown cert' dialogue.
Im going to quote another user (geographika) from gis.stackexchange. I hope can help to someone with my issue:
You can use a proxy on your server so
all client requests are made to your
server, which deals with the
certificate, gets the request and
passes it back to the client. For PHP
have a look at
http://tr.php.net/manual/en/function.openssl-verify.php
If you are also using WMS software
(MapServer, GeoServer) you could
implement the same technique using a
cascading WMS server.
For details on how to do this in
MapServer see
http://geographika.co.uk/setting-up-a-secure-cascading-wms-on-mapserver

Querying A Server And Receiving XML Responses In PHP

I'm trying to write an API for a website, whose Flash app gets data from a server and presents it to the user. I've been told that I can "have a look web trafic you will the responses from the server are all just basic xml".
This might be the wrong question to ask but, I'm not entirely sure what I've been told to do here. Can I simply use PHP to open the page with the Flash app on, and intercept the XML responses being sent to it? How might that happen?
Alternatively, am I coming at this the wrong way? Do I need to instead know what server the Flash app is accessing, and then open up a connection to that?
This feels like a bad SO question, but I'm at a complete loss. The advice I was given was quite vague so I don't know where to look.
To see the server response in the web traffic, just use the "Net" tab of the firebug plugin of firefox.
It should display the request of the flash app with the response from the server which should be in XML.
EDIT
You will also know with firebug from which URL the response is coming from and you can then mimic the request of the flash app with your own php script.

Categories