I am writing an app that allows users to get directions from their
home to points of interest. When I invoke a GDirections object and
call:
directionsObj.load(startAddr+' to '+endAddr);
Everything works as expected. The problem is that it seems to be
making a rogue request to the index.php page in the background. Since
I require users to be logged in, and destroy their session on index,
this is a problem. Basically if you get directions you get logged
out.
On Jul 31, 2:27 pm, "G$" <mike.ginsb...@gmail.com> wrote:
> I am writing an app that allows users to get directions from their
> home to points of interest. When I invoke a GDirections object and
> call:
> directionsObj.load(startAddr+' to '+endAddr);
> Everything works as expected. The problem is that it seems to be
> making a rogue request to the index.php page in the background. Since
> I require users to be logged in, and destroy their session on index,
> this is a problem. Basically if you get directions you get logged
> out.
> Any help at all is appreciated. Thank you.
return false from the function that is run when the form is submitted?
If you post a link, we might be able to do more than guess...
Unfortunately I cannot provide a link, but I can show you the code. I just have an html page with two divs, one for "map" and the other for "route". body onLoad i call verysimple();
function verysimple() { var map = new GMap2(document.getElementById("map")); map.addControl(new GScaleControl()); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl());
var mapdirections; mapdirections = new GDirections(map, directionsPanel); var start = '5849 Forbes Ave, Pittsburgh PA 15217'; var end = '202 Terrace Ct, Trafford PA 15085'; mapdirections.load(start + ' to ' + end); return false;
}
On Thu, Jul 31, 2008 at 5:47 PM, geocode...@gmail.com <geocode...@gmail.com>wrote:
> On Jul 31, 2:27 pm, "G$" <mike.ginsb...@gmail.com> wrote: > > I am writing an app that allows users to get directions from their > > home to points of interest. When I invoke a GDirections object and > > call:
> > directionsObj.load(startAddr+' to '+endAddr);
> > Everything works as expected. The problem is that it seems to be > > making a rogue request to the index.php page in the background. Since > > I require users to be logged in, and destroy their session on index, > > this is a problem. Basically if you get directions you get logged > > out.
> > Any help at all is appreciated. Thank you.
> return false from the function that is run when the form is submitted?
> If you post a link, we might be able to do more than guess...
Well the html is amazingly simple. Just two divs within the <body> tags. One with an id="map" and another with id="route". Then an onload call in the body tag itself.
Ok I set up this script on a personal site so that you guys can look at it. To reproduce go to: http://www.hellgaters.com/index_beta.php and click on "Click here for map"
After refreshing the page you'll see a debugging message that says "SET UP" indicating that a session variable was set on index.php.
On Thu, Jul 31, 2008 at 6:09 PM, Mike Ginsburg <mike.ginsb...@gmail.com>wrote:
> Well the html is amazingly simple. Just two divs within the <body> tags. > One with an id="map" and another with id="route". Then an onload call in > the body tag itself.
> On Thu, Jul 31, 2008 at 6:05 PM, Rossko <ros...@culzean.clara.co.uk>wrote:
>> > Unfortunately I cannot provide a link, but I can show you the code.
>> Not much use withoutthe HTML in this case, And please don't post that >> as well !
>> As your map is behind a login you'll be able to call on support from >> Google Premier I expect.
On Jul 31, 11:18 pm, "Mike Ginsburg" <mike.ginsb...@gmail.com> wrote:
> Ok I set up this script on a personal site so that you guys can look at it.
> To reproduce go to:http://www.hellgaters.com/index_beta.php > and click on "Click here for map"
> After refreshing the page you'll see a debugging message that says "SET UP"
> indicating that a session variable was set on index.php.
I don't get that. But I don't get redirected to index.php either. I
can't see anything in the HTML produced by index_beta.php or
location.php, or in any of the included Javascript scripts, which does
that.
That leads me to the conclusion that something in the PHP is doing the
redirection, presumably because a cookie isn't being set correctly.
That's probably machine-specific: it doesn't happen to me in Firefox
or IE6.
It's odd that the debugging message is not showing up for you. I converted it to an html page and confirmed in my access logs that index.php is still being requested as soon as the directions get displayed. No php involved here.
On Thu, Jul 31, 2008 at 6:41 PM, warden [Andrew Leach - Maps API Guru] <
> On Jul 31, 11:18 pm, "Mike Ginsburg" <mike.ginsb...@gmail.com> wrote: > > Ok I set up this script on a personal site so that you guys can look at > it. > > To reproduce go to:http://www.hellgaters.com/index_beta.php > > and click on "Click here for map"
> > After refreshing the page you'll see a debugging message that says "SET > UP" > > indicating that a session variable was set on index.php.
> I don't get that. But I don't get redirected to index.php either. I > can't see anything in the HTML produced by index_beta.php or > location.php, or in any of the included Javascript scripts, which does > that.
> That leads me to the conclusion that something in the PHP is doing the > redirection, presumably because a cookie isn't being set correctly. > That's probably machine-specific: it doesn't happen to me in Firefox > or IE6.
On Jul 31, 3:52 pm, "Mike Ginsburg" <mike.ginsb...@gmail.com> wrote:
> It's odd that the debugging message is not showing up for you. I converted
> it to an html page and confirmed in my access logs that index.php is still
> being requested as soon as the directions get displayed. No php involved
> here.
FWIW - I don't get the debugging message (or redirected to index.php)
either.
> > On Jul 31, 11:18 pm, "Mike Ginsburg" <mike.ginsb...@gmail.com> wrote:
> > > Ok I set up this script on a personal site so that you guys can look at
> > it.
> > > To reproduce go to:http://www.hellgaters.com/index_beta.php > > > and click on "Click here for map"
> > > After refreshing the page you'll see a debugging message that says "SET
> > UP"
> > > indicating that a session variable was set on index.php.
> > I don't get that. But I don't get redirected to index.php either. I
> > can't see anything in the HTML produced by index_beta.php or
> > location.php, or in any of the included Javascript scripts, which does
> > that.
> > That leads me to the conclusion that something in the PHP is doing the
> > redirection, presumably because a cookie isn't being set correctly.
> > That's probably machine-specific: it doesn't happen to me in Firefox
> > or IE6.
There is no redirecting. The index.php request happens in the background. I've confirmed on 4 separate machines now that refreshing the "location.php" page spits out the debugging message.
On Thu, Jul 31, 2008 at 6:55 PM, geocode...@gmail.com <geocode...@gmail.com>wrote:
> On Jul 31, 3:52 pm, "Mike Ginsburg" <mike.ginsb...@gmail.com> wrote: > > It's odd that the debugging message is not showing up for you. I > converted > > it to an html page and confirmed in my access logs that index.php is > still > > being requested as soon as the directions get displayed. No php involved > > here.
> FWIW - I don't get the debugging message (or redirected to index.php) > either.
> > On Thu, Jul 31, 2008 at 6:41 PM, warden [Andrew Leach - Maps API Guru] <
> > > On Jul 31, 11:18 pm, "Mike Ginsburg" <mike.ginsb...@gmail.com> wrote: > > > > Ok I set up this script on a personal site so that you guys can look > at > > > it. > > > > To reproduce go to:http://www.hellgaters.com/index_beta.php > > > > and click on "Click here for map"
> > > > After refreshing the page you'll see a debugging message that says > "SET > > > UP" > > > > indicating that a session variable was set on index.php.
> > > I don't get that. But I don't get redirected to index.php either. I > > > can't see anything in the HTML produced by index_beta.php or > > > location.php, or in any of the included Javascript scripts, which does > > > that.
> > > That leads me to the conclusion that something in the PHP is doing the > > > redirection, presumably because a cookie isn't being set correctly. > > > That's probably machine-specific: it doesn't happen to me in Firefox > > > or IE6.
umm, well that changed while I was looking at it so I guess you're
working on it.
I did see the test code run once at location.php, and Firebug told me
that yes indeed location.php was called for a second time after the
Gdirections work. Didn't find out who dunnit, but I'm suspicious of
scriptaculous.
I cannot see how it could relate, but there is a potential pitfall
with your javascript GMap2 object;
In the non-test loadMap() code that is currently running, it's called
'map' but is not global. IE especially can get confused and try to
use the <div> called 'map' as the object instead.
In the test verysimple() code the object isn't named 'map' but it is
still not global. I'm a bit concerned this may confuse the GDirection
load when it asynchronously updates the map after the function has
closed.
verysimple() doesn't have a map.setCenter() at all now, which is
usually not advisable.
On reflection, I'd bet that the trigger is the expansion of the <div>
to hold the text directions. Causing one of other scripts (that are
way beyond me!) to do something, like trigger the first menu option
(index.php).
I appreciate the input guys. I've eliminated pretty much everything that could be client side here. I have a standard html page that simply loads the directions and my access log still shows a hit to index.html as soon as the directions.load() finishes. I haven't been able to find any other documented cases of this, but I have now confirmed on 7 pcs with the site loaded on 3 different servers.
My short term fix was to check the HTTP_REFERER on my index.php page and not log you out.
On Thu, Jul 31, 2008 at 7:49 PM, Rossko <ros...@culzean.clara.co.uk> wrote:
> On reflection, I'd bet that the trigger is the expansion of the <div> > to hold the text directions. Causing one of other scripts (that are > way beyond me!) to do something, like trigger the first menu option > (index.php).