Forums

check if email already exist

dangee 29 Jun, 2009
Hey,

I need to make a sponsorship form for a online store...but for that i need to know how can I check if emails, name and surname are already in database on validation...

exemple below:
Your name :.............
Surname :...............
email :.................

You are invited by
Name :............
Surname :.........
email : ..........

In fact, the person can suscribe only if the "you are invited" part exists in database.

I don't know if i am clear...
Max_admin 30 Jun, 2009
Hi dangee,

you are clear, you need to use a db query with the server side validation, show me your db table structure and I will show you a sample code!

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
dangee 30 Jun, 2009
OK thanks...but i don't know what you mean by "db table structure" 😢 Where can I find that ? Is it jos_users ??
Max_admin 01 Jul, 2009
the table which will have the list of persons who can "invite" others

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
dangee 01 Jul, 2009
OK, so I guess it is jos_vm_user_info with fields last_name, first_name and user_email
dangee 03 Jul, 2009
Please Help me Admin Master 😀
Max_admin 04 Jul, 2009
Hi Dangee,

please show me the table structure for table jos_vm_user_info which has the full list of those who can invite others!

Cheers,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
dangee 05 Jul, 2009
see table structure in attachment. hope this is what you want...
Max_admin 06 Jul, 2009
good, this is a sample code:


<?php
global $mainframe;
$database =& JFactory::getDBO();
$query     = "SELECT * FROM `#__vm_user_info` WHERE user_email = '".$_POST['email']."'";
$database->setQuery( $query );
$result = $database->loadObject();
if(!$result)return "this user doesn't exist";


the code above needs to go into the server side validation box and the field of the invited by email should have the name "email"

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
dangee 06 Jul, 2009
This is the result on validation. Debug is set to off.

<?php
$nv_email = $_POST['{text_8}'];
// Procédure stockée dans Joomla pour communiquer avec la DB 
$db = & JFactory::getDBO();
$query = "SELECT email FROM #__users WHERE email = '$nv_email'";
$db->setQuery($query);
// Si email entré existe
$exist = $db->loadResult();
// On vérifie si les conditions sont remplies
if ( !empty($exist) ) { 
  return true;
} else {
  return false;
}
?>
dangee 06 Jul, 2009
Oops...sorry it works 😀 😀

The best would be now to verify the name as well...😶
This topic is locked and no more replies can be posted.