You can translate to another page if the cls_symstore_V6.out file is not occupied by another process.
I tried to implement it this way:
start: { $cmd = 'cls_symstore_V6.out'; if ($fh = fopen($cmd, 'r+')) { echo "Recording removed!" . "<br /> "; echo "<p><font size='3,5' color='black' face='Times New Roman'> <b> После возврата на предыдущую страницу, выполните обновление страницы. </b></font></p>"; echo "<p><a href='http://mypage/opr/admin/store/index.php'>Вернуться назад</a></p>"; fclose($fh);`введите сюда код` } else { echo "Deleting... Please wait.\n"; goto start; } }
Here is the following check: if the file can be opened, then an informational message is displayed and a link that returns to the desired page.
If the file cannot be opened, then display the message "Deleting ... Please wait." and goto
go back to start
and the check is repeated again until the condition is correct and I do not get a link to leave the page.
My way, unfortunately, was not crowned with success.
My working version is through do-while:
$i = 0; do { if ($fh = fopen("cls_symstore_V6.out", "r+")) { echo "Recording removed!" . "<br /> "; echo "<p><font size='3,5' color='black' face='Times New Roman'> <b> После возврата на предыдущую страницу, выполните обновление страницы. </b></font></p>"; echo "<p><a href='http://mypage/opr/admin/store/index.php'>Вернуться назад</a></p>"; fclose($fh); $i = $i + 1; break; } else { echo "Выполняется удаление. Пожалуйста, подождите...\n"; $string_time_out="\\\\".$server_name."\\".$path_dir_2."\\".$my_log.".out"; // echo $string_time_out; $my->time_out_client($string_time_out,32); echo "Recording removed!" . "<br /> "; echo "<p><font size='3,5' color='black' face='Times New Roman'> <b> После возврата на предыдущую страницу, выполните обновление страницы. </b></font></p>"; echo "<p><a href='http://mypage/opr/admin/store/index.php'>Вернуться назад</a></p>"; $i = $i + 1; break; } } while ($i = 1);
Thank you all, the question is closed.
goto
will wonderfully replacedo {} while();
2. Why do you bother with file locks? The database is not the right solution? - tutankhamunfile_exists()
. There will be only one problem: if the deletion process fails with an error, the temporary file will live forever. - Alexander Gribennikovbreak
then, right? Hmm ... only the messages will already be displayed ... - Yulia