PHP Issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jth133
Forum Newbie
Posts: 2
Joined: Tue Nov 08, 2011 6:37 pm

PHP Issue

Post by jth133 »

Hi all,
My problem is this: I have an SWF embedded in a php page, which every 5 minutes runs some code and then calls a separate php script to save the changes to a database. If, instead of every 5 minutes, I set it to run every 1 minute it works great (so I know the problem is back end). However, set at 5 minutes it doesn't even execute once, even though the SWF is running, nothing is getting saved to the database. Also if I refresh the page after that time all I get is a blank page. It seems to me as if between 1 and 5 minutes the session variable is being unset or something, but I'm not sure why that would happen or how to fix it, or if that's even really the cause. As you can see from the code, I've tried ini_set and set_time_limit each without success. Any advice/help on this would be greatly appreciated. Thanks.

Code: Select all

<?php

session_start();

ini_set('max_execution_time', 0);
set_time_limit(0); 

?>

<?php
if (isset($_SESSION['uID'])) {
    ?>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
   <head>
      <title>Title</title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <style type="text/css" media="screen">
      html, body { height:100%; background-color: #ffffff;}
      body { margin:0; padding:0; overflow:hidden; }
      #flashContent { width:100%; height:100%; }
      </style>
   </head>
   <body>
      <div id="flashContent">
         <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="100%" height="100%" id="SWF" align="middle">
            <param name="movie" value="SWF.swf" />
            <param name="quality" value="best" />
            <param name="bgcolor" value="#ffffff" />
            <param name="play" value="true" />
            <param name="loop" value="true" />
            <param name="wmode" value="window" />
            <param name="scale" value="showall" />
            <param name="menu" value="true" />
            <param name="devicefont" value="false" />
            <param name="salign" value="" />
            <param name="allowScriptAccess" value="sameDomain" />
            <!--[if !IE]>-->
            <object type="application/x-shockwave-flash" data="SWF.swf" width="100%" height="100%">
               <param name="movie" value="SWF.swf" />
               <param name="quality" value="best" />
               <param name="bgcolor" value="#ffffff" />
               <param name="play" value="true" />
               <param name="loop" value="true" />
               <param name="wmode" value="window" />
               <param name="scale" value="showall" />
               <param name="menu" value="true" />
               <param name="devicefont" value="false" />
               <param name="salign" value="" />
               <param name="allowScriptAccess" value="sameDomain" />
            <!--<![endif]-->
               <a href="http://www.adobe.com/go/getflash">
                  <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
               </a>
            <!--[if !IE]>-->
            </object>
            <!--<![endif]-->
         </object>
      </div>
   </body>
</html>

 <?php
} ?>
G l a z z
Forum Newbie
Posts: 24
Joined: Sun Feb 12, 2012 10:33 pm

Re: PHP Issue

Post by G l a z z »

Hi,

When i want to execute some php code in certain periods of time i usually use jquery ajax to do this.

You create a function in javascript that will execute an ajax query to the php script you want and then you set a timeout to run the script again in 5 minutes.

If you need help doing this i can post an example here on how to do it.
Post Reply