Noget galt med dette script
den sætter ikke oplysninger ind i db, men sætter kun billede i mappen<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Submit My Photo On Hot-Arab.com</title>
<link href="submit.css" rel="stylesheet" type="text/css">
</head>
<body>
<%
dim strAction
strAction = request("action")
select case strAction
case "upload"
UploadFile
case else
ShowForm
end select
sub ShowForm %>
<form name="form1" enctype="multipart/form-data" method="post" action="submit.asp?action=upload">
<table width="600" border="0" cellpadding="2" cellspacing="3" bgcolor="#CCCCCC">
<tr>
<td height="30" colspan="2" align="center" bgcolor="#999999" class="h">Submit a picture of yourself!</td>
</tr>
<tr>
<td width="390" class="ha">1.Pick a username</td>
<td width="210"><label>
<input name="user" type="text" id="user" size="35">
</label></td>
</tr>
<tr>
<td width="390" class="hb">Click to see if this username is available -></td>
<td>Check box </td>
</tr>
<tr>
<td width="390"> </td>
<td> </td>
</tr>
<tr>
<td width="390" class="ha">2. Choose a password</td>
<td><input name="password" type="password" id="password" size="35" /></td>
</tr>
<tr>
<td width="390" class="hb">Confirm Password</td>
<td></td>
</tr>
<tr>
<td width="390"> </td>
<td> </td>
</tr>
<tr>
<td width="390" class="ha">3. Some basic info</td>
<td> </td>
</tr>
<tr>
<td width="390" class="hb">Are you male or female?</td>
<td><label>
<input name="male" type="radio" value="radiobutton" />
Male </label>
<label>
<input name="female" type="radio" value="radiobutton" />
Female</label></td>
</tr>
<tr>
<td width="390" class="hb">How old are you?</td>
<td><label>
<select name="select">
<%
Dim t
For t = 18 to 60 Step 1
%><option value="18"><%=t%></option>
<% next %>
</select>
</label></td>
</tr>
<tr>
<td width="390" class="hb">What's your email?</td>
<td><input name="email" type="text" id="email" size="35" /></td>
</tr>
<tr>
<td width="390"> </td>
<td> </td>
</tr>
<tr>
<td width="390" class="ha">4. Submit your photo</td>
<td> </td>
</tr>
<tr>
<td colspan="2" align="center" class="hb">Upload a .jpg or .gif file from your computer (500000 bytes max):<br />
<input name="file" type="file" id="file" size="35" /></td>
</tr>
<tr>
<td width="390"> </td>
<td> </td>
</tr>
<tr>
<td colspan="2" class="hb">
Please keep your photos FUN, CLEAN and REAL. In other words, no porn, sexually suggestive poses, advertisements, copyrighted content, etc.
<br>
Photos with URL's, email addresses, etc. written on them are NOT allowed. Also, if there are multiple people in the picture, make sure it's obvious which person is to be rated. You must be 18 to post your picture on HOT-ARAB. More questions? Ask <a href="#">here</a>.</td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2" class="ha">5. That's it! Click the button to sign up</td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2" align="center"><label>
<textarea name="accept" cols="56" rows="5" id="accept">accept</textarea>
</label></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="upload" value="I Agree to the Terms and Conditions"></td>
</tr>
</table>
</form>
<!--#include file="conn.asp"-->
<%
set tbl_img = server.CreateObject("ADODB.recordset")
tbl_img.Open "tbl_img", conn, 2, 2
tbl_img.AddNew
tbl_img("user") = request.Form("user")
tbl_img("password") = request.Form("password")
tbl_img("kon") = request.Form("kon")
tbl_img("old") = request.Form("old")
tbl_img("email") = request.Form("email")
tbl_img("img") = strFileName
tbl_img.update
tbl_img.close
response.write "Filen er uploadet"
response.Redirect("submit.asp")
end sub
sub UploadFile
dim intPosMIMEHeader, intPosFileDataStart
dim intPosFileNameStart, intPosFileNameEnd
dim intPosFileDataEnd, intDataSize
dim binData, binFileData, binFileName, binStart
dim strFileName
dim objFSO, objFile
intDataSize = request.totalbytes
binData = request.binaryread(intDataSize)
intPosMIMEHeader = instrB(binData,chrB(13) & chrB(10)) - 1
intPosFileDataStart = instrB(binData, chrB(13) & chrB(10) & chrB(13) & chrB(10)) + 4
intPosFileNameStart = instrB(binData,cstrB("filename=")) + 10
intPosFileNameEnd = instrB(intPosFileNameStart,binData,chrB(34))
binStart = midB(binData,1,intPosMimeHeader)
binFileName = midB(binData,intPosFileNameStart, _
intPosFileNameEnd - intPosFileNameStart)
intPosFileDataEnd = instrB(intPosMIMEHeader, binData, binStart) - 2
strFileName = bin2str(binFileName)
strFileName = right(strFileName, len(strFileName) - instrrev(strFileName,"\"))
set objFSO = server.createobject("Scripting.FileSystemObject")
set objFile = objFSO.CreatetextFile(server.mappath("img\boys\" & strFileName), _
true, false)
objFile.write bin2str(midB(binData, intPosFileDataStart, _
intPosFileDataEnd - intPosFileDataStart))
objFile.close
set objFile = Nothing
set objFSO = Nothing
end sub
function bin2str(byref binS)
' omdanner en binær følge til en tekststreng
dim i, strRes
for i = 1 to lenB(binS)
strRes = strRes & chr(ascB(midB(binS, i, 1)))
next
bin2str = strRes
end function
function cstrB(strS)
' omdanner en tekststreng til en binær følge
dim i, binRes
for i = 1 to len(strS)
binRes = binRes & chrB(asc(mid(strS,i,1)))
next
cstrB = binRes
end function
%>
</body>
</html>
