QREncode: Fix if REMOTE_HOST not found in $_SERVER headers
authorMichal Novotny <minovotn@redhat.com>
Thu, 1 Nov 2012 16:23:35 +0000 (17:23 +0100)
committerMichal Novotny <minovotn@redhat.com>
Thu, 1 Nov 2012 16:23:35 +0000 (17:23 +0100)
Signed-off-by: Michal Novotny <minovotn@redhat.com>

pages/users.php

index 0b277b1..9075561 100644 (file)
                echo "<div class=\"label\">QR Code: </div>";
                echo "<div class=\"value\">";
 
-               $str = "http://localhost/virtDroid/?address=http://".$_SERVER['REMOTE_HOST']."/php-virt-control/xmlrpc.php&apikey=".$apikey;
+               $str = "http://localhost/virtDroid/?address=http://".(array_key_exists('REMOTE_HOST', $_SERVER) ? $_SERVER['REMOTE_HOST'] : $_SERVER['REMOTE_ADDR'])."/php-virt-control/xmlrpc.php&apikey=".$apikey;
                $qrdata = qrencode($str,3,QR_ECLEVEL_M,QR_MODE_8);
                foreach($qrdata as $row) {
                        echo "<div class=\"qr_line\">";