Solved

asp / mysql and form-check

Posted on 2002-03-10
4
412 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Multiflying 2 Input Text On a Table 7 31
Html CheckBox obtain Its Value 5 36
Insert Button on a table 16 45
Sending ASP to server side 8 28
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

679 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