Solved

asp / mysql and form-check

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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 …
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

895 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now