-
Notifications
You must be signed in to change notification settings - Fork 0
/
database2.php
executable file
·72 lines (56 loc) · 1.05 KB
/
database2.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
<?php
session_start();
$t1=$_POST['a'];
global $find1,$find2;
echo $value;
function details($value)
{
global $i,$find1,$find2;
#fetch values from db.conf
$path = dirname(__FILE__);
$finalpath="$path/db.conf";
$handle = fopen($finalpath, "r");
while (!feof($handle))
{
$line = fgets($handle);
$data = explode("'",$line);
if($data[0]=='$host=')
{
$host= $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("$database",$conn);
$result = mysql_query("SELECT DESTIP,$value from NEW_IPS",$conn);
$i=0;
while($row = mysql_fetch_assoc($result))
{
$find1[$i]=$row[$value];
$find2[$i]=$row['DESTIP'];
#echo $find[$i];
#echo $find2[$i];
$i++;
#echo "\n";
}
return($i);
}
?>