-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackup_failure.php
More file actions
38 lines (35 loc) · 1.43 KB
/
backup_failure.php
File metadata and controls
38 lines (35 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
function write_log($query) {
/*$con1 = mysqli_connect("172.16.25.62", "root", "r00tpass", "mysql_db_backup"); //Establishes connection with backup server
if($con1) //Check whether connection is established or not
{
//echo "Connection established.\n";
$backup_result = mysqli_query($con1, $query);
if(!$backup_result) //Write failure into log.txt if unable to perform query.
{
$log_file_name = "log.txt";
$file_handle = fopen($log_file_name, 'a') or die();
$string_data = "Unable to perform query.\n$query\n";
fwrite($file_handle, $string_data);
fclose($file_handle);
}
else //Write status of query performed.
{
$log_file_name = "log.txt";
$file_handle = fopen($log_file_name, 'a') or die();
$string_data = "Query performed successfuly.\n$query\n";
fwrite($file_handle, $string_data);
fclose($file_handle);
}
}
else
{
$log_file_name = "log.txt";
$file_handle = fopen($log_file_name, 'a') or
$string_data = "Unable to connect to backup database.\n$query\n";
fwrite($file_handle, $string_data);
fclose($file_handle);
}
mysqli_close($con1);*/
}
?>