Click here to Skip to main content
15,909,953 members
Home / Discussions / Web Development
   

Web Development

 
AnswerRe: uploading and storing files on server with php Pin
Marc Firth4-Oct-09 22:13
Marc Firth4-Oct-09 22:13 
AnswerRe: uploading and storing files on server with php Pin
Marc Firth4-Oct-09 22:16
Marc Firth4-Oct-09 22:16 
GeneralRe: uploading and storing files on server with php Pin
wartotojas5-Oct-09 6:01
wartotojas5-Oct-09 6:01 
GeneralRe: uploading and storing files on server with php Pin
Marc Firth5-Oct-09 21:59
Marc Firth5-Oct-09 21:59 
QuestionHELP! MySpace ID Pin
hifiger20044-Oct-09 5:46
hifiger20044-Oct-09 5:46 
AnswerRe: HELP! MySpace ID Pin
Christian Graus4-Oct-09 11:29
protectorChristian Graus4-Oct-09 11:29 
GeneralRe: HELP! MySpace ID Pin
hifiger20047-Oct-09 17:09
hifiger20047-Oct-09 17:09 
Question"Find Charlie!" .... or my .ASP vb script error :S Pin
MusicalGuy3-Oct-09 15:15
MusicalGuy3-Oct-09 15:15 
Sigh | :sigh:

Hi , I'd appreciate to get help on that. I can't seem to have my notify mail sent after my user registrated. Weird enough, the process it just fine since I can see the new user info in my access database... I just don't get why the email is not sent. Syntax error? It's not complicated, User subscribes which in this case is called action = 1....
Thanks in advance..!!!
Confused | :confused: Confused | :confused:

<!--METADATA TYPE="typelib"  
UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"  
NAME="CDO for Windows 2000 Library" -->
<!--METADATA TYPE="typelib"  
UUID="00000205-0000-0010-8000-00AA006D2EA4"  
NAME="ADODB Type Library" -->


<%
Dim action
     action = Request.QueryString("action")
    

If action = 1 Then

     Dim objConnection, objRecordset, SQLs, strUserID
     Dim strPassword, strFname, strLname, strAddress,   strCity, strCountry
     Dim strZip, strUserType, strJoinDate, strEducation, strNewsletter, strEmail, strCareer,strUnion,strMalefemale,strExperience

     Set objConnection = Server.CreateObject("ADODB.Connection")
     Set objRecordset = Server.CreateObject("ADODB.Recordset")
     objConnection.Open Application("ConnectionString")

     strUserType= 0

     strFname=Replace(Request.Form("firstname"), "'", "''")
     strLname=Replace(Request.Form("lastname"), "'", "''")
     strAddress=(Request.Form("address"))
     strCity=(Request.Form("city"))
     strZip=(Request.Form("zip"))
     strCountry=(Request.Form("country"))
     strEmail=(Request.Form("emailaddress"))
     strPassword=(Request.Form("password"))
     strCareer=(Request.Form("careerlevel"))
     strEducation=(Request.Form("education"))
     strJoinDate=(Request.Form("joindate"))
     strNewsletter=(CInt(Request.Form("newsletter")))
     strUnion = (Request.Form("Union"))
      strMalefemale = (Request.Form("malefemale"))
     strExperience = (Request.Form("experience"))
     If strNewsletter <> 1 Then
          strNewletter = 0
          End If
' ## ERROR CONTROL ##
     objConnection.Errors.Clear ' just to be safe, clear out any existing errors
     'On Error Resume Next ' then IGNORE errors!

     ' Put parameters in registration database.
     SQLs = "INSERT INTO Users (Email, Fname, Lname, UsrPassword, Address, City, Country, Zip, " & _
     "CareerLevel, Education, JoinDate, Newsletter, UserType) "
     SQLs = SQLs & "VALUES ("
     SQLs = SQLs & "'" & strEmail & "',"
     SQLs = SQLs & " '" & strFname & "',"
     SQLs = SQLs & " '" & strLname & "',"
     SQLs = SQLs & " '" & strPassword & "',"
     SQLs = SQLs & " '" & strAddress & "',"
     SQLs = SQLs & " '" & strCity & "',"
     SQLs = SQLs & " " & strCountry & ","
     SQLs = SQLs & " '" & strZip & "',"
     SQLs = SQLs & " '" & strCareer & "',"
     SQLs = SQLs & " '" & strEducation & "',"
     SQLs = SQLs & " '" & strJoinDate & "',"
     SQLs = SQLs & " '" & strNewsletter & "',"
     SQLs = SQLs & " " & strUserType & ")"

     'Response.write SQLs
      'Response.end

    
     Application.Lock
     objConnection.Execute(SQLs)
     Application.Unlock

