-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatabase1.php
77 lines (58 loc) · 1.21 KB
/
database1.php
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
$i = 0;
$find;
function enigma($metrics)
{
global $i,$find;
//include "db.conf";
$path = dirname(__FILE__);
$path1 = explode("/",$path,-1);
$path1[count($path1)+1]='db.conf';
$finalpath = implode("/",$path1);
$handle = fopen($finalpath, "r");
while (!feof($handle))
{
$line = fgets($handle);
$data = explode("'",$line);
if($data[0]=='host=>')
{
$host= $data[1];
}
elseif($data[0]=='port=>')
{
$port= $data[1];
}
elseif($data[0]=='username=>')
{
$username= $data[1];
}
elseif($data[0]=='password=>')
{
$password= $data[1];
}
elseif($data[0]=='database=>')
{
$database= $data[1];
}
}
// Create connection
$conn = mysql_connect($host, $username, $password,$database);
// Check connection
if (!$conn)
{
die("Connection failed: " . mysql_connect_error());
}
//echo "Connected successfully<br>";
mysql_select_db('ENIGMA',$conn);
$result = mysql_query("SELECT * FROM data",$conn);
$i=0;
while($row = mysql_fetch_array($result))
{
$find[$i]['data_rate'] = $row['0'];
$find[$i]['Ips'] = $row['1'];
$find[$i]['Ipd'] = $row['2'];
$i++;
}
return($i);
}
?>