Solved

asp / mysql and form-check

Posted on 2002-03-10
4
410 Views
Last Modified: 2012-08-14
Can You see whats wrong here ? It keep telling me theres no password written in the form. (35 points is all I have)

inc_Signup.asp :

<script language="javascript">
      <!--
            function checkform() {
                  var doSubmit=false;
                  var genderSel=false;

                  for (var i=0; i<3; i++) {
                        if (frmSignup.gender[i].checked) { genderSel=true; }
                  }

                  if (frmSignup.pass.value=="") {
                        alert("Du skal indtaste at password!");
                  } else if (frmSignup.email.value=="") {
                        alert("Du skal indtaste din email adresse!");
                  } else if (frmSignup.fullname.value=="") {
                        alert("Du skal skrive dit navn!");
                  } else if (!genderSel) {
                        alert("Du skal vælge et køn!");
                  } else if (frmSignup.filename.value=="") {
                        alert("Du skal vælge et billede til din profil!");
                  } else {
                        frmSignup.submit();
                  }
            }
      //-->
</script>
For at deltage med dit eget billede, er det nødvendigt at vi modtager lidt oplysninger om dig, samt dit billede - udfyld venligst nedenstående formular, og derefter er du automatisk med i afstemningen :<br><br>
<center>
      <form action="signup_save.asp" name="frmSignup" method="post" enctype="multipart/form-data">
      <input type="hidden" name="mode" value="login">
      <table border="0" width="100%" cellspacing="0" cellpadding="0">
            <tr><td colspan="2"><b>Følgende informationer forbliver hemmelige : </b></td></tr>
            <tr><td colspan="2">&nbsp;</td></tr>
            <tr>
                  <td width="125"><b>Password:</b></td>
                  <td><input name="pass" class="btn" size="20"></td>
            </tr>
            <tr>
                  <td><b>E-Mail:</b></td>
                  <td><input size="50" name="email" class="btn"></td>
            </tr>
            <tr><td colspan="2">&nbsp;</td></tr>
            <tr><td colspan="2"><b>Følgende informationer bliver synlige på din profil side : </b></td></tr>
            <tr><td colspan="2">&nbsp;</td></tr>
            <tr>
                  <td><b>Navn:</b></td>
                  <td><input size="50" name="fullname" class="btn"></td>
            </tr>
            <tr>
                  <td>Bynavn:</td>
                  <td><input size="50" name="homecity" class="btn"></td>
            </tr>
            <tr>
                  <td>Land:</td>
                  <td><input size="50" name="homecountry" class="btn"></td>
            </tr>
            <tr>
            <td vAlign=top>Teaser tekst:</td>
            <td><textarea name="teaser" rows="5" cols="50" class="btn"></textarea></td></tr>
            <tr>
                  <td><b>Køn:</b></td>
                  <td><input type="radio" value="2" name="gender">Mand<input type="radio" value="1" name="gender">Kvinde<input type="radio" value="3" name="gender">Barn</td>
            </tr>
            <tr>
                  <td valign="top"><b>Billede:</b></td>
                  <td>
                        <input type="file" size="40" name="filename" class="btn"> (max. <%=MaxFileSize \ 1024%> KB)<br>
                        <b>Bemærk:</b> Det er kun tilladt at uploade .JPG og .PNG billeder!
                  </td>
            </tr>
            <tr><td colspan="2"><hr class="gray_hr"></td></tr>
            <tr>
                  <td>&nbsp;</td>
                  <td><input type="button" value="Tilføj billede" class="btn" onclick="checkform();"></td>
            </tr>
      </table>
      </form>
</center>


Singup_save.asp


<%
      On Error Resume Next
