Customizing SMF > SMF Coding Discussion

Check if email exists?

(1/2) > >>

MrLeN:
I would like an existing form that I have on my website to check the SMF database to see if an email exists.

Something like:


--- Code: ---#connect to database (how?)
$email = user@mysite.com
if (exists($email)) {
  #error message, can't continue
}

--- End code ---

Can anyone help me fill in the blanks?

The purpose is that if someone is already registered on my forums with an email, I don't want them to be able to fill out the particular form (with that email).

edit: My forum is 2.0.2

CapadY:
This is an default function from SMF forums.

You can never register twice with the same email address.
Just try it yourself :)

MrLeN:
What I am requesting is for an existing form (not for SMF registration). I am aware that you cannot join with an existing email (which is why I want to check the SMF database for that email). The form I am working on is a separate form from SMF. I don't want the people to people able to submit the form (which is on a completely different part of the website) if they are registered on the forum. I hope that clears things up.

Kays:
H, if you include SSI.php then you can use the profileValidateEmail() function. Profile-Modify.php will need to be included also.

http://support.simplemachines.org/function_db/index.php?action=view_function;id=820

MrLeN:

--- Quote from: Kays on August 13, 2012, 07:39:26 AM ---H, if you include SSI.php then you can use the profileValidateEmail() function. Profile-Modify.php will need to be included also.

http://support.simplemachines.org/function_db/index.php?action=view_function;id=820

--- End quote ---


That would require the user to be logged in to the forum. My form just needs to know if the email is in the smf database (whether they're logged in or not).

Navigation

[0] Message Index

[#] Next page

Go to full version