this.user Posted August 3, 2010 Share Posted August 3, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/209698-ultra-hard-question-do-not-enter-unless-you-are-1337/ Share on other sites More sharing options...
gwolgamott Posted August 3, 2010 Share Posted August 3, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/209698-ultra-hard-question-do-not-enter-unless-you-are-1337/#findComment-1094725 Share on other sites More sharing options...
AbraCadaver Posted August 3, 2010 Share Posted August 3, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/209698-ultra-hard-question-do-not-enter-unless-you-are-1337/#findComment-1094728 Share on other sites More sharing options...
this.user Posted August 3, 2010 Author Share Posted August 3, 2010 Wow... 5hours later I found what the issue was, the ajax calls where fine. Man I never want to go through that again. Quote Link to comment https://forums.phpfreaks.com/topic/209698-ultra-hard-question-do-not-enter-unless-you-are-1337/#findComment-1094761 Share on other sites More sharing options...
AbraCadaver Posted August 3, 2010 Share Posted August 3, 2010 Wow... 5hours later I found what the issue was, the ajax calls where fine. Man I never want to go through that again. OK, what was it? Quote Link to comment https://forums.phpfreaks.com/topic/209698-ultra-hard-question-do-not-enter-unless-you-are-1337/#findComment-1094768 Share on other sites More sharing options...
this.user Posted August 3, 2010 Author Share Posted August 3, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/209698-ultra-hard-question-do-not-enter-unless-you-are-1337/#findComment-1094779 Share on other sites More sharing options...
Mchl Posted August 3, 2010 Share Posted August 3, 2010 http://www.phpfreaks.com/page/rules-and-terms-of-service Quote Link to comment https://forums.phpfreaks.com/topic/209698-ultra-hard-question-do-not-enter-unless-you-are-1337/#findComment-1094783 Share on other sites More sharing options...
AbraCadaver Posted August 3, 2010 Share Posted August 3, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/209698-ultra-hard-question-do-not-enter-unless-you-are-1337/#findComment-1094786 Share on other sites More sharing options...
this.user Posted August 3, 2010 Author Share Posted August 3, 2010 Yes LOL!!!!!! boy, here i was thinking I could get one over your heads! GOD WHAT WAS I THINKING ZOMG LOL! I had if($id = 4;) { do something } lol god im silly Quote Link to comment https://forums.phpfreaks.com/topic/209698-ultra-hard-question-do-not-enter-unless-you-are-1337/#findComment-1094792 Share on other sites More sharing options...
trink Posted August 4, 2010 Share Posted August 4, 2010 Yes LOL!!!!!! boy, here i was thinking I could get one over your heads! GOD WHAT WAS I THINKING ZOMG LOL! I had if($id = 4;) { do something } lol god im silly I detect an error in your syntax. Quote Link to comment https://forums.phpfreaks.com/topic/209698-ultra-hard-question-do-not-enter-unless-you-are-1337/#findComment-1094897 Share on other sites More sharing options...
AbraCadaver Posted August 4, 2010 Share Posted August 4, 2010 Yes, but after only 5 hours he fixed it and reported back so that others might learn from his mistake. Because he is ULTRA 1337!!! this.user RULZORZ!!! Quote Link to comment https://forums.phpfreaks.com/topic/209698-ultra-hard-question-do-not-enter-unless-you-are-1337/#findComment-1094927 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.