dim PUpload
      Set PUpload = Server.CreateObject("AspSmartUpload.SmartUpload")
      PUpload.MaxFileSize = MaxFileSize
      PUpload.AllowedFilesList = "jpg,jpeg,png"
      PUpload.Upload
      If Err <> 0 Then
            If Err = -2147220494 Then intErrorCode = 20
            If Err = -2147220399 Then intErrorCode = 21
            Err.Clear
      End If

      If Not PUpload.Files("filename").IsMissing And intErrorCode = 0 Then
            Set Conn = Server.CreateObject("ADODB.Connection")
            Conn.Open "DRIVER=mysql; SERVER=" & sql_Server & "; DATABASE=" & sql_DB & "; UID=" & sql_UID & "; PWD=" & sql_PWD

            strPass = DeMessSQL(Trim(PUpload.Form("pass")))
            strEmail = DeMessSQL(Trim(PUpload.Form("email")))
            strName = DeMessSQL(Trim(PUpload.Form("fullname")))
            strCity = DeMessSQL(Trim(PUpload.Form("homecity")))
            strCountry = DeMessSQL(Trim(PUpload.Form("homecountry")))
            strText = DeMessSQL(Trim(PUpload.Form("teaser")))
            strGender = DeMessSQL(Trim(PUpload.Form("gender")))
            strFilename = PUpload.Files("filename").FileName
            
            If strGender = "" Or Not IsNumeric(strGender) Then intErrorCode = 3
            If strEmail = "" Or Not IsEmail(strEmail) Then intErrorCode = 2
            Set Rs = Conn.Execute("SELECT id FROM persons WHERE email='" & strEmail & "'")
            If Not Rs.BOF Then intErrorCode = 4
            If strPass = "" Then intErrorCode = 1

            If intErrorCode = 0 Then
                  strSQL = "INSERT INTO persons (password,email,name,city,country,text,gender,picturefile,datetime,shown) VALUES ("
                  strSQL = strSQL & "PASSWORD('" & strPass & "'),"
                  strSQL = strSQL & "'" & strEmail & "',"
                  strSQL = strSQL & "'" & strName & "',"
                  strSQL = strSQL & "'" & strCity & "',"
                  strSQL = strSQL & "'" & strCountry & "',"
                  strSQL = strSQL & "'" & strText & "',"
                  strSQL = strSQL & strGender & ","
                  strSQL = strSQL & "'" & strFilename & "',"
                  strSQL = strSQL & "now(),0);"

                  Conn.Execute strSQL
                  Set Rs = Conn.Execute("SELECT id FROM persons ORDER BY id DESC")
                  strPID = Rs(0)

                  strMail = strEMVO
                  strMail = Replace(strMail, "#navn", strName)
                  strMail = Replace(strMail, "#pid", strPID)

                  PUpload.Files("filename").SaveAs Server.MapPath("db/pictures/" & strPID & "_" & strFilename)
                  If Err = 0 Then
                        ResizeIImage Server.MapPath("db/pictures/" & strPID & "_" & strFilename), 615
                        Conn.Execute "INSERT INTO hits (pid) VALUES (" & strPID & ");"
                        SendMail strEmail, "Registrering på Hot Or Not", strMail
                  Else
                        Conn.Execute "DELETE FROM persons WHERE id=" & strPID
                        intErrorCode = 30
                  End If
            End If
      ElseIf intErrorCode = 0 Then
            intErrorCode = 40
      End If
%>



0
Comment
Question by:Capion
  • 2
  • 2
4 Comments
 
LVL 30

Accepted Solution

by:
third earned 40 total points
ID: 6855290
maybe you didn't fill the password field. i tried ur code it only asks when it isn't filled. so what is the real problem? can u elaborate?

btw, password characters are usually ciphered when you type in the field. so i suggest (for the your user's protection) put,

<input name="pass" type="password" class="btn" size="20">
0
 
LVL 1

Author Comment

by:Capion
ID: 6855767
yes, I thought it was because of the *** the error came, so I changed it to a normal text-field.
I tried it also (the code I put in here), and the form works..well hmm..
There must be something else wrong then.

http://www.capion.dk/db/defaulthot.asp?mode=signup

I didn´t bring the whole code, because I didn´t think it was relevant, its only html.
0
 
LVL 30

Expert Comment

by:third
ID: 6858831
C???
0
 
LVL 1

Author Comment

by:Capion
ID: 6861109
ehm.. I gave up, thought You should have the point for trying *S*
I will find some other way to set up a photo-voting-booth.
It quite hard to find a script other than cgi or php and mysql. This particular one was in asp and mysql.
Mayby You have a link to a working script ? (á la hot or not)
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Summernote and form validation 10 142
Diminish Pop-up  in 3 seconds 7 23
html Uncheck Checkbox 2 13
Obtain data from database .mdb 4 7
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question