PhotoShare

With photoshare.bas you can display and exchange photos with friends. If you wanted to exchange other files than JPG, it wouldn't be difficult either. Password protection mechanism included.

code format="vb" '############################################# ' ' PHOTOSHARE by Alix Whittal - Jan 2008 ' '#############################################

'*********************************************************** ' ' ENTER YOUR OWN PARAMETERS HERE ! ' ' -> usertot = number of users who are going to share photos ' -> user$(1,2) = 1=name of user - 2=password ' -> filename$ = name of directory containing the uploads ' ' The username are the same as their upload directory ' i.e. John will upload their files to the ' public/upload/John directory ' '************************************************************ global UploadUrl$, UploadDir$ UploadUrl$ = "uploads/" UploadDir$="uploads\" usertot=4 dim user$(usertot,2) user$(1,1)="Tim" user$(1,2)="a" user$(2,1)="Tom" user$(2,2)="b" user$(3,1)="Tess" user$(3,2)="c" user$(4,1)="Miss" user$(4,2)="d"

'****************************************** ' END OF PARAMETERS AREA '****************************************** global DefaultDir$ 'bug in RB fixed in next version

for i=1 to usertot familygroup$= familygroup$ + user$(i,1) + "," next a = mkdir("public\";UploadDir$) print a '****************************************** ' MAIN PROGRAM '******************************************

[Start] cls print print "-" print "-   Welcome to AlixBasix Friendly Photoshare utility !!!   -" print "-" print Print "---> CHOOSE A FAMILY :" print radiogroup #rgroup, familygroup$, user$(1,1) #rgroup horizontal(1) print link #exec, "submit!", [ChooseAction] print wait [ChooseAction] print groupChoice$ = #rgroup selection$ cls print groupChoice$ print "1201688057120168805712016880571201688057~" radiogroup #rgroup2, "View/Download,Upload,Choose Again", "" print link #exec, "submit!", [MakeAction] print wait

[MakeAction] family$=groupChoice$+"\" groupChoice2$ = #rgroup2 selection$ if groupChoice2$="" then print "please make a selection !" if groupChoice2$="Choose Again" then goto [Start] if groupChoice2$ = "View/Download" then result=DiplayJPG(groupChoice$, 4) 'Only users with valid passwords can upload files if groupChoice2$ = "Upload" then goto [ValidUserCheck] wait

[ValidUserCheck] cls userok=0 userno=0 input "Username";username$ for i=1 to usertot if username$ = user$(i,1) then userno=i userok=1 exit for end if    next i     if userok = 0 then cls print "Invalid username" goto [ValidUserCheck] end if    userok=0 cls print "Password ?" print passwordbox #pw, "" link #action, "Submit", [ValidPasswordCheck] wait

[ValidPasswordCheck] pass$= #pw CONTENTS$ if pass$ <> user$(userno,2) then print print "Invalid Password" goto [ValidUserCheck] wait end if [UploadMenu] cls print:print print print "      *** NOTE !!! ***" print print " Photos maximum size = 1024x768" print " --" print " to resize JPG files, you can use the Image Resizer from Microsoft" print " Image Resizer enables you to resize one or MANY image files with a right-click" html "Download Image Resizer" print:print print:print link #action, "Finished with uploads", [NoMore] print link #action, "Continue with uploads", [UploadAgain] print wait [NoMore] goto [Start] wait [UploadAgain] print print path$="public\" + UploadDir$ + groupChoice$ a = mkdir(path$) if a then print print "Created directory: ";path$ end if result=UploadJPG(path$) goto [UploadMenu] wait

'******************************************************* '                       FUNCTIONS  AND SUBS '******************************************************* ' ' DIPLAYJPG : get JPG files and display n at a time '******************************************************

function DiplayJPG(groupChoice$, n) path$="public\" + UploadDir$ + groupChoice$ a = mkdir(path$) if a then print print "Created directory: ";path$ end if print print "To download, Click right on picture and select SAVE AS" print filepath$="public\"+UploadDir$+groupChoice$+"\*.jpg" files #g, filepath$ if #g HASANSWER then count = #g rowcount for i = 1 to count if #g hasanswer then 'retrieve info for next file dummy$ = #g nextfile$ img$="../public/";UploadUrl$;groupChoice$;"/";#g NAME$ if count4 = 4 then html " " count4=0 end if        count4=count4+1 html "" end if  next else emptymsg$="there are no files in " + groupChoice$ + "'s folder" Print emptymsg$ end if End Function '************************************************** ' UPLOADJPG '************************************************** function UploadJPG(path$) upload "Select a file to upload."; file$ if file$ <> "" then open file$ for binary as #f filedata$ = input$(#f, LOF(#f)) close #f open path$ + "\" + file$ for binary as #g print #g, filedata$ close #g 'delete uploaded file from root directory kill file$ end if end function

code