Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $user = $_REQUEST['user'];
- $pass = $_REQUEST['password'];
- $conn = pg_connect("dbname=otwebgw user=$user password=$pass");
- if ($conn) {
- $res = pg_query($conn, 'SELECT version()');
- $dbinfo = pg_fetch_row($result, 0)[0];
- pg_free_result($res);
- pg_close($conn);
- } else {
- $dbinfo = NULL;
- }
- ?>
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>OT web gateway</title>
- <style>
- .info {
- color: #080;
- }
- .error {
- color: #800;
- }
- </style>
- </head>
- <body>
- <?php
- if ($dbinfo !== NULL) {
- echo "<p class=\"info\">$dbinfo</p>"
- } else {
- echo '<p class="error">Authentication error</p>'
- }
- ?>
- <p><a href="/index.php">Back</a></p>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement