commit | author | age
|
27b6ee
|
1 |
<html> |
OB |
2 |
<head> |
|
3 |
<title>hello php</title> |
|
4 |
</head> |
|
5 |
<body> |
|
6 |
<?php |
|
7 |
echo '<p>hello world from ' .$_ENV["HOSTNAME"] . '</p>'; |
e73bf9
|
8 |
echo '<p>the current php version is ' . phpversion() . '</p>'; |
27b6ee
|
9 |
echo '<p>TEXT = ' .$_ENV["TEXT"] . '</p>'; |
OB |
10 |
echo '<p>PASSWORD = ' .$_ENV["PASSWORD"] . '</p>'; |
c69b0c
|
11 |
echo '<p>'; |
cfad3f
|
12 |
if (file_exists('/secretstore/filesecret')) { |
138b85
|
13 |
echo "secret file contains: "; |
ade692
|
14 |
echo nl2br(file_get_contents( "/secretstore/filesecret" )); |
OB |
15 |
} else { |
c69b0c
|
16 |
echo "no additional secrets found!"; |
ade692
|
17 |
} |
c69b0c
|
18 |
echo '</p>'; |
464e07
|
19 |
echo '<p>'; |
OB |
20 |
if (file_exists('/pvcmount/pfile')) { |
|
21 |
echo "file contains: "; |
|
22 |
echo nl2br(file_get_contents( "/pvcmount/pfile" )); |
|
23 |
} else { |
|
24 |
echo "no other file found!"; |
|
25 |
} |
|
26 |
echo '</p>'; |
4f3af1
|
27 |
|
OB |
28 |
$host = $_ENV["DBHOST"]; |
|
29 |
$user = $_ENV["DBUSER"]; |
|
30 |
$pass = $_ENV["DBPASS"]; |
|
31 |
$db = $_ENV["DBNAME"]; |
4d8bfd
|
32 |
echo '<p>Connecting to database at ' .$host . '</p>'; |
4f3af1
|
33 |
$con = pg_connect("host=$host dbname=$db user=$user password=$pass") |
OB |
34 |
or die ("Could not connect to server\n"); |
|
35 |
|
|
36 |
$query = "SELECT * FROM foo LIMIT 5"; |
|
37 |
|
|
38 |
$rs = pg_query($con, $query) or die("Cannot execute query: $query\n"); |
|
39 |
|
4d8bfd
|
40 |
echo '<p>Database results:<hr>'; |
4f3af1
|
41 |
while ($row = pg_fetch_row($rs)) { |
OB |
42 |
echo "$row[0]\n"; |
|
43 |
} |
4d8bfd
|
44 |
echo "</p>"; |
4f3af1
|
45 |
pg_close($con); |
27b6ee
|
46 |
?> |
OB |
47 |
</body> |
|
48 |
</html> |
|
49 |
|