<%
CheckSession()
saveornew=Request.QueryString("save")
if (saveornew="") then
saveornew=Request.Form("save")
end if
onoffPic=Request.QueryString("addpic")
if (onoffPic="") then
onoffPic=Request.Form("addpic")
end if
deletepic=Request.QueryString("deletepic")
picNo=Request.QueryString("picNo")
if (saveornew="save") or (saveornew="savepic") then
if (saveornew="save") then
ArtisanList=Request.Form("artisanlist")
if ArtisanList="on" then
ArtisanList="1"
else
ArtisanList="0"
end if
Category1=Request.Form("Category1")
Category2=Request.Form("Category2")
Category3=Request.Form("Category3")
Description=ReplaceQuotes(Request.Form("Description"))
mySQL="UPDATE "&UserTable&" SET Category1='" &Category1& "', Category2='" &Category2& "', Category3='" &Category3& "', Description='" &Description& "', ListAsArtisan="&ArtisanList&" WHERE ID=" &session("userid")& ""
ExecuteSQL(mySQL)
'response.write mySQL
'response.end
end if
'---ADD PIC -------------------------------------
if onoffPic = "on" then
if strID="" then
strID=session("userid")
end if
dim picArray(4)
'Find pics for ID
mySQL="SELECT Pic1, Pic2, Pic3, Pic4 FROM "&UserTable&" WHERE ID = " &strID& ""
set conntemp=server.createobject("adodb.connection")
conntemp.ConnectionTimeout = 20
conntemp.open myDSN
set rstemp=conntemp.execute(mySQL)
DO UNTIL rstemp.eof
For each whatever in rstemp.fields
Select case whatever.name
case "Pic1"
picArray(1)=whatever.value
case "Pic2"
picArray(2)=whatever.value
case "Pic3"
picArray(3)=whatever.value
case "Pic4"
picArray(4)=whatever.value
End select
Next
rstemp.movenext
LOOP
rstemp.close
set rstemp=nothing
conntemp.close
set conntemp=nothing
if deletepic="yes" then
mySQL="UPDATE "&UserTable&" SET Pic"&picNo&"='' WHERE ID = " &strID& ""
'response.write mySQL
ExecuteSQL(mySQL)
'Delete the picture
Dim file
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
file = ArtisanPicPath+picArray(picNo)
if objFSO.FileExists (file) then
'response.write "File deleted: "&file
objFSO.DeleteFile file, True
Set objFSO = Nothing
end if
picArray(picNo)=""
end if
response.write "
"
response.write "
Your artisan listing has been saved.
"
response.write "
Edit your picture list below.
"+vbcrlf
response.write "
"+vbcrlf
For i=1 to UBound(picArray)
response.write "Pic "&i&": "+vbcrlf
picform=""+vbcrlf
if (picArray(i)<> "") then
response.write "Change Image | Delete Image
"+vbcrlf
response.write picform
response.write " "
response.write ""+vbcrlf
else
response.write "Add Image "+vbcrlf
response.write picform
end if
response.write "
"+vbcrlf
else
mySQL="SELECT * FROM ShowcaseUsers WHERE ID="&session("userid")&";"
set conntemp=server.createobject("adodb.connection")
conntemp.ConnectionTimeout = 20
conntemp.open myDSN
set rstemp=conntemp.execute(mySQL)
DO UNTIL rstemp.eof
For each whatever in rstemp.fields
Select case whatever.name
case "Lastname"
lastname=whatever.value
case "Firstname"
firstname=whatever.value
case "Company"
company=whatever.value
case "UserName"
username=whatever.value
case "Address1"
address1=whatever.value
case "Address2"
address2=whatever.value
case "City"
city=whatever.value
case "State"
state=whatever.value
case "Zip"
zip=whatever.value
case "Country"
country=whatever.value
case "ContactPref"
contactpref=whatever.value
case "PhoneNumber"
phonenumber=whatever.value
case "ListAsArtisan"
strArtisanList=whatever.value
case "Category1"
strCatChecked=whatever.value
case "Category2"
strCatChecked2=whatever.value
case "Category3"
strCatChecked3=whatever.value
case "Description"
strDescription=whatever.value
case "Pic1"
strPic1=whatever.value
case "Pic2"
strPic2=whatever.value
case "Pic3"
strPic3=whatever.value
case "Pic4"
strPic4=whatever.value
End select
Next
rstemp.movenext
LOOP
'Get Category options
mySQL="SELECT ID, ArtisanCategory FROM Categories"
strCatOptions = ""
strCatOptions2 = ""
strCatOptions3 = ""
set rstemp=conntemp.execute(mySQL)
DO UNTIL rstemp.eof
For each whatever in rstemp.fields
Select case whatever.name
case "ArtisanCategory"
strCat=whatever.value
End select
Next
rstemp.movenext
if (strCatChecked = cstr(strCat)) then
strchecked="SELECTED"
else
strchecked=""
end if
if (strCatChecked2 = cstr(strCat)) then
strchecked2="SELECTED"
else
strchecked2=""
end if
if (strCatChecked3 = cstr(strCat)) then
strchecked3="SELECTED"
else
strchecked3=""
end if
strCatOptions = strCatOptions&""
strCatOptions2 = strCatOptions2&""
strCatOptions3 = strCatOptions3&""
LOOP
rstemp.close
set rstemp=nothing
conntemp.close
set conntemp=nothing
response.write " "
end if
%>