The code below is used to register some details of a user to a database for members. How do I have Paypal send a confirmation back to the database in a field that says PAID/UNPAID so that I can allow/dissallow users to log in. I already have a paypal account and web payments standard configured. I also tried to play around with IPN and PDT but I couldnt make sense of it. Any help, code samples etc would be greatly appreciated
VB.NET:
Imports System.Data
Imports System.Data.OleDb
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
MultiView1.SetActiveView(menu)
End Sub
Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click
If txtname.Text = "" Or txtsurname.Text = "" Or txtusername.Text = "" Or txtpassword.Text = "" Or txtconfpassword.Text = "" Or txtchname.Text = "" Or txtchSurname.Text = "" Or txtchDOB.Text = "" Then
'all fields are mandatory
Label38.Text = "Please enter the information in ALL fields. All the fields are mandatory."
Label38.Visible = True
MultiView1.SetActiveView(registration)
Else
If txtpassword.Text = txtconfpassword.Text Then
Label38.Visible = False
savepersonal()
savecred()
MultiView1.SetActiveView(registration)
Else
'passwords do not match
Label38.Text = "Your passwords do not match please enter your password again."
Label38.Visible = True
End If
End If
End Sub
Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
MultiView1.SetActiveView(registration)
End Sub
Protected Sub ImageButton4_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton4.Click
MultiView1.SetActiveView(menu)
End Sub
Protected Sub btnReset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReset.Click
txtname.Text = ""
txtsurname.Text = ""
txtadd1.Text = ""
txtadd2.Text = ""
txttown.Text = ""
txtprovince.Text = ""
txtpostcode.Text = ""
txtcountry.Text = ""
txttel.Text = ""
txtmobile.Text = ""
txtemail.Text = ""
txtusername.Text = ""
txtpassword.Text = ""
txtconfpassword.Text = ""
txtchname.Text = ""
txtchSurname.Text = ""
txtchDOB.Text = "dd/mm/yyyy"
MultiView1.SetActiveView(registration)
End Sub
Function savepersonal() As Integer
Dim conn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim sConnString As String
Dim personalid As String
personalid = txtname.Text & txttel.Text
sConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath("db2.mdb")
'open the connection
conn.Open(sConnString)
cmd.ActiveConnection = conn
cmd.CommandText = "INSERT INTO details (name,surname,add1,add2,town,province,postcode,country,tel,mobile,email,chname,chsurname,chDOB,personalid,relationship)" & _
"VALUES " & _
"('" & txtname.Text & "'," & _
"'" & txtsurname.Text & "'," & _
"'" & txtadd1.Text & "'," & _
"'" & txtadd2.Text & "'," & _
"'" & txttown.Text & "'," & _
"'" & txtprovince.Text & "'," & _
"'" & txtpostcode.Text & "'," & _
"'" & txtcountry.Text & "'," & _
"'" & txttel.Text & "'," & _
"'" & txtmobile.Text & "'," & _
"'" & txtemail.Text & "'," & _
"'" & txtchname.Text & "'," & _
"'" & txtchSurname.Text & "'," & _
"'" & txtchDOB.Text & "'," & _
"'" & personalid & "'," & _
"'" & drpRelationship.Text & "')"
cmd.Execute()
cmd = Nothing
conn.Close()
conn = Nothing
End Function
Function savecred() As Integer
Dim conn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim sConnString As String
Dim personalid As String
personalid = txtname.Text & txttel.Text
sConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath("db2.mdb")
'open the connection
conn.Open(sConnString)
cmd.ActiveConnection = conn
cmd.CommandText = "INSERT INTO login (usern,pwd,email,personalid)" & _
"VALUES " & _
"('" & txtusername.Text & "'," & _
"'" & txtpassword.Text & "'," & _
"'" & txtemail.Text & "'," & _
"'" & personalid & "')"
cmd.Execute()
cmd = Nothing
conn.Close()
conn = Nothing
End Function
Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click
If txtFRname.Text = "" Or txtFRsname.Text = "" Or txtFRdob.Text = "" Then
Label39.Visible = True
MultiView1.SetActiveView(child)
Else
Dim connString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data source =" & Server.MapPath("db2.mdb")
Dim myConnection As OleDbConnection = New OleDbConnection
myConnection.ConnectionString = connString
' create a data adapter
Dim da As OleDbDataAdapter = New OleDbDataAdapter("SELECT name,surname,add1,add2,town,province,postcode,country,tel,mobile,email FROM details WHERE (chname LIKE '%" & txtFRname.Text & "%') AND (chsurname LIKE '%" & txtFRsname.Text & "%') AND (chDOB = '" & txtFRdob.Text & "')", myConnection)
' create a new dataset
Dim ds As DataSet = New DataSet
' fill dataset
da.Fill(ds, "details")
' Attach DataSet to DataGrid
GridView1.DataSource = ds
GridView1.DataBind()
MultiView1.SetActiveView(child)
End If
End Sub
Protected Sub ImageButton6_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton6.Click
MultiView1.SetActiveView(menu)
End Sub
Protected Sub ImageButton3_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton3.Click
MultiView1.SetActiveView(child)
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Server.Transfer("registration confirmation.htm")
End Sub
End Class