[Xitami] Xitaimi Bug ?? calling URLs twice

rpo rolinger1 at hotmail.com
Thu Aug 3 21:11:01 CEST 2006


I am not certain if this is a problem of Xitami or not, but I am beggining
to think it is.  Here is the situation.

On a Frame page labeled "mainDisplay" page is:
<head>
      <script language="JavaScript">
         function countStat() {
            parent.mainDisplay.statPage.location =
"/cgi-bin/countStat.pl?cid=4&amp;fid=42&amp;pid=6746" ;
         }
      </script>
</head>

And then in the BODY i have:

<input type="image" onClick="javascript:countStat();"
SRC="/images/gifs/playpause.gif" border="0" height="12" title="Play/Pause">
<IFRAME NAME="statPage" frameborder="0" scrolling="no" margin="0" width="1"
height="1" SRC="/blank.html"></IFRAME>

When the user clicks the button, the JS functions calls the defined URL to
the IFrame, the called URL runs a script that counts the button click to a
DB.  Normally, the iFrame is hidden (note the iframe elements), but for
testing I expanded the iFrame to: width="150" height="25" and then printed
out the results of the mysql query and click count.  As an example, if the
current DB.table.buttonClick = 10, then I would get the buttonClick
variable, print it, increment it, rewrite it to the DB and then print the
incremented variable.  So on the in the iFrame I would see: "10 and 11".  I
then go and look at the mysql table.buttonClick value, and it shows "12".

After many frustrating hours of troubleshooting, I found that the mysql logs
show the "increment" happening twice (update table set
buttonClick=buttonClick+1 where ...).  I then looked at the Xitami
access.log and discovered that everytime the "image" is clicked, the script
is running TWICE.  Somehow one button click using onClick is causing the
script to be called and run twice, thus the buttonClick value is being
incremeted by two on every click.

For the life of me i can't figure out why its occuring twice.  Even more, if
it was being called twice IN the iFrame, then the printed variables would
be: "10 and 11" followed by a "11 and 12"...but the results are always from
the first time its run, in this example it would always show "10 and 11".
Because I never see the results of the second run ("11 and 12") it is making
me believe the Xitami is somehow calling the script twice but only sending
the results of the first call to the iFrame window.   I can't think of or
see any other explanation as to why this is happening.

Any insights into this problem are highly welcomed and needed.   I wonder if
anyone else can replicate this problem....I firmly believe this is somehow
related to Xitami handling frame URL calls.  There is nothing in my HTML
that indicates one button click would cause the script to be called twice.

Thanks everyone,
Russel

PS: Assuming I can get all this to work, this method is a neat little trick
that replaces SSI (server side includes) and allows me to do statistical
tracking well beyond SSI capabilities.



More information about the Xitami mailing list