| | |||||||
| |||||||
| |||||||
|
|
|
|
|
|
|
Quick little class to authenticate a username/password off of a PDC. By : Urkle <? /* Author: Edward Rudd <eddie@omegaware.com> Based on smb_print by Nathan Cassano <nathan@cjhunter.com> Version: 0.1 Example: $test = new smb_auth(); $test->host = "cannondale"; $test->smbclient = "/usr/bin/smbclient"; #default is "/usr/bin/smbclient" $test->username = "guest"; $test->password = "dontlook"; if($test->authenticate() != 0){ echo "Invalid Authentication"; }else{ echo "Authenticated"; } */ class smb_auth { var $host; var $username; var $password; var $smbclient = "/usr/bin/smbclient"; function smb_auth() { return 0; } function authenticate() { /* Make sure smbclient path is correct */ if(!is_executable($this->smbclient)){ die("Error: '$this->smbclient' invalid smbclient path"); } /* create the shell script */ $script = "$this->smbclient //$this->host/IPC$ $this->password " ."-U $this->username -c 'quit' > /dev/null 2>&1"; $stuff = system ($script,$result); return $result; } } ?> /* example */ <? include "smb_auth.php"; $test = new smb_auth(); $test->host = "cannondale"; $test->smbclient = "/usr/bin/smbclient"; $test->username = "guest"; $test->password = "dontlook"; if($test->authenticate() != 0){ echo "Invalid Authentication"; }else{ echo "Authenticated"; } ?>
More User Management Code Articles |
| |
| |