-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLog_Connection.php
More file actions
executable file
·33 lines (31 loc) · 971 Bytes
/
Copy pathLog_Connection.php
File metadata and controls
executable file
·33 lines (31 loc) · 971 Bytes
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
<?php
# This logs a connection success/failure in the database defined using the credentials defined.
# If that doesn't work, it will log the error in the defined Error Log.
$Server = '';
$Database = '';
$Username = '';
$Password = '';
$Error_Log = '';
$Table = '';
$Columns = '';
if(is_null($argv[5]))
{
echo "Usage: $argv[0] Asset Connection Success Time IP-Address\n";
//echo "argv[5] = ".$argv[5]."\n";
return;
}else{
//echo "argv[5] = ".$argv[5]."\n";
if(!mysql_connect($Server,$Username,$Password))
{
$tmp = "MySQL".',9,'.date("m/d/y,H:i:s").",Error connecting to mysql.\n";
error_log($tmp,3,$Error_Log);
return;
}else{
mysql_select_db($Database);
$Connection_sql = "INSERT INTO $Table($Columns) VALUES('".$argv[1]."',$argv[2],$argv[3],'".$argv[4]."','".$argv[5]."');";
//echo $Connection_sql."\n";
mysql_query($Connection_sql);
mysql_close();
}
}
?>