cgm225 Posted June 22, 2007 Share Posted June 22, 2007 If I have a system command, or multiple system commands, in a script, are there any techniques for preventing those same commands from being resubmitted if the user refreshes the page? Quote Link to comment Share on other sites More sharing options...
teng84 Posted June 22, 2007 Share Posted June 22, 2007 NICE QUESTION use the header file on the bottom part of the sript ;D Quote Link to comment Share on other sites More sharing options...
cgm225 Posted June 22, 2007 Author Share Posted June 22, 2007 I am not sure what you mean exactly.. would you mind sharing an example/clarifying? Thanks in advance! Quote Link to comment Share on other sites More sharing options...
teng84 Posted June 22, 2007 Share Posted June 22, 2007 when yourefresh the page it will have the message warning page contain post data something like that right because it really has. now to avoid this use header header('location:yourlocation.php'); from that the post data are gone because the page are freshly reloaded so when you click refresh you wont get the same message again :-* Quote Link to comment Share on other sites More sharing options...
cgm225 Posted June 22, 2007 Author Share Posted June 22, 2007 Oh ok.. let me clarify my question.. because it was poorly asked! If I have a bunch of system commands, and as they run the script takes a long time to run* (i.e. to the user, it appears to be taking a long time to load/pausing), and so the user refreshes while it is still in the middle of running some system commands. Are there techniques for preventing resubmission of the system commands the script already ran before it was refreshed? *An example would be if I was using system commands to generate a bunch of thumbnails.. Thank you in advance! Quote Link to comment Share on other sites More sharing options...
Dragen Posted June 22, 2007 Share Posted June 22, 2007 use isset to check the commands.. <?php if(isset(SYSTEM COMMAND)){ //don't reset it }else{ //reset it } ?> Quote Link to comment Share on other sites More sharing options...
teng84 Posted June 22, 2007 Share Posted June 22, 2007 i dont think there is even in js i dont think if onload is possible but you can have the header file to keep that long waiting out of scene or use the db heres how upon submit get the data and time and compare the time interval in the matter of secon then if the time if just less than second perform a script that delete the entry and tell the user that that refreshing while on load is invalid Quote Link to comment Share on other sites More sharing options...
cgm225 Posted June 22, 2007 Author Share Posted June 22, 2007 @Dragen - Thank you so much for your help! With the isset command, just so I understand, how does it work? Does it check the server to see if it is already submitted? Again.. thanks! Quote Link to comment Share on other sites More sharing options...
teng84 Posted June 22, 2007 Share Posted June 22, 2007 use isset to check the commands.. <?php if(isset(SYSTEM COMMAND)){ //don't reset it }else{ //reset it } ?> sure about that can you say to the browser not to refresh by that code??? Quote Link to comment Share on other sites More sharing options...
cgm225 Posted June 22, 2007 Author Share Posted June 22, 2007 The question is not how to prevent refreshing.. It is how to prevent resubmission of pending system commands if the script is refreshed. Quote Link to comment Share on other sites More sharing options...
teng84 Posted June 22, 2007 Share Posted June 22, 2007 but when you reset it will also reset all the content of the page or reload it again say by this example <?php if(isset(SYSTEM COMMAND)){ //don't reset it }else{ //reset it } ?> now when you reset this will be true }else{ this will be false right??? when you submit it just the same as this ^^^ so ??? Quote Link to comment Share on other sites More sharing options...
teng84 Posted June 22, 2007 Share Posted June 22, 2007 reaction plsss??? Quote Link to comment Share on other sites More sharing options...
teng84 Posted June 23, 2007 Share Posted June 23, 2007 seems like no body wants to react any way another explanation <?php if(isset(SYSTEM COMMAND)){//issue no 1 //don't reset it }else{issue no 2 //reset it } ?> 1 when you reload issue no 1 will be set again 2 when you reload issue no 2 will be false again or as if you will have the session that will only be use once like upon submit you will have the session counter for that person that will allow him to submit with the specified time like the difference between the miliseconds of submission Quote Link to comment 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.