Jump to content

<{[WARNING]}>Ultra Hard Question! Do not Enter unless you are 1337<{[WARNING]}>


this.user
 Share

Recommended Posts

I am running to an issue that I have never delt with before and am not sure if there is even a possible solution:

 

I have two files:

 

fileA  and fileB

 

 

fileA contains a loop that loops 30 times each time its called. in the loop there is a 2second delay

 

$i = 1; 
do { 
   $i++; sleep(2);
   if(!isset($_SESSION['user'])
  {
        break;
   }
} while($i < 31);

 

 

if fileB i have a simple destroy session

 

$_SESSION = array();
session_destroy();

 

 

I call both files via ajax, and that is where i run into my problem.

 

if I call fileA first, then call fileB through ajax, the code in FileB does not execute until fileA has run its course.

 

Is it possible to get around this?

 

Like set the priority of one over the other?

Link to comment
Share on other sites

That depends on when you want to run that. Or use include or require to make it run sometime within the loop when a flag is hit rather then calling it with ajax. it's all highly dependent on when and where. Programmatic method this is possible... of course if you want b to run first you could just you know call it first.  :P

Link to comment
Share on other sites

Haha, hilarious title, at least I hope it was meant to be hilarious.

 

1. You haven't given enough info, how do you know that B doesn't run until A is finished?

2. Is that the complete code?  If so, then the absence of session_start() in both files will cause other problems.

3. Show your AJAX calls, as it is most likely that your JAX is missing the A.

Link to comment
Share on other sites

It had to do with certain properties of php, lets just say it was a night mare to figure out, and im sure others will run into it.

 

So what you mean is, it was a stupid mistake on your part and after that amazing title you don't want to admit it.  Instead, you want to make others believe that it was some "Ultra Hard Question" that only a gifted "1337" such as yourself could possibly resolve. 8)

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.