/    Sign up×
Community /Pin to ProfileBookmark

how to implement sending/receiving email for activating account on a website???

Hi everybody,
I have just studied php for one month, so my knowledge of PHP is limited (sorry for my English ability). I hope someone who can help me solve my problem:

I am designing a web site, I allow users to register on my web site. When they register successfully, web site will send them an activation email. But I don’t know how to do it. (I use: PHP, APACHE, now I also don’t know that I should use which mail server that is good for php??)

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@flannAug 23.2007 — The logic that I would use is:

In your users table, create a field called isValid tinyint not null default 0

Get the users information

Validate the user info

Insert into database

Get the ID associated with the user you just inserted (mysql_insert_id())

Encode the user ID using MD5() and put into a variable.

Compose your welcome email how ever you want it. In this email create a link to a page to handle the validating of the user and append the encoded ID in a get. .php?id=$md5var

Create the page to handle the validation of the user and get and sanitize the get variable.

update the isValid field to 1 where MD5(userID) = '$md5var'

Whenever you do a select, make sure you only select valid users.
Copy linkTweet thisAlerts:
@nickDeeSHauthorAug 24.2007 — Thanks for your helping. Your writting makes me easy to understand. Thanks alot. Can u show me how to use md5 in php?
Copy linkTweet thisAlerts:
@ripeAug 24.2007 — [code=php]<?php
$tocrypt = $_GET['id'];
if (!isset($tocrypt)){ echo 'no userid filled in link';}
//for above you say if mysql_num_rows(query where md5 userid=md5 $tocrypt) == 0 error msg ;
else { echo 'your crypted ID = '.md5($tocrypt); }
echo '<br />';
echo 'to test just use: http://pathtothis/file.php?id=ripe.ie';
?>[/code]

Hope it helps
Copy linkTweet thisAlerts:
@flannAug 24.2007 — Thanks for your helping. Your writting makes me easy to understand. Thanks alot. Can u show me how to use md5 in php?[/QUOTE]

md5 is a function that excepts a string and returns an encrypted version of that string. It is a trap door function, which means that you can't reverse it. When you're learning php, one of the best things you can do is to visit http://www.php.net and search there function list. There are thousands, if not more, functions built into php and knowing what is available will expand your abilities.

[code=php]
$var = "sometext";
$enc = md5($var);
// now $enc has an encrypted version of $var.
[/code]


The md5 function is available in mysql as well and it use is the same.
Copy linkTweet thisAlerts:
@nickDeeSHauthorAug 26.2007 — Yours helping is very useful for me. Thanks.
×

Success!

Help @nickDeeSH spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...