Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- OS: Windows
- Server: IIS
- PHP: 7.1.9
- auto_prepend_file = "C:IISSitessitelog.php"
- function myErrorHandlerr($errno, $errstr, $errfile, $errline, $error_context) {
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "log";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- // prepare and bind
- $stmt = $conn->prepare("INSERT INTO error_logs (error) VALUES (?)");
- $errorssssss = $errstr.$errfile. $errline.$errno . $error_context;
- // var_dump($errorssssss);
- $stmt->bind_param("s", $errorssssss);
- $stmt->execute();
- $stmt->close();
- $conn->close();
- }
- function shutdownHandler()
- {
- $lasterror = error_get_last();
- switch ($lasterror['type'])
- {
- case E_ERROR:
- case E_CORE_ERROR:
- case E_COMPILE_ERROR:
- case E_USER_ERROR:
- case E_RECOVERABLE_ERROR:
- case E_CORE_WARNING:
- case E_COMPILE_WARNING:
- case E_PARSE:
- $error = "[SHUTDOWN] lvl:" . $lasterror['type'] . " | msg:" .$lasterror['message'] . " | file:" . $lasterror['file'] . " | ln:" . $lasterror['line'];
- myErrorHandlerr($error, "fatal",'','','');
- }
- }
- set_error_handler("myErrorHandlerr", E_ALL | E_STRICT);
- register_shutdown_function("shutdownHandler");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement