Making the login screen in BYOND return to my website was easy.
Which in PHP would be done like:
<?
echo("<a href='https://secure.byond.com/console.cgi?qd=login;url=http://www.tibbius.com/'>Login</a>");
?>
But is there a way for me to display, at least, the users keyname in PHP?
(Nadrew suggested I ask in this forum)
Basically what you want to do is use a PHP script and shell_exec() a DMCGI world. Make the DMCGI world output the users key, then back in your PHP script take the value shell_exec() returns and get the key out of it.
Here's something Mike H showed me that demonstrates it much better than my explaination. whoami.dmb is just a simple little DMCGI application that outputs the users key (and nothing else).
#!/dh/cgi-system/php.cgi
<html>
<head><title>BYOND login test</title></head>
<body>
">Log in
<?php
// Login auth stuff
$exec_string="/home/byond/whoami.dmb | tail -1";
$authinfo=shell_exec($exec_string);
// remove newline character
$endchar = substr("$authinfo", strlen("$authinfo") - 1, 1);
if ($endchar == "\n") {
$authinfo = substr("$authinfo", 0, -1);
}
echo "Hello, $authinfo!";
?>
</body>
</html>