vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Pausing in a PHP script (https://vborg.vbsupport.ru/showthread.php?t=202164)

m002.p 01-17-2009 07:57 PM

Pausing in a PHP script
 
Hello to everyone.

In a script ive coded, I want to pause within executing a set of commands, but I would rather it didnt php sleep(); as this obviously means the whole script is delayed then affecting the intervals it is executed using PHP code which runs the script every X seconds, in addition to 1 minute CRON.

The commands in question often refer to my MYSQL database of cheating players in a gameserver, and should the conditionals be met, actions are taken against the individuals.

The reason I need a pause is to warn a player before booting them so they can see why they were kicked from the server.

An example:

PHP Code:

if ((strtolower($disresult['names']) == strtolower($player['name'])) && ($disresult['search'] == 'Exact'))
{
$boot 'kick';
sleep(10); // Wait to ensure the player has connected to the server and may see the warning
admin_command();
sleep(10); // Pause while player sees reason for removal
admin_command();


I understand you could use MYSQL to check the time but that uses additional queries, so really the answer to my question could simply be "Not possible", but if anyone knows a better way of pausing without affecting the whole script I would appreciate it.

Matt

Dismounted 01-18-2009 03:28 AM

PHP will always wait until each line is executed and finished. So "not possible" (with pure PHP anyway).


All times are GMT. The time now is 03:43 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01441 seconds
  • Memory Usage 1,712KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete