Email at Registration [i will pay]
#8

I used the HTTP() function with POST data and a .php file on my website:

pawn Code:
format(string, sizeof(string), "passkey=some_secret_password_that_nobody_can_guess_that_isnt_your_bank_account_password&email=%s&name=%s&key=%s", inputtext, pName[playerid], randkey);
HTTP(0, HTTP_POST , "www.mywebsitesite.com/email_verification.php", string, "MyHttpResponse");
The 'passkey' is just so nobody can go to the file in their web browser and send fake e-mails to players. It should be strange and secure, like 'a3re97bas54AG' or something. Not guessable.

Obviously you need to format the string with the relevant data, and this is the .php file:

PHP Code:
<?php
if($_POST['passkey'] != 'some_secret_password_that_nobody_can_guess_that_isnt_your_bank_account_password') die();
$name $_POST['name'];
$key $_POST['key'];
$email $_POST['email'];
$string "Hello, $name.<br/><br/>This e-mail was sent to this address as it was provided during registration of an account on the SA:MP server '*****'.<br/>If you do not have a ***** account, please reply to support@*****.net.<br/><br/>If this is your account, please join the server and enter the following code when prompted:<br/><br/><b>$key</b><br/><br/>You will then be able to register.<br/><br/>The ***** Support Team";
$strHeaders "MIME-Version: 1.0\r\n";
$strHeaders .= "Content-type: text/html; charset=iso-8859-1\r\n";
$strHeaders .= "From: support@*****.net";
mail($email'*****- E-mail Verification' $string$strHeaders);
?>
And I stored the 'randkey' in mySQL.

I used this to generate random keys:

pawn Code:
new randchar[][] = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};

new randkey[10];
format(randkey, sizeof(randkey), "%s%s%s%s-%i%i%i%i", randchar[random(sizeof(randchar))], randchar[random(sizeof(randchar))], randchar[random(sizeof(randchar))], randchar[random(sizeof(randchar))], random(10), random(10), random(10), random(10));
Granted there will be better, more efficient ways of doing this.
Reply


Messages In This Thread
Email at Registration [i will pay] - by CaTaLinU - 27.01.2012, 10:52
Re: Email at Registration [i will pay] - by milanosie - 27.01.2012, 10:59
Re: Email at Registration [i will pay] - by milanosie - 27.01.2012, 11:09
Re: Email at Registration [i will pay] - by CaTaLinU - 27.01.2012, 11:42
Re: Email at Registration [i will pay] - by MP2 - 27.01.2012, 11:44
Re: Email at Registration [i will pay] - by milanosie - 27.01.2012, 11:48
Re: Email at Registration [i will pay] - by CaTaLinU - 27.01.2012, 11:56
Re: Email at Registration [i will pay] - by MP2 - 27.01.2012, 11:57
Re: Email at Registration [i will pay] - by milanosie - 27.01.2012, 11:58
Re: Email at Registration [i will pay] - by CaTaLinU - 27.01.2012, 12:10
Re: Email at Registration [i will pay] - by Abreezy - 27.01.2012, 12:19
Re: Email at Registration [i will pay] - by henry jiggy - 27.01.2012, 12:38
Re: Email at Registration [i will pay] - by Десерт - 02.02.2012, 12:19

Forum Jump:


Users browsing this thread: 4 Guest(s)