Active Directory/Search for a user: Difference between revisions
Content added Content deleted
Line 83: | Line 83: | ||
puts results[0][:sn] # ==> "Jackman"</lang> |
puts results[0][:sn] # ==> "Jackman"</lang> |
||
=={{header|Run BASIC}}== |
|||
<pre>This allows the client on the web to see their directory. |
|||
The user can click on any file or directory and this will give them the following options: |
|||
[upload] data from their computer to the server |
|||
[delete] data from their directory |
|||
[rename] files |
|||
[view] image files</pre> |
|||
<lang runbasic>' --------------------------------------------- |
|||
' Directory maintenance |
|||
' --------------------------------------------- |
|||
cr$ = chr$(13) |
|||
dirOf$ = "c:\*.*" ' get directory of |
|||
' ------------------------------------------- |
|||
' Shell out directory |
|||
' ------------------------------------------- |
|||
[dirShell] |
|||
cls |
|||
html "<table bgcolor=lightsteelblue><TR><TD id=wk></TD></TABLE>" |
|||
loc$ = strRep$(dirOf$,"*.*","") |
|||
x$ = shell$("dir ";dirOf$) |
|||
i = 1 |
|||
while word$(x$,i,cr$) <> "" |
|||
a$ = word$(x$,i,cr$) |
|||
if trim$(a$) = "" then goto [next] |
|||
if left$(a$,1) = " " then goto [next] |
|||
if left$(a$,1) = cr$ then goto [next] |
|||
type$ = mid$(a$,26,3) |
|||
size$ = mid$(a$,30,9) |
|||
size$ = strRep$(size$,",","") |
|||
size = val(size$) |
|||
if type$ <> "DIR" and size = 0 then goto [next] |
|||
name$ = mid$(a$,40) |
|||
a$ = strRep$(a$,"<","[") |
|||
a$ = strRep$(a$,">","]") |
|||
html left$(a$,39) |
|||
link #ddir,name$, [doDir] |
|||
#ddir setkey(type$;"|";loc$;name$) |
|||
html "<BR>" |
|||
goto [next1] |
|||
[next] |
|||
print a$ |
|||
[next1] |
|||
i = i + 1 |
|||
wend |
|||
wait |
|||
[doDir] |
|||
type$ = word$(EventKey$,1,"|") |
|||
name$ = word$(EventKey$,2,"|") |
|||
if type$ = "DIR" then |
|||
dirOf$ = name$;"\*.*" |
|||
goto [dirShell] |
|||
end if |
|||
html "<script> document.getElementById('wk').innerHTML = '" |
|||
nname$ = strRep$(name$,"\","\\") |
|||
html "What do you want to do with ";nname$;"<BR>" |
|||
button #dofile, "Upload",[upload] |
|||
button #dofile, "Delete",[delete] |
|||
button #rename, "Rename",[rename] |
|||
button #view, "View", [view] |
|||
html "';</script>" |
|||
wait |
|||
[delete] |
|||
kill name$ |
|||
goto [dirShell] |
|||
[view] |
|||
nname$ = strRep$(name$,"\","/") |
|||
print "File:";nname$ |
|||
nname$ = mid$(nname$,3) |
|||
html "<EMBED SRC=""..";nname$;""">" |
|||
print "<EMBED SRC=""..";nname$;""">" |
|||
wait |
|||
[upload] |
|||
print "Upload File:";name$ |
|||
files #f, name$ |
|||
if #f HASANSWER() = 0 then |
|||
print "File: ";name$;" not found" |
|||
end if |
|||
' ------------------------------------- |
|||
' load data to directory |
|||
' ------------------------------------- |
|||
OPEN name$ FOR binary AS #f |
|||
filedata$ = input$(#f, LOF(#f)) |
|||
CLOSE #f |
|||
print filedata$ |
|||
wait |
|||
f$ = photoDir$;uploadId$ |
|||
OPEN f$ FOR binary AS #f |
|||
PRINT #f, filedata$ |
|||
CLOSE #f |
|||
wait |
|||
' -------------------------------- |
|||
' string replace rep str with |
|||
' -------------------------------- |
|||
FUNCTION strRep$(strRep$,rep$,with$) |
|||
ln = len(rep$) |
|||
k = instr(strRep$,rep$) |
|||
while k |
|||
strRep$ = left$(strRep$,k - 1) + with$ + mid$(strRep$,k + ln) |
|||
k = instr(strRep$,rep$) |
|||
WEND |
|||
END FUNCTION |
|||
end</lang> |
|||
Output as seen by the client on the web |
|||
<pre> Volume in drive C has no label. |
|||
Volume Serial Number is F42C-D87A |
|||
Directory of c:\ |
|||
06/10/2009 02:42 PM 24 autoexec.bat |
|||
06/10/2009 02:42 PM 10 config.sys |
|||
01/30/2012 02:26 PM 206 csb.log |
|||
03/09/2012 10:00 AM [DIR] data |
|||
02/07/2012 07:48 AM 748,990,464 precise-desktop-i386.iso |
|||
03/20/2012 04:07 PM [DIR] Program Files |
|||
02/05/2012 05:09 PM [DIR] Python |
|||
03/19/2012 04:55 PM [DIR] rbp101 |
|||
01/30/2012 02:26 PM 3,081 RHDSetup.log |
|||
01/30/2012 10:14 PM [DIR] Users |
|||
01/30/2012 02:35 PM [DIR] wamp |
|||
03/06/2012 04:00 AM [DIR] Windows |
|||
5 File(s) 748,993,785 bytes |
|||
7 Dir(s) 952,183,820,288 bytes free</pre> |
|||
=={{header|Tcl}}== |
=={{header|Tcl}}== |