' ## ERROR CONTROL ##
'On Error GoTo 0 ' turn off the ignoring of errors!
' now see if we got any errors from the insert!
For Each oops In objConnection.Errors
      If oops.number = -2147217900 Then
     'If oops.number = -2147467259 Then
     Session("Session_Message") = "The email address you entered already exists. <br />" & _
           "<a href=""../forgotpass.asp"">Forgot password? Click here</a>"
           Response.Write "That item already exists in that table!<BR>"
        'Create the Query String
        Dim strQueryString
        strQueryString = "?firstname=" & strFname & "&lastname=" & strLname & "&address=" & strAddress & _
             "&city=" & strCity & "&zip=" & strZip & "&emailaddress=" & strEmail
       
        Response.Redirect("../candidate/contactinfo.asp" & strQueryString)
          Response.End()
      Else
            Response.Write "Unexpected error: " & oops.number & " -- " & oops.description
          Response.End()
      End If

'Next

' The following assigns the new UserID to strUserID
Set objRecordset = objConnection.Execute("SELECT @@IDENTITY") ' Create a recordset and_
'               SELECT the new Identity
strUserID = objRecordset(0) ' Store the value of the new identity in variable strUserID

     Session("User_ID") = objRecordset("UserID")
     Session("User_Type") = objRecordset("UserType")
     Session("User_Name") = objRecordset("Fname") & " " & objRecordset("Lname")
     Session("UserLoggedIn") = true

     Session("User_ID") = strUserID
     Session("Login_Name") = ""
         
          objConnection.Close
Set objRecordset = Nothing

LoginUser (strUserID)    

Session("Session_Message") = "Welcome " &   Session("User_Name")
Session("paid") = 0

