-WE DO NOT CURRENTLY HAVE A WAY TO CHECK TO SEE WHETHER THE INVITE IS A DUPLICATE FOR THE GIVEN USER - PROB SHOULD IMPLEMENT THIS IN USER CLASS FILE FOR InviteReceive FUNCTION -OR WE CAN ADD A FIELD TO THE POOL MEMBERSHIP TABLE FOR "INVITE ACCEPTED" - FIELD STARTS AS 0 WHEN INVITE IS SENT, THEN WE MAKE THIS FIELD 1 ONLY WHEN USER ACCEPTS THE INVITE */ if ($_POST['invite'] == 1) { //if this file is being run thru the invite ajax function: $invitee_array = $_POST['invitees_array']; //get array of invitee emails $pool_id = $_POST['pool_id']; //get pool ID that we are inviting people for $inviter = $_POST['inviter']; //get email/username of inviter include_once 'inc/class.users.inc.php'; $user = new SiteUser(); foreach ($invitee_array as $invitee_index => $invitee_email) { //foreach invitee email... $invite_receive_result = $user->InviteReceive($invitee_email, $pool_id, $inviter); //add pool id to user's "Pool Invites" field in DB echo $invite_receive_result; } exit; } else { //if this file is being accessed by user navigation and not thru ajax: if (!isset($current_user)) { /*We send the user back to home page if $current_user is not set This would indicate that the user is trying to access invite_people.php by itself and not via the pool.php page */ header("Location: home.php"); } else { $inviter = $current_user; //get the inviter's email address/username (this is so that the invitee knows who is inviting them) $user_id = $user->GetUserIDFromEmail($inviter);