Hi al,
I have the following code - downloaded from ZEND - that checks a users name
and password against our NT server, the username is then stored in $USER.
How can i then make the contents of that value available to other php pages?
I have tried a second form with the second page as the 'action' but it does
not seem to work for me ($USER is null in the second page), if I make the
second page the 'action' for the first form, it works but any username can
be entered with any or no password. To reduce the size of this post I have
removed most of the comments - the code works in the same way as smbauth in
Squid.
<form method="POST">
<table>
<tr><td>Username:</td><td><input type="text" name="USER"
size="12"></td></tr>
<tr><td>Password:</td><td><input type="password" name="PASS"
size="12"></td></tr>
<tr><td> </td><td><input type="submit" value="submit"
name="submit"></td></tr>
</table>
</form>
<p>
<?php
if ($REQUEST_METHOD=="POST") {
global $USER;
global $PASS;
# PDC Variables Below:-
$SambaPath="/usr/";
$ServerNetBIOS="OurPDC";
$NETLOGONfolder="NETLOGON";
$ServerIP="xxx.xxx.xxx.xxx";
$DomainName="Our Domain";
$filename="proxyauth";
# Execute at UNIX command line:-
$smbauth = exec($SambaPath."bin/smbclient
\"//".$ServerNetBIOS."/".$NETLOGONfolder."\" -I ".$ServerIP." -d 0 -E -U
".$USER."%".$PASS." -W \"".$DomainName."\" -c \"get ".$filename." -\"");
# Check to see if 'allow' is returned:-
if ($smbauth=="allow" || $smbauth=="allow<p>") {
echo "Username = ".$USER;
} else {
echo "Username or Password Incorrect try again";
}
}
?>
</body>
</html>
_________________________________________
Simon Bryan
IT Manager
OLMC Parramata
ICQ#: 137562751
_________________________________________
--
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug