Unsupported scripts and control panel web app for a hosting company
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

account.php 959B

12345678910111213141516171819202122232425
  1. <?php
  2. $authInfo = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"],6));
  3. unset($_SERVER['REDIRECT_REMOTE_USER']);
  4. if ($authInfo != "") {
  5. list($user, $password) = explode(':', $authInfo);
  6. $_SERVER['REDIRECT_REMOTE_USER'] = $user;
  7. $_SERVER['PHP_AUTH_PW'] = $password;
  8. }
  9. while (!isset($_SERVER['REDIRECT_REMOTE_USER']) || $_SERVER['REDIRECT_REMOTE_USER'] == "" ) {
  10. if ( (strlen($authInfo) == 0) || ( strcasecmp($authInfo, ":" ) == 0 )) {
  11. header('WWW-Authenticate: Basic realm="UTD-Hosting"');
  12. header('HTTP/1.0 401 Unauthorized');
  13. die('<div class="block">Authorisation failed.</div>');
  14. return;
  15. } else {
  16. $sql = 'SELECT user_name FROM users
  17. WHERE user_name = \''.m($_SERVER['REDIRECT_REMOTE_USER']).'\'
  18. AND user_pass = \''.m(md5($_SERVER['REDIRECT_REMOTE_USER'].$_SERVER['PHP_AUTH_PW'])).'\' AND user_admin = 1';
  19. $res = mysql_query($sql) or die(mysql_error());
  20. if (mysql_num_rows($res) > 0) {
  21. $result = mysql_fetch_assoc($res);
  22. }
  23. }
  24. }
  25. ?>