W3Schools.com

PHP connection_aborted() Function


PHP Misc Reference Complete PHP Misc Reference

Definition and Usage

The connection_aborted() function checks whether the client has disconnected.

This function returns 1 if the connection has been aborted, otherwise it returns 0.

Syntax

connection_aborted()


Example

Create a function (check_abort()) that writes a log message if a client aborts the script:

<?php
function check_abort()
  {
  if (connection_aborted())
  error_log ("Script $GLOBALS[SCRIPT_NAME]" .
  "$GLOBALS[SERVER_NAME] was aborted by the user.");
  }

//some script to be executed here

// Call the check_abort function when the script ends
register_shutdown_function("check_abort");
?>


PHP Misc Reference Complete PHP Misc Reference
WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$7.95/mo SEO Hosting
Premium Website Design
WEB BUILDING
XML Editor - Free Trial!
FREE Website BUILDER
Free Website Templates Free CSS Templates
Make Your Own Website
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE