Mirage Source

Free ORPG making software.
It is currently Thu Mar 28, 2024 11:39 am

All times are UTC




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Tutorial - Finished
PostPosted: Tue Jun 05, 2007 11:59 am 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
Decided to make something simple instead since there wont be many anticipants in this contest.

Difficulty: 1/5
Introduction: In case you added email on account creation, this will check if its correct or not. It will check if there is a "@" and a ".", since all emails has those. You can always tweak it to check for .com, .net etc..

In the Create Account Button, add this:
Code:
Dim i As Byte, a As Byte
a = 0
    For i = 1 To Len(Text1.Text)
        If Mid(Text1.Text, i, 1) <> "@" Then
            a = a + 1
            If a = Len(Text1.Text) Then
                MsgBox ("Enter a correct email address!")
                Exit Sub
            End If
        End If
    Next i

a = 0
    For i = 1 To Len(Text1.Text)
        If Mid(Text1.Text, i, 1) <> "." Then
            a = a + 1
            If a = Len(Text1.Text) Then
                MsgBox ("Enter a correct email address!")
                Exit Sub
            End If
        End If
    Next i

I know its pretty simple, but I wanted it for my game cause it makes it look more professional :)

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
 Post subject: Re: Tutorial - Finished
PostPosted: Mon Jul 16, 2007 6:45 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
Yeah, very simple. But always something.

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
 Post subject: Re: Tutorial - Finished
PostPosted: Mon Jul 16, 2007 6:47 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
Or you could add email verification...

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject: Re: Tutorial - Finished
PostPosted: Mon Jul 16, 2007 6:49 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
Robin wrote:
Or you could add email verification...

How do you do that to a mirage game? If you make that tut I'll probably give you 10bucks cause theres no way you'll manage it.
SPOILER: (click to show)
Wont pay you but hey :P

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
 Post subject: Re: Tutorial - Finished
PostPosted: Mon Jul 16, 2007 7:06 pm 
Offline
Knowledgeable
User avatar

Joined: Mon May 29, 2006 6:23 pm
Posts: 128
Better way to do this would be to check for a period AFTER the @, otherwise "glacier86.99@bellsouth" would return true.

Rough idea:
Code:
Dim i As Byte, a As Byte, c As Byte
   For i = 1 To Len(Text1.Text)
      If Mid(Text1.Text, i, 1) = "@" Then
      'Adding 2 will prevent email@.com
      a = a + 2      
         For c = a To Len(Text1.Text)
                 If Mid(Text1.Text, c, 1) = "." Then
                        Return True
            End If
         Next c
      ' Didn't find the period, return false.
      Return False
      End If
   Next i

Used the PHP "return false," but you get the idea.


Top
 Profile  
 
 Post subject: Re: Tutorial - Finished
PostPosted: Mon Jul 16, 2007 7:10 pm 
Offline
Pro
User avatar

Joined: Mon May 29, 2006 3:26 pm
Posts: 493
Location: São Paulo, Brasil
Google Talk: blackagesbr@gmail.com
I have it on my game. It's all made in PHP. You go to the website, type de name of the account and your e-mail. Then PHP automaticly send's him his password of their account(randomized at run-time), so there is no way they can pass thru it. Actualy, the randomized password is made at the server, here in my house. I have a little program that manages this account creation stuff since all my game is running over the MySQL and this way I can manage this better. There is also a rank system running in Apache here in computer too. Every thing is off since I'm slow with the develop of my game atm, colege is just soo time consuming...
The system it self is very easy and I think I'll post that next year, I realy like things to be tested and I wont post that now...

_________________
http://www.blackages.com.br
Image
Dave wrote:
GameBoy wrote:
www.FreeMoney.com
I admit I clicked. I immediately closed upon realizing there was, in fact, no free money.
Robin wrote:
I love you and your computer.Marry me.


Top
 Profile  
 
 Post subject: Re: Tutorial - Finished
PostPosted: Mon Jul 16, 2007 7:12 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
William wrote:
Robin wrote:
Or you could add email verification...

How do you do that to a mirage game? If you make that tut I'll probably give you 10bucks cause theres no way you'll manage it.
SPOILER: (click to show)
Wont pay you but hey :P


Have VB open up outlook or something, send the email to the address. They click the link, this triggers a php file which saves a byte to the account data.

Voila.

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject: Re: Tutorial - Finished
PostPosted: Mon Jul 16, 2007 7:26 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
Cruzns idea is the best of yours, althouh you will have to loop through a to y.. You guys just makes the smallest thing take time.. xD

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
 Post subject: Re: Tutorial - Finished
PostPosted: Thu Aug 02, 2007 8:02 pm 
Offline
Newbie

Joined: Mon May 29, 2006 2:18 pm
Posts: 22
Location: Florida
Sorry, slightly old topic, but heres my verification code that works a bit better:

Code:
Public Function ValidateEmail(ByRef sEmail As String) As Boolean

Dim bValid            As Boolean   ' Is email valid?
Dim bFlag             As Boolean   ' Multipurpose boolean value
Dim vntEmail          As Variant   ' Splitted Email
Dim vntDomain         As Variant   ' Splitted Domain
Dim vntValidDomainExt As Variant   ' Valid domain extensions
Dim lCount            As Long      ' Loop variable
Dim lChars            As Long      ' Second loop variable

    ' Validates a email of form "a.bc_123@server.ext"
    ' Insert valid domain extensions in variable
    vntValidDomainExt = Array("no", "com", "edu", "gov", "int", "mil", "net", "org", "info", "biz", "pro", "name", "coop", "museum", _
                              "aero", "af", "al", "dz", "as", "ad", "ao", "ai", "aq", "ag", "ar", "am", "aw", "ac", "au", "at", "az", _
                              "bs", "bh", "bd", "bb", "By", "be", "bz", "bj", "bm", "bt", "bo", "ba", "bw", "bv", "br", "io", "bn", _
                              "bg", "bf", "bi", "kh", "cm", "ca", "cv", "ky", "cf", "td", "cs", "cl", "cn", "cx", "cc", "co", "km", _
                              "cg", "ck", "cr", "ci", "hr", "cu", "cy", "cz", "dk", "dj", "dm", "do", "tp", "ec", "eg", "sv", "gq", _
                              "er", "ee", "et", "fk", "fo", "fj", "fi", "fr", "gf", "pf", "tf", "ga", "gm", "ge", "de", "gh", "gi", _
                              "gr", "gl", "gd", "gp", "gu", "gt", "gg", "gn", "gw", "gy", "ht", "hm", "va", "hn", "hk", "hu", "is", _
                              "In", "id", "ir", "iq", "ie", "im", "il", "it", "jm", "jp", "je", "jo", "kz", "ke", "ki", "kp", "kr", _
                              "kw", "kg", "la", "lv", "lb", "ls", "lr", "ly", "li", "lt", "lu", "mo", "mk", "mg", "mw", "my", "mv", _
                              "ml", "mt", "mh", "mq", "mr", "mu", "yt", "mx", "fm", "md", "mc", "mn", "ms", "ma", "mz", "mm", "na", _
                              "nr", "np", "nl", "an", "nc", "nz", "ni", "ne", "ng", "nu", "nf", "mp", "no", "om", "pk", "pw", "ps", _
                              "pa", "pg", "py", "pe", "ph", "pn", "pl", "pt", "pr", "qa", "re", "ro", "ru", "rw", "kn", "lc", "vc", _
                              "ws", "sm", "st", "sa", "sn", "sc", "sl", "sg", "sk", "si", "sb", "so", "za", "gs", "es", "lk", "sh", _
                              "pm", "sd", "sr", "sj", "sz", "se", "ch", "sy", "tw", "tj", "tz", "th", "tg", "tk", "to", "tt", "tn", _
                              "tr", "tm", "tc", "tv", "ug", "ua", "ae", "gb", "uk", "us", "um", "uy", "su", "uz", "vu", "ve", "vn", _
                              "vg", "vi", "wf", "eh", "ye", "yu", "cd", "zm", "zr", "zw")

    ' Emails are normally composed of only lower-case characters
    ' so lower-case the email and since the parameter is ByRef, the
    ' email will be lower-cased back there.
    sEmail = LCase$(sEmail)
    ' If sEmail contains "@"
    If InStr(sEmail, "@") Then
        ' Split email on "@"
        vntEmail = Split(sEmail, "@")
        ' Asuure only 1 "@"
        If UBound(vntEmail) = 1 Then
            ' Starts with alphanumeric character
            If Left$(vntEmail(0), 1) Like "[a-z]" Or Left$(vntEmail(0), 1) Like "[0-9]" Then
                bFlag = True
                ' Assure all other characters are alphanumeric or "." or "_"
                For lCount = 2 To Len(vntEmail(0))
                    If Not (Mid$(vntEmail(0), lCount, 1) Like "[a-z]" Or Mid$(vntEmail(0), lCount, 1) Like "[0-9]" Or Mid$(vntEmail(0), lCount, 1) = "." Or Mid$(vntEmail(0), lCount, 1) Like "_") Then
                        bFlag = False
                    End If
                Next lCount
                If bFlag Then
                    ' If domain part contains "."
                    If InStr(vntEmail(1), ".") Then
                        ' Split domains on "."
                        vntDomain = Split(vntEmail(1), ".")
                        bFlag = True
                        ' Assure all domains characters are alphanumeric and domain length is over 1 (>= 2)
                        For lCount = LBound(vntDomain) To UBound(vntDomain)
                            If Len(vntDomain(lCount)) < 2 Then
                                bFlag = False
                            End If
                            For lChars = 1 To Len(vntDomain(lCount))
                                If Not (Mid$(vntDomain(lCount), lChars, 1) Like "[a-z]" Or Mid$(vntDomain(lCount), lChars, 1) Like "[0-9]") Then
                                    bFlag = False
                                End If
                                If Not bFlag Then
                                    Exit For
                                End If
                            Next lChars
                            If Not bFlag Then
                                Exit For
                            End If
                        Next lCount
                        If bFlag Then
                            bFlag = False
                            ' Check if email domain extension is valid
                            For lCount = LBound(vntValidDomainExt) To UBound(vntValidDomainExt)
                                If vntDomain(UBound(vntDomain)) = vntValidDomainExt(lCount) Then
                                    bFlag = True
                                    Exit For
                                End If
                            Next lCount
                            If bFlag Then
                                ' If email has passed through all this, it's valid
                                bValid = True
                            End If
                        End If
                    End If
                End If
            End If
        End If
    End If
    ValidateEmail = bValid

End Function


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group