`<?php
mysqli_connect("localhost", "root", "", "groboch123"); ?>
<?php
$Realm = "<big><span style="color:green; font-weight:bold;"/>Worked!</span></big>";?>
<?php
if (!isset($_SERVER['PHP_AUTH_USER']))/*Need to be !isset*/{
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'Lorem Ipsum'; /* Make the user see this */
exit;
} else {
echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>";
}
?>`
I am trying to create an authorized login.
I’m looking for ways here to improve my code. I want the Lorem Ipsum to be the Realm. 🙂 Hopefully, this can get done someway.
This will be a great video game for computers. I am trying to add this prompt. Or, alternatively, if this is an too expensive method maybe using the prompt() to validate credentials??
“I want the Lorem Ipsum to be the Realm” What stops you from doing so?
@Olivier I want to place an entire document within the ” aswheareas the Lorem Ipsum is placed. But don’t know how to do this.
You can’t when using Basic auth. The user will only see the name defined in
realm="..."
.Or perhaps using this <?php if ($loggedin:?> whereas I correct the :