#1

So, I made an email function on registeration system, what I was thinking is, what should I do to make a link on which clicking it verifies the user. Got any idea? Just like the verification email we get on registering anything.
Reply
#2

For making it send the email, I have no idea. Yet, make it register a link that sends them to a PHP page that sets the MySQL Verified Table to 1,
Reply
#3

Hm.. I think you gave me an idea. Brb.
EDIT: Nvm, I still need help
Reply
#4

Bump
Reply
#5

Make PHP script that will send actual email and call it with samp's HTTP function.
Please note, im not sure if that function supports https protocol so keep that in mind.
Reply
#6

So your problem is you can't send an email or cannot set the verification code?
Reply
#7

Design a database table first EmailTokens for example, that can be something like this.
UserID(int), Token(String/Varchar), Created_At(Date).

Also, create a player value for whether or not the email is verified: EmailVerified(Boolean).

When a user inserts their email address, generate a random token and insert it into the EmailTokens table.
So that, if userID 32 adds email myemail@provider.gg the table gets a new entry that would look like this.
[32, myemail@provider.gg, 1499352423] <-- unix timestamp.
Make all three of them combined to be the primary key for that table.
At the same time, when a user enters the e-mail address, you'd be making a HTTP request to a php file on your web-server to handle sending the e-mail with the token/link to that particular user. HTTP information.

When the user clicks the address with the token, the web server handles to set the verified e-mail player variable in the database to true, marking the user as verified. Make sure you settup a database user for the website that only has access to that particular action and none other so that if your web-server gets hi-jacked, the db user won't be able to do much in the samp server itself.

Created_At is included in case you want to place a time limit on the lifetime of the token.

Good luck.

Edit: Forgot to mention that when the user clicks on the link from the e-mail address, your php code would need to query the EmailTokens table and crosscheck the given token with the matched one from that table (if it's valid). If there's a match, you can check wether or not it's expired using the Created_At datetime/timestamp and also find that particual user that the token is refeering to using the userID.
Reply
#8

Quote:
Originally Posted by StaticYey
Посмотреть сообщение
Design a database table first EmailTokens for example, that can be something like this.
UserID(int), Token(String/Varchar), Created_At(Date).

Also, create a player value for whether or not the email is verified: EmailVerified(Boolean).

When a user inserts their email address, generate a random token and insert it into the EmailTokens table.
So that, if userID 32 adds email myemail@provider.gg the table gets a new entry that would look like this.
[32, myemail@provider.gg, 1499352423] <-- unix timestamp.
Make all three of them combined to be the primary key for that table.
At the same time, when a user enters the e-mail address, you'd be making a HTTP request to a php file on your web-server to handle sending the e-mail with the token/link to that particular user. HTTP information.

When the user clicks the address with the token, the web server handles to set the verified e-mail player variable in the database to true, marking the user as verified. Make sure you settup a database user for the website that only has access to that particular action and none other so that if your web-server gets hi-jacked, the db user won't be able to do much in the samp server itself.

Created_At is included in case you want to place a time limit on the lifetime of the token.

Good luck.

Edit: Forgot to mention that when the user clicks on the link from the e-mail address, your php code would need to query the EmailTokens table and crosscheck the given token with the matched one from that table (if it's valid). If there's a match, you can check wether or not it's expired using the Created_At datetime/timestamp and also find that particual user that the token is refeering to using the userID.
Thanks, that was what I was looking for, to generate a link for verification, like a token. Repped.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)