Olaf Bohlen
2023-03-01 4f3af11ef04f34f43f99a47f5a310a781a5f4977
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"]; 
32
33     $con = pg_connect("host=$host dbname=$db user=$user password=$pass")
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
40     while ($row = pg_fetch_row($rs)) {
41       echo "$row[0]\n";
42     }
43
44     pg_close($con); 
27b6ee 45 ?>
OB 46  </body>
47 </html>
48