Location: PHPKode > projects > Course-manager > courseman-0.1.1/admin-registration-edit.php
<?php
  header("Content-type: text/html; charset=utf-8");
  header('Cache-Control: no-store');
  require('global-php.php');
  require('local-criteria.php');
  $verbindung = database_connection(
  	      $lang_database_failure[$language]);
  $PHP_AUTH_USER = $_SERVER["PHP_AUTH_USER"];
  $PHP_AUTH_PW = $_SERVER["PHP_AUTH_PW"];
  $ergebnis = db_exec($verbindung,
			"SELECT * FROM staff_authorization,"
					. "superuser,capability "
				. "WHERE superuser.account"
				. "=staff_authorization.id "
				. "AND superuser.capability=capability.id "
				. "AND capability.name='registrants' "
				. "AND "
				. login_query_clauses(
					$PHP_AUTH_USER,
					$PHP_AUTH_PW)
				. ";");
  if (pg_numrows($ergebnis) < 1) {
    header('WWW-Authenticate: Basic realm="Kursverwaltung"');
    header("HTTP/1.0 401 Unauthorized");
    echo $lang_authentication_failure[$language];
    db_close($verbindung);
    exit;
  }
  $person = intval($_REQUEST["person"]);
  $result = db_exec($verbindung, "SELECT login "
  			. "FROM person_login "
			. "WHERE person=$person;");
  $login = pg_result($result, 0, 0);
  if (pg_numrows($result) > 0) {
    $passwort = generated_password(10);
    db_exec($verbindung, "START TRANSACTION;");
    db_exec($verbindung, "DELETE FROM person_password WHERE person=$person;");
    db_exec($verbindung, "INSERT INTO person_password (person,hash) "
    		. "SELECT $person,md5('$passwort');");
    db_exec($verbindung, "COMMIT;");
  }
  db_close($verbindung);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><?=ucfirst($lang_registration_change[$language])?></title>
<?=$local_stylesheets?>
</head>
<body>
<?=conditional_layout_before_content(ucfirst(
			$lang_registration_change[$language]))?>
<form action="<?=$public_address?>/anmeldung.php" method="POST">
<input type="HIDDEN" name="user" value="<?php echo $login; ?>" />
<?=lang_password_reset_to(
	$language,
	"<span style='font-family:\"Courier New\",Courier,monospace'>
$passwort
</span>")?>
<input type="HIDDEN" name="key" value="<?php echo $passwort; ?>" />
<input type="SUBMIT" value="<?=$lang_modify[$language]?>" />
</form>
<?=conditional_layout_after_content()?>
</body>
</html>
Return current item: Course-manager