'Envoyons un courriel/Let's send the email

     dim htmlmessage
     dim strSiteURL
     strSiteURL = "http://www.mywebsiteurl.com/"
     htmlmessage = "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.01 Transitional//EN"">"
     htmlmessage = htmlmessage & "<html><head><title>"
     htmlmessage = htmlmessage & "Nouveau candidat</title>"
     htmlmessage = htmlmessage & "<style type=""text/css"">"
     htmlmessage = htmlmessage & "<!--"
     htmlmessage = htmlmessage & "Body {font-family: Verdana, Arial, Helvetica, sans-serif;      font-size: 12px}"
     htmlmessage = htmlmessage & "TD {font-family: Verdana, Arial, Helvetica, sans-serif;      font-size: 12px}"
     htmlmessage = htmlmessage & "-->"
     htmlmessage = htmlmessage & "</style>"
     htmlmessage = htmlmessage & "<META HTTP-EQUIV=""Content-Type"" Content=""text-html; charset=Windows-1252"">"
     htmlmessage = htmlmessage & "</head>"
     htmlmessage = htmlmessage & "<body topmargin=""5"" leftmargin=""5"" bgcolor=""#FFFFFF"" text=""#000000"">"
     htmlmessage = htmlmessage & "<b>mywebsiteurl.com</b><hr>"
     htmlmessage = htmlmessage & "Welcome to mywebsiteurl.com. Your new account is setup.<hr>"
     htmlmessage = htmlmessage & "<table width=""50%"" border=""0"" cellspacing=""0"" cellpadding=""1"">"
     htmlmessage = htmlmessage & "<tr>"
     htmlmessage = htmlmessage & "<td><b>Email Address: </b>" & strEmail &"</td>"
     htmlmessage = htmlmessage & "</tr>"
     htmlmessage = htmlmessage & "<tr>"
      htmlmessage = htmlmessage & "<td><b>Your Password: </b>"& strPassword &"</td>"
     htmlmessage = htmlmessage & "</tr></table>"
     htmlmessage = htmlmessage & "<P><a href=""http://" & strSiteURL & """>" & strSiteURL & "</a></P>"
     htmlmessage = htmlmessage & "</body></html>"    
     CDOSendEmail2 htmlmessage, strEmail
   Response.Redirect("http://mywebsiteurl/checkemail.html")
          If Session("UserLoggedIn") = true Then
          Response.Redirect("../candidate/default.asp")
          End If

Next

Else If action = 2 Then


Dim strSQL

Set objConnection = Server.CreateObject("ADODB.Connection")
Set objRecordset = Server.CreateObject("ADODB.Recordset")
objConnection.Open Application("ConnectionString")

   strSQL = "UPDATE Users SET " & _
     "Fname = '" & Replace(Request.Form("firstname"), "'", "''") & "', " & _
     "Lname = '" & Replace(Request.Form("lastname"), "'", "''") & "', " & _
     "Address = '" & Replace(Request.Form("address"), "'", "''") & "', " & _
     "City = '" & Replace(Request.Form("city"), "'", "''") & "', " & _
     "Zip = '" & Replace(Request.Form("zip"), "'", "''") & "', " & _
     "Country = '" & Replace(Request.Form("country"), "'", "''") & "', " & _
     "UsrPassword = '" & Replace(Request.Form("password"), "'", "''") & "', " & _
     "CareerLevel = '" & Replace(Request.Form("careerlevel"), "'", "''") & "', " & _
     "unionaff = '" & Replace(Request.Form("union"), "'", "''") & "', " & _
     "malefemale = '" & Replace(Request.Form("malefemale"), "'", "''") & "', " & _
     "experience = '" & Replace(Request.Form("experience"), "'", "''") & "', " & _
     "NewsLetter = '" & Cint(Request.Form("newsletter")) & "' " & _
    

     "WHERE UserID = " & session("User_ID") & ""

    
'Response.write strSQL
'Response.end


'     Use the execute method of the connection object the insert the record
     objConnection.execute(strSQL)

     objConnection.close
     set objConnection = nothing
    


     ' Confirmation message
     Session("Session_Message") = Replace(Session("User_Name"), "''", "'") & " your personal information has been updated."
    
     Response.Redirect "../candidate/default.asp"
END IF


Sub LoginUser (strUserID)
     Dim objConnection, objRecordset, SQLs
    
     Set objConnection = Server.CreateObject("ADODB.Connection")
     Set objRecordset = Server.CreateObject("ADODB.Recordset")
     objConnection.Open Application("ConnectionString")
    
     SQLs=""
     SQLs= "SELECT UserID, Email, Fname, Lname, UserType FROM Users WHERE UserID = " & strUserID & ""
     Set objRecordset=objConnection.Execute(SQLs)
    
     Session("User_ID") = objRecordset("UserID")
     Session("User_Type") = objRecordset("UserType")
     Session("User_Name") = Replace(objRecordset("Fname"), "''", "'") & " " & Replace(objRecordset("Lname"), "''", "'")
     Session("Login_Name") = objRecordset("Email")
     Session("UserLoggedIn") = true
    
     objConnection.Close
     Set objRecordset = Nothing
End Sub


Sub CDOSendEmail2(MessageBody, SendTo)
     Dim NewMail, objConfig, bSuccess, strErr
          bSuccess = False

          Set NewMail = Server.CreateObject("CDO.Message")         
          Set objConfig = Server.CreateObject("CDO.Configuration")

          Const cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing"
          Const cdoSMTPServer = "http://schemas.microsoft.com/cdo/configuration/smtpserver"
          Const cdoSMTPServerPort = "http://schemas.microsoft.com/cdo/configuration/smtpserverport"
          Const cdoSMTPAuthenticate = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
          Const cdoSendUsingPort = 2 'Must use this to use Delivery Notification
          Const cdoAnonymous = 0
          Const cdoBasic = 1 ' clear text

          dim strMailServer
          dim strMailServerPort
          dim strFromEmail
          strMailServer = "relay-hosting.secureserver.net"
          strMailServerPort = 25
          strFromEmail = "info@mywebsiteurl.com"

     'Configuration:
          objConfig.Fields(cdoSendUsingMethod) = cdoSendUsingPort  
          objConfig.Fields(cdoSMTPServer) = strMailServer ' value from DB
          objConfig.Fields(cdoSMTPServerPort) = strMailServerPort  
          objConfig.Fields(cdoSMTPAuthenticate) = cdoAnonymous  

     'Update configuration
          objConfig.Fields.Update
          Set NewMail.Configuration = objConfig
    
          NewMail.To = "<" & SendTo & ">" ' value passed from Form         
          NewMail.From = strFromEmail ' value of From Admin of site from DB
          NewMail.Subject = strSubject
          NewMail.HTMLBody = MessageBody
         
          On Error Resume Next ' catch errors
          NewMail.Send
          If Err <> 0 Then ' error occurred
               strErr = Err.Description
          else
               bSuccess = True
          End If
         
          if bSuccess = False Then
               Response.Write("Error sending mail to " + SendTo + ", message: " + strErr)
               Session("Session_Message") = Session("Session_Message") + "<br />   Error sending mail to " + SendTo + ", message: " + strErr + "<br />"
          end if
         
          Set NewMail = Nothing
          Set objConfig = Nothing
End Sub
End if

%>


La patience est 50% d'un projet web réussi!
QuestionScriptResource.axd Pin
AndreFratelli3-Oct-09 7:33
AndreFratelli3-Oct-09 7:33 
QuestionAdding Reference from "Add Reference" dialogue box Pin
Member 42289252-Oct-09 6:11
Member 42289252-Oct-09 6:11 
AnswerRe: Adding Reference from "Add Reference" dialogue box Pin
Christian Graus2-Oct-09 22:50
protectorChristian Graus2-Oct-09 22:50 
QuestionCapture OCX Control Events in VBScript Pin
VikashGohil1-Oct-09 0:47
VikashGohil1-Oct-09 0:47 
AnswerRe: Capture OCX Control Events in VBScript Pin
Suresh Balakrishnan27-Oct-09 19:01
Suresh Balakrishnan27-Oct-09 19:01 
Questionhow to find and update the data dynamically [modified] Pin
N Balakumaran30-Sep-09 20:56
N Balakumaran30-Sep-09 20:56 
AnswerRe: how to find and update the data dynamically Pin
Christian Graus1-Oct-09 12:27
protectorChristian Graus1-Oct-09 12:27 
QuestionCaptcha Image on HTML by ASP code Pin
11Developer30-Sep-09 20:38
11Developer30-Sep-09 20:38 
AnswerRe: Captcha Image on HTML by ASP code Pin
Abhishek Sur30-Sep-09 22:52
professionalAbhishek Sur30-Sep-09 22:52 
GeneralRe: Captcha Image on HTML by ASP code Pin
Abhijit Jana30-Sep-09 23:10
professionalAbhijit Jana30-Sep-09 23:10 
GeneralRe: Captcha Image on HTML by ASP code Pin
Abhishek Sur1-Oct-09 6:21
professionalAbhishek Sur1-Oct-09 6:21 
GeneralRe: Captcha Image on HTML by ASP code Pin
11Developer1-Oct-09 0:22
11Developer1-Oct-09 0:22 
GeneralCan anybody tell me the solution .... Pin
11Developer1-Oct-09 1:56
11Developer1-Oct-09 1:56 
GeneralRe: Can anybody tell me the solution .... Pin
Vasudevan Deepak Kumar1-Oct-09 2:35
Vasudevan Deepak Kumar1-Oct-09 2:35 
GeneralRe: Can anybody tell me the solution .... Pin
Jörgen Andersson1-Oct-09 2:36
professionalJörgen Andersson1-Oct-09 2:36 
GeneralRe: Can anybody tell me the solution .... Pin
11Developer1-Oct-09 2:47
11Developer1-Oct-09 2:47 
AnswerRe: Captcha Image on HTML by ASP code Pin
Vasudevan Deepak Kumar1-Oct-09 2:35
Vasudevan Deepak Kumar1-Oct-09 2:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.