C
CSharp
C++
Java
Visual Basic
HTML - CSS
Android
Asp
Asp.Net
Php
Python
JavaScript
SQL
XML
Assembly
Algorithms
Arrays
Code Snippets
Cookies
Databases
Date Time
E-Mail
Graphics
HTML and PHP
Look and Feel
MySQL
Strings
More...
Php > User Management sample source codes
Php Code > Smb_auth
Smb_auth <? /* 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"; } ?>
Privacy Policy
|
Contact
|
Advertising
|
Link to Us
|
Directory