Mirage Source
Email Required On Account Creation. - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Source Code Development (https://mirage-engine.uk/forums/forumdisplay.php?fid=51)
+----- Forum: Mirage Source 4 (Visual Basic 6) (https://mirage-engine.uk/forums/forumdisplay.php?fid=44)
+------ Forum: Tutorials (https://mirage-engine.uk/forums/forumdisplay.php?fid=13)
+------ Thread: Email Required On Account Creation. (/showthread.php?tid=2799)



Email Required On Account Creation. - Jack - 14-05-2009

Having a email verafaction is good just in case people loose there passwords, and also good for warnings and ban reasons instead of the msgbox.

---------
Basicly easy to copy and paste 2/5
Understanding 3/5

///CLIENT SIDE///


Make your SendNewAccount Look like this.

Code:
Sub SendNewAccount(ByVal Name As String, ByVal Password As String, ByVal Email As String)
Dim Packet As String

    Packet = "newaccount" & SEP_CHAR & Trim(Name) & SEP_CHAR & Trim(Password) & SEP_CHAR & Trim(Email) & SEP_CHAR & END_CHAR
    Call SendData(Packet)
End Sub

Add these into ModConstants

Now add:
Code:
Public Const MENU_STATE_EMAIL = 9

Right now add:
Code:
Public Const EMAIL_LENGTH = 50

Now Find Private SUb Pic_Connect in frmNewaccount and add:

Code:
If Trim(txtName.Text)  "" And Trim(txtPassword.Text)  "" And Trim(txtEmail.Text)  "" Then

Now find Public Sub MenuState(ByVal State As Long) and go to Call SendNewaccount and add:

Code:
frmNewAccount.txtEmail.Text


Now on form frmNewAccount add these:
A text Box with the name of txtEmail and set the caption to nothing(THE NAME OF THE TEXT BOX MATTERS)
Put a label and call it labelemail and set the caption to Email (Doesn't matter on the name of the label)

Ok thats all for Client Side..

///Server Side///

Make your AddAccount look like this:

Code:
Sub AddAccount(ByVal index As Long, ByVal Name As String, ByVal Password As String,ByVal Email As String)
Dim i As Long

    Player(index).Login = Name
    Player(index).Password = Password
    Player(index).Email = Email
    
    For i = 1 To MAX_CHARS
        Call ClearChar(index, i)
    Next i
    
    Call SavePlayer(index)
End Sub

Add Under AccountRec:

Code:
Type EmailRec
    Email As String * EMAIL_LENGTH
End Type

And Now in AccountRec add to the bottom of it:
Code:
Email as string

Now go to ModConstants and add the 2 following constants:

Code:
Public Const EMAIL_LENGTH = 50
Code:
Public Const MAX_EMAIL = 15

Under HandleData add :
Code:
Dim Email As String

Add Under New account Packet

Code:
Email = Parse(3)

And just below that add next to
Code:
Or Len(Trim(Password)) < 3

Code:
Or Len(Trim(Email)) < 15

now find If Not AccountExist(Name) Then change the line Call AddAccount(index, Name, Password) to look like this:

Code:
Call AddAccount(index, Name, Password, Email)

Now find
Code:
Call PutVar(FileName, "GENERAL", "Password", Trim(Player(index).Password))

and add under it.

Code:
Call PutVar(FileName, "GENERAL", "Email", Trim(Player(index).Email))

I think thats about it msn me if there is any problems


Re: Email Required On Account Creation. - Labmonkey - 14-05-2009

How would you add a "forgot password" button.


Re: Email Required On Account Creation. - Jack - 14-05-2009

add a button then setup either email to ask and have a auto responce with the account name and email in the email, or have it so there are 2 text boxes that have email and account name and then when you click ok it will send you a email. I could try code this if you want me to.


Re: Email Required On Account Creation. - Tony - 14-05-2009

Hmm would be better if it was email verification. It's a bit useless at the moment but it's a good start.


Re: Email Required On Account Creation. - Labmonkey - 15-05-2009

How do you send email from vb was my real question.


Re: Email Required On Account Creation. - Nean - 15-05-2009

Perhaps this can help: http://www.devarticles.com/c/a/Visual-B ... ual-Basic/


Re: Email Required On Account Creation. - GIAKEN - 15-05-2009

http://www.freevbcode.com/ShowCode.Asp?ID=109


Re: Email Required On Account Creation. - Jack - 15-05-2009

Right im going to work on forgot password button all this weekend, hopefully it wont take that long. Tutorial will be made as soon as i finish.