PDA

View Full Version : PHP & domain user



ninhqh
14-05-2005, 19:39
Toi muon lam mot trang autentication cho domain user (mang intranet, dung windows domain controler), nhung khong biet lam the nao de xac nhan thong tin cua domain user. Bac nao am hieu van de nay giup tui chut xiu!

gate2vn
14-05-2005, 19:49
không sure lắm, nhưng bạn tìm hiểu về LDAP xem

dan_mien_que
15-05-2005, 12:05
Toi muon lam mot trang autentication cho domain user (mang intranet, dung windows domain controler), nhung khong biet lam the nao de xac nhan thong tin cua domain user. Bac nao am hieu van de nay giup tui chut xiu!

Bạn dùng window controller tại sao lại dùng PHP cho nó khó. Bên windows thì có Active Directory rồi. Bên PHP cũng có thể làm được nhưng khó hơn nhiều. Bên windows thì có VBS và trước kia dùng ADSI nay thì dùng WMI và WSH rất dễ dàng.

Thí dụ: Authentication settings dùng WMI và ASP
1:<%@ LANGUAGE="VBSCRIPT"%>
2:
3:<html>
4: <head>
5: <title>WMI Service Monitor</title>
6: </head>
7:
8: <body>
9: <%
10: Dim objWMIServices
11: Dim objWMIInstance, objWMIInstances
12:
13: Set objWMILocator = CreateObject("WbemScripting.SWbemLocator")
14: Set objWMIServices = objWMILocator.ConnectServer(cComputerName, cWMINameSpace)
15:
16: If Err.Number = 0 Then
17: Set objWMIInstances = objWMIServices.InstancesOf ("Win32_Service")
18: %>
19: <table BORDER="1">
20: <tr>
21: <th>Name</th>
22: <th>Service State</th>
23: <th>Service Start Mode</th>
24: </tr>
25: <%
26: For Each objWMIInstance in objWMIInstances
27: If objWMIInstance.Started = False And objWMIInstance.StartMode = "Auto" Then
28: %>
29: <tr>
30: <td>
31: <font color="#FF0000"><b>
32: <%=objWMIInstance.DisplayName%>
33: </b></font>
34: </td>
35: <td>
36: <font color="#FF0000"><b>
37: <%=objWMIInstance.State%>
38: </b></font>
39: </td>
40: <td>
41: <font color="#FF0000"><b>
42: <%=objWMIInstance.StartMode%>
43: </b></font>
44: </td>
45: </tr>
46: <%
47: Else
48: If objWMIInstance.Started = True Then
49: %>
50: <tr>
51: <td>
52: <font color="#008000">
53: <%=objWMIInstance.DisplayName%>
54: </font>
55: </td>
56: <td>
57: <font color="#008000">
58: <%=objWMIInstance.State%>
59: </font>
60: </td>
61: <td>
62: <font color="#008000">
63: <%=objWMIInstance.StartMode%>
64: </font>
65: </td>
66: </tr>
67: <%
68: Else
69: %>
70: <tr>
71: <td>
72: <%=objWMIInstance.DisplayName%>
73: </td>
74: <td>
75: <%=objWMIInstance.State%>
76: </td>
77: <td>
78: <%=objWMIInstance.StartMode%>
79: </td>
80: </tr>
81: <%
82: End If
83: End If
84: Next
85: %>
86: </table>
87: <%
88: Else
89: %>
90: <table>
91: <tr>
92: <td>Error - <%=Err.description%>, <%=Err.number%>, <%=Err.Source%></td>
93: </tr>
94: </table>
95: <%
96: End If
97: %>
98: </body>
99:</html>

ninhqh
16-05-2005, 19:59
Cám ơn bạn dan_mien_que đã góp ý, tôi biết là với ASP dễ hơn nhiều, vì cùng của thàng MS mà, vấn đề là tôi làm cho trường, mà chuẩn của trường là PHP, thế mới khó chứ!

Có bạn nào am hiểu giúp tôi với !!!