Esempio n. 1
0
 function register_l($username, $pass1, $pass2, $email, $fname, $lname, $about, $photo, $city, $country, $hide_Amount, $loan_comment, $tnc, $user_guess, &$id, $card_code, $frnds_emails, $frnds_msg, $loan_app_notify, $loan_repayment_credited, $subscribe_newsletter, $referral_code, $lwebsite, $member_type)
 {
     global $session, $database, $form, $mailer, $validation;
     traceCalls(__METHOD__, __LINE__);
     $validation->validateLenderReg($username, $pass1, $pass2, $fname, $lname, $email, $frnds_emails, $city, $country, $tnc, $user_guess, $card_code, $referral_code, $member_type);
     if ($form->num_errors > 0) {
         return 1;
         //Errors with form
     } else {
         $photon = 'exist';
         if (!$photo || strlen($photo) < 1) {
             $photon = "none";
         }
         if (!$lwebsite || strlen($lwebsite) < 1) {
             $lwebsite = "";
         }
         if (!$lname || strlen($lname) < 1) {
             $lname = '';
         }
         if (!$fname || strlen($fname) < 1) {
             $fname = '';
         }
         if ($member_type == 5) {
             $sub_user_type = LENDER_GROUP_LEVEL;
         } else {
             if ($member_type == 2) {
                 $sub_user_type = LENDER_INDIVIDUAL_LEVEL;
             }
         }
         $retVal = $database->addLender($username, $pass1, $email, $fname, $lname, $about, $photon, $city, $country, $hide_Amount, $loan_comment, $tnc, $loan_app_notify, $loan_repayment_credited, $subscribe_newsletter, $lwebsite, $sub_user_type);
         $id = $database->getUserId($username);
         if ($referral_code || strlen($referral_code) > 1) {
             $amount = $database->getReferralCodeamount($referral_code);
             $txn_id = $database->setTransaction($id, $amount, 'Referral Code Redemption', 0, 0, REFERRAL_CODE, 1);
             $cookval = md5(time());
             $refretVal = $database->addReferralCode($referral_code, $id, $cookval, $txn_id);
             setcookie("xmtpysp", $cookval, time() + 60 * 60 * 24 * 100, COOKIE_PATH, '', COOKIE_SECURE, true);
         }
         if (!empty($id)) {
             $this->sendWelcomeMailToLender($email);
             /* these 4 lines added by chetan for redeem gift card in new lender registration */
             if (strlen($card_code = trim($card_code)) > 0) {
                 $res = $this->redeemCard($card_code, $id);
                 $_SESSION['giftRedeemResult'] = $res;
                 $_SESSION['giftRedeemError'] = $form->error('cardRedeemError');
             }
             if ($subscribe_newsletter == 1) {
                 // We are probably going to stop sending the monthly newsletter
                 // $this->subscribeLender($email, $fname, $lname);
             }
             logger('lender registerd id ' . $id);
             $lender = $database->getLenderDetails($id);
             $database->addEvent(NEW_LENDER_INTRO_EVENT, array($email), date("Y-m-d H:i:s", strtotime("+ 1 day")));
             if (isset($_SESSION['lender_invite_visit'])) {
                 $invite = "true";
                 $lender_invite = $this->processLenderInvite($lender, $_SESSION['lender_invite_visit']);
                 if ($lender_invite) {
                     $friend = $database->getLenderDetails($lender_invite['lender_id']);
                     $_SESSION['lender_invite_modal'] = $friend;
                 }
                 unset($_SESSION['lender_invite_visit']);
             } else {
                 $invite = "false";
             }
             $distinct_id = Mixpanel::getDistinctId();
             $isUserId = $database->isUserId($distinct_id);
             if (!$isUserId) {
                 Mixpanel::alias($id);
             }
             Mixpanel::identify($id);
             Mixpanel::track('Signed up', array('username' => $lender['username'], 'userlevel' => $this->userlevel_to_string($lender['userlevel']), 'email' => $email, 'lender invite credit' => $invite));
         }
         return $retVal;
     }
 }
Esempio n. 2
0
<?php

require_once "/path/to/vendor/mixpanel/mixpanel-php/lib/Mixpanel.php";
// import the Mixpanel class
$mp = new Mixpanel("MIXPANEL_PROJECT_TOKEN", array("debug" => true));
// this would likely come from a database or session variable
$user_id = 12345;
// associate user 12345 to all subsequent track calls
$mp->identify($user_id);
// send property "color" = "red" with all subsequent track calls
$mp->register("color", "red");
// send property "number" = 1 with all subsequent track calls, don't overwrite an existing value
$mp->registerOnce("number", 1);
$mp->registerOnce("number", 2);
// this will do nothing
// send all of these properties with all subsequent track calls, overwriting previously set values
$mp->registerAll(array("color" => "green", "prop2" => "val2"));
// color is now green instead of red
// send all of these properties with all subsequent track calls, NOT overwriting previously set values
$mp->registerAllOnce(array("color" => "blue", "prop3" => "val3"));
// color is still green but prop3 is now set to val3
// track a custom "button click" event
$mp->track("button click", array("label" => "Login"));
// track a custom "logged in" event
$mp->track("logged in", array("landing page" => "/specials"));
// create/update a profile identified by id 12345 with $first_name set to John and $email set to john.doe@example.com
// now we can send them Notifications!
$mp->people->set($user_id, array('$first_name' => "John", '$email' => "*****@*****.**"));
// update John's profile with property ad_source to be "google" but don't override ad_source if it exists already
$mp->people->setOnce($user_id, array("ad_source" => "google"));
// increment John's total logins by one
Esempio n. 3
0
 function loginUser($username)
 {
     global $database, $form, $lang;
     $userinfo = $database->getUserInfo($username);
     if (!$userinfo) {
         return false;
     }
     $active = $database->confirmLenderActive($userinfo['userid']);
     if ($userinfo['userlevel'] != BORROWER_LEVEL) {
         if (!$userinfo['emailVerified']) {
             $form->setError("username", $lang['error']['not_verified_email']);
         }
     }
     /* Don't allow inactive lenders to login */
     if ($userinfo['userlevel'] == LENDER_LEVEL && !$active) {
         $form->setError("username", $lang['error']['inactive_account']);
     }
     if ($form->num_errors > 0) {
         return false;
     }
     /* Register session variables */
     $this->userinfo = $userinfo;
     $this->username = $_SESSION['username'] = $this->userinfo['username'];
     $this->fullname = $this->userinfo['name'];
     $this->userid = $_SESSION['userid'] = $this->userinfo['userid'];
     $this->userlevel = $this->userinfo['userlevel'];
     $this->usersublevel = $_SESSION['sublevel'] = $this->userinfo['sublevel'];
     $language = $userinfo['lang'];
     if ($language != 'en') {
         $_SESSION['language'] = $language;
     }
     /* Insert userid into database and update active users table */
     if ($this->usersublevel != READ_ONLY_LEVEL) {
         $database->setLoginTime($this->userid, $this->time);
     }
     /**** Integration with shift science on date 24-12-2013******/
     $this->getLoginSiftData('login_event', $this->userid);
     Mixpanel::identify($this->userid, array('username' => $this->username, 'userlevel' => $this->userlevel_to_string($this->userlevel), 'name' => $userinfo['name'], 'email' => $userinfo['email']));
     Mixpanel::track('Logged in');
     return $userinfo;
 }