Turecko-americká vycházející matematická hvězda Levent Alpöge ze společnosti Anthropic vyvolal pozdvižení oznámením (PDF), že s pomocí superinteligence Claude od Antropicu dokázal vyřešit jeden ze sedmi největších matematických problémů tisíciletí, slavnou Riemannovu hypotézu (prvočísla se mezi čísly objevují zdánlivě nepravidelně, hypotéza tvrdí, že za jejich rozmístěním je určitý řád). Svůj důkaz uvolnil jako open-source
… více »
cat external_authorization.php
/*
* Function to use the VMS authorization technique in
* lue of an honest LDAP connection
*
* @param username : string with username
* @param password : string with password
* @return String with authorized user type FACULTY/STAFF as example
* OR returns false if error or unauthorized.
*
* This is an example of external authorization. Basically you just
* need an 'authorize' function that accepts an username and password.
* It will return TRUE or FALSE.
*
* You can also add a processUser function. It accepts a pointer
* to the user object. It will only be called if an externally authorized
* user is not in the local system.
*/
function authorize($username, $password) {
$address = null;
$port = null;
$data = null;
if(empty($password) || (strlen($password) == 0)) {
return FALSE;
}
if(!($socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP))) {
return FALSE;
}
if(!socket_connect($socket, $address, $port)) {
return FALSE;
}
if(!socket_write($socket, $username."/".$password."\r\n")) {
return FALSE;
}
while(($buf = socket_read($socket, 512)) !== false && ($buf!=""))
{
$data .= $buf;
}
if ($data == "INVALID")
return FALSE;
elseif (preg_match("/ok/i", $data))
return TRUE;
return FALSE;
}
function processUser(&$user){
$user->email = $user->username . "@emaildomain.com";
}
?>
Na otázku zatím nikdo bohužel neodpověděl.
Tiskni
Sdílej: