NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
strange double post of index page


Joined: 08 Dec 2008
Posts: 35
Reply with quote
I am not sure if this issue is 'standard' or part of the debugger, or self inflicted but here goes:

My site is organized so that the navigation menus will reference a folder on the web server. Inside the folder I have, basically, 2 files: an 'index.php' and also a 'form.html.php'. The 'index.php' file will run first and it will decide what data to get and populate on the 'form.html.php' page.

This all works very nicely and cleanly. BUT... after the 'form.html.php' finishes loading and is displayed in the browser, the 'index.php' file is accessed again, but this time it does not appear to cause the page to reload even though the debugger shows it as processing the last request all over again.

in essence, the process is like this (as seen in debugger):
1. index.php is loaded
2. index.php processes and loads form.html.php
3. form.html.php processes and is displayed to the user
4. index.php is again reloaded
5. form.html.php does NOT appear to be reloaded.

This is true for all pages, even ones with very basic html.

Does this make any sense? All of my development is for corporate internal use and not available on the interweb.

I am hoping that this is a self inflicted annoyance and that there is something I can do to stop it. It is more annoying than anything else as it does not seem to affect how the system works.

Thank you all in advance for helping a novice out. I am trying to learn on my own and getting better... but have a long ways to go.

Here is a basic index.php:
Code:

<?php
    session_start();
    // do includes
    if(isset($_SESSION['userLoggedIn']) && $_SESSION['userLoggedIn'] )
    {
        include_once $_SERVER['DOCUMENT_ROOT'] .
            '/truck/inc/magicquotes.inc.php';
        include_once $_SERVER['DOCUMENT_ROOT'] .
            '/truck/inc/base.inc.php';
        include_once $_SERVER['DOCUMENT_ROOT'] .
            '/truck/inc/standardFunctions.inc.php';
        checkAdmin();
        // end includes, do index variable definition and initial allocations
        $formTitle      = 'Transportation Main';
        $formHeading    = 'Welcome '.$_SESSION['username'].' to the Transportation System';
        if(isset($_POST['action']) && $_POST['action']=='submitted')
        {
            // form has been submitted and action needs to be taken
        }
        include ('form.html.php');
        exit();
    }
    else
    {
        header('Location: http://'.$_SERVER['HTTP_HOST'].'/truck/user/');
        exit();
    }
?>


here is a basic form.html.php
Code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<link rel="stylesheet" type="text/css" href="<?php print 'http://'.$_SERVER['HTTP_HOST'].'/truck/css/my3.css';?>">
<?php include $_SERVER['DOCUMENT_ROOT'] .'/truck//inc/favicon.php'; ?>
    <head>
        <meta charset="utf-8">
        <title><?php print $formTitle; ?></title>
    </head>
    <body>
        <div id="head" align="center">
            <?php include $_SERVER['DOCUMENT_ROOT'] .'/truck/header/header.html.php'; ?>
        </div>
        <?php printPageLayout(0); ?>
        <div id="content">
            <form action="" method="post">
                <?php
                    if($_SESSION['accessLevel']==3) include ($_SERVER['DOCUMENT_ROOT'] .'/truck/user/admin.html.php'); 
                    print '<h1><center>'.$formHeading.'</center></h1>';
                ?>
            </form>
            <div align="center"><img src="<?php print 'http://'.$_SERVER['HTTP_HOST'].'/truck/images/';?>welcome.gif" width="702" height="395" />
        </div>
    </body>
</html>
[/code]
View user's profileFind all posts by radi8Send private message
Guru master

Joined: 24 Jul 2009
Posts: 737
Reply with quote
Interesting Smile I've had similar issues with various projects (mainly Magento) where breakpoints seemed to get called more often than I thought they should. I had actually assumed it was due to something like Ajax and/or file (image/CSS) loading, which can cause Magento code to re-run. Annoying and I never had time to track down the cause, so I just keep pressing F9.

I'll give your code a go, because I'm intrigued to see if this really is an issue with the debugger, rather than the project.

Do you have an .htaccess that could affect things, such as handling any rewrites?
View user's profileFind all posts by plugnplaySend private message


Joined: 08 Dec 2008
Posts: 35
Reply with quote
Nope, straight up and simple.

Strangely, the double posting (for lack of a better descriptor) has stopped! It must be something localized.

I am also having issues with the debugger basically causing the web app to lock up when debugging from the server and also running JS debugging from FireFox. There may be some interaction there that is inconsistent and causing this strange behavior.

If I find anything I will post the results.
View user's profileFind all posts by radi8Send private message
Resolved


Joined: 08 Dec 2008
Posts: 35
Reply with quote
I believe that I found the cause of the problem. I am using FireFox with the FireBug plugins for JS debugging. If I have FireBug turned off and start a fresh browser, it does not double post the HTML page. If FireBug is enabled, then I get the double post.

I can live with that.
View user's profileFind all posts by radi8Send private message
Guru master

Joined: 24 Jul 2009
Posts: 737
Reply with quote
Thank you for that bit of research. I also use FireBug; it's my favourite CSS inspector. Whilst I'm not always doing JS debugging, I think I do still have that enabled. I'm going to have a play with the FireBug settings the next time I seem to be getting breakpoints being hit too often.

I'd rather live with the double posts than do without FireBug, but if I can temporarily stop the problem then even better. Very Happy
View user's profileFind all posts by plugnplaySend private message


Joined: 23 Jul 2011
Posts: 2
Reply with quote
Hi

I am also getting multiple postings

I have disable Firebug on Firefox and also tried IE but can get up to 7 Session starts ann ends

Sometimes the numbe rof them does not seem to match but it is causing hours of wasted time trying to debug

Here is an example of a log

IDE Starting debug session (407475299972100009), script: /mcb-1-5-0-5/index.php, server: localhost, sapi: apache2handler 12:43:12
IDE Starting debug session (407475299972100009), script: /mcb-1-5-0-5/index.php, server: localhost, sapi: apache2handler 12:43:22
IDE Starting debug session (407475299972100009), script: /mcb-1-5-0-5/index.php, server: localhost, sapi: apache2handler 12:43:22
IDE Starting debug session (407475299972100009), script: /mcb-1-5-0-5/index.php, server: localhost, sapi: apache2handler 12:43:22
IDE Starting debug session (407475299972100009), script: /mcb-1-5-0-5/index.php, server: localhost, sapi: apache2handler 12:43:22
IDE Starting debug session (407475299972100009), script: /mcb-1-5-0-5/index.php, server: localhost, sapi: apache2handler 12:43:23
IDE Starting debug session (407475299972100009), script: /mcb-1-5-0-5/index.php, server: localhost, sapi: apache2handler 12:43:23
IDE Session (407475299972100009, /mcb-1-5-0-5/index.php) is finished, switching to another (407475299972100009), script: /mcb-1-5-0-5/index.php 12:43:41
IDE Session (407475299972100009, /mcb-1-5-0-5/index.php) is finished, switching to another (407475299972100009), script: /mcb-1-5-0-5/index.php 12:43:50
IDE Session (407475299972100009, /mcb-1-5-0-5/index.php) is finished, switching to another (407475299972100009), script: /mcb-1-5-0-5/index.php 12:43:54
IDE Session (407475299972100009, /mcb-1-5-0-5/index.php) is finished, switching to another (407475299972100009), script: /mcb-1-5-0-5/index.php 12:43:57
IDE Session (407475299972100009, /mcb-1-5-0-5/index.php) is finished, switching to another (407475299972100009), script: /mcb-1-5-0-5/index.php 12:44:01

(Note also 7 starts but only 5 ends?)


Any ideas would be appreciated?

I don't htink this used to happen so I presume it is a configuration / conflict issue causing it it?
View user's profileFind all posts by keithbSend private message
Guru master

Joined: 24 Jul 2009
Posts: 737
Reply with quote
I've had this problem at least since 5.9 and I think on previous versions as well. Occasionally I did check the globals to see if there was a referring page or request, to try and get some idea about what was going on, but I don't remember seeing anything helpful.

Unfortunately I've mostly seen this with Magento and it uses rewrites plus has a complicated controller mechanism (Zend framework), so wasn't particularly convenient for me to play with. I'd like to play with a simple project that demonstrates the issue.

I'm currently prepared to believe it is not a debugger issue, but if others have it then it does need looking at. I'm hoping to have time later this coming week to have a play.

Over the next few days it would be interesting to see if any other people post if think they are seeing similar issues.
View user's profileFind all posts by plugnplaySend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
Hey Lads, neither debugger nor IDE can run your code for you. If you click Run just one time, the IDE will ask the browser to run your code just one time. All the other requests are done by your code and/or by the browser.
For example, if you run phpinfo(), you'll get 3 requests - one for phpinfo info, and 2 others for two images.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 23 Jul 2011
Posts: 2
Reply with quote
Demetri - yes i would agree with what you say as I have now realised that it was some AJAX code causing multiple requests that I just hadn't seen before

Cheers
View user's profileFind all posts by keithbSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
koathb, you're welcome.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
strange double post of index page
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic