/**
  * Add a new user to the database. This user is just able to give referrals.
  *
  * @return int
  */
 function new_invite()
 {
     global $Conf, $User;
     // referralData is Full Name, Phone, and Email stored in an array.
     $fields = array("`UserID`" => "'{$User->ID}'", "`Email`" => "'{$this->Email}'", "`message`" => "'{$this->Message}'", "`dateAdded`" => "NOW()");
     myDBC::insert_Record($Conf['data']->Invites, $fields);
 }
 /**
  * Add a new user to the database. This user is just able to give referrals.
  *
  * @return int
  */
 function new_Note($id)
 {
     global $Conf, $User;
     $this->dateAdded = date('Y-m-d H:i:s');
     $fields = array("`ReferralID`" => "'{$id}'", "`UserID`" => "'{$User->ID}'", "`notes`" => "'{$this->Notes}'", "`dateAdded`" => "'{$this->dateAdded}'");
     // dispute_level | 1= admin, 2= referrer, 3= customer
     return myDBC::insert_Record($Conf['data']->ReferralNotes, $fields);
 }
 function process_transactions($uid, $vid)
 {
     global $Conf, $referral;
     // transaction data will enter the funds into the creators account and the Passing Green admin.
     $fields = array("`user_id`" => "'{$uid}'", "`referral_id`" => "'{$referral->ID}'", "`amount`" => "'{$referral->Commission}'", "`created`" => "NOW()");
     myDBC::insert_Record($Conf['data']->Transactions, $fields);
     $fields = array("`user_id`" => "2809", "`referral_id`" => "'{$referral->ID}'", "`amount`" => "'{$referral->Commission}'", "`created`" => "NOW()");
     myDBC::insert_Record($Conf['data']->Transactions, $fields);
     $fields = array("`user_id`" => "'{$vid}'", "`referral_id`" => "'{$referral->ID}'", "`amount`" => "'{$referral->Fee}'", '`is_billable`' => "'1'", "`created`" => "NOW()");
     myDBC::insert_Record($Conf['data']->Transactions, $fields);
 }
 /**
  * Add a new comment to the Comments table in the database.
  *
  * @return int
  */
 function add_Comments()
 {
     global $Conf;
     //		$birthday = $this->Birthday['Y'].'-'.$this->Birthday['F'].'-01';
     //		$anniversary = $this->Anniversary['Y'].'-'.$this->Anniversary['F'].'-01';
     if ($this->State < '253') {
         $country = '13';
     } else {
         $country = '92';
     }
     $fields = array("`useremail`" => "'{$this->Email}'", "`userFirstname`" => "'{$this->Firstname}'", "`userLastname`" => "'{$this->Lastname}'", "`userAddr1`" => "'{$this->Address1}'", "`userCity`" => "'{$this->City}'", "`userState`" => "'{$this->State}'", "`userCountry`" => "'{$country}'", "`userZip`" => "'{$this->ZIP}'", "`userPhone`" => "'{$this->PhoneNumber}'", "`brochure`" => "'{$this->Brochure}'", "`news`" => "'{$this->News}'", "`hearaboutus`" => "'{$this->HearAboutUs2}'", "`vehicle`" => "'{$this->Vehicle}'", "`comments`" => "'{$this->Comments}'", "`date_added`" => "NOW()", "`last_ip`" => "'{$this->Ip}'");
     return myDBC::insert_Record($Conf["data"]->Comments, $fields);
 }
 /**
  * Add a new user to the database. This user is just able to give and receive referrals.
  *
  * @return int
  */
 function add_member()
 {
     global $Conf, $order, $User;
     // Process and store payment information
     $privateKey = genPrivateKey();
     //Generate a private key - This will made into a static value after generating it once
     $data = array('status' => $this->ccStatus, 'details' => $this->ccDetails, 'error' => $this->ccError, 'tcode' => $this->ccTCode, 'name' => $order->name, 'ccType' => $order->cardtype, 'ccNum' => $order->cardnumber, 'MM' => $order->cardexpmonth, 'YY' => $order->cardexpyear, 'ccCODE' => $order->cvmvalue);
     $data = encrypt(serialize($data), $privateKey);
     //Catches the ciphertext from the encrypt function
     // Convert the string value users enter and update it to and numeric string, autoid
     $state = $User->get_province_by_name(strtoupper($order->state));
     $fields = array("`userFirstname`" => "'{$this->Firstname}'", "`userLastname`" => "'{$this->Lastname}'", "`useremail`" => "'{$this->Email}'", "`passwd`" => "'{$this->password}'", "`shipAddr1`" => "'{$order->address1}'", "`shipCity`" => "'{$order->city}'", "`shipState`" => "'{$state->autoid}'", "`shipZip`" => "'{$order->zip}'", "`cc`" => "'{$data}'", "`level`" => "'member'", "`is_enabled`" => "'yes'", "`date_added`" => "NOW()", "`paymentType`" => "'Credit Card'");
     myDBC::insert_Record($Conf['data']->UserTable, $fields);
     $ID = myDBC::last_insert_id();
     capture_cc($ID, '', $privateKey);
     // Create private key
 }
 /**
  * Save Information about user to database.
  *
  * @return unknown
  */
 public function saveUserInformation()
 {
     global $Conf;
     $user_id = $this->ID;
     $r = mysqli_result;
     $tA = $Conf["data"]->UserTable;
     myDBC::new_andWhere();
     myDBC::andWhere("{$tA}.AutoID = '{$user_id}'");
     $fields = array("`useremail`" => "'{$this->username}'", "`userfirstname`" => "'{$this->Firstname}'", "`userlastname`" => "'{$this->Lastname}'", "`phone_number`" => "'{$this->PhoneNumber}'");
     // Are we entering a new crypt for a plaintext password?
     if ($this->isCryptedPW == false) {
         $fields["`password`"] = "'" . sha1($this->password) . "'";
     }
     // Check to see if the record exists.
     // If it does, simply update otherwise insert new.
     $q = "SELECT * FROM {$tA} " . myDBC::get_andWhere() . " LIMIT 1";
     myDBC::stdQuery($q, $r);
     if ($r->num_rows == 1) {
         myDBC::update_Record($tA, $fields, myDBC::get_andWhere(), " LIMIT 1");
     } else {
         myDBC::insert_Record($tA, $fields);
     }
     return true;
 }
 /**
  * Add Order entry into the Orders table (for future tracking).
  *
  * @param int $id
  * @param int $order_id
  * @param float $saleprice
  * @return int
  */
 function add_db_item($id, $saleprice = 0.0)
 {
     global $Conf;
     # Verify sale price.
     if ($saleprice == 0.0 || empty($saleprice)) {
         $saleprice = $this->items[$id]->quantity * $this->items[$id]->price;
     }
     $fields = array("`UID`" => $this->UID > 0 ? "'{$this->UID}'" : "NULL", "`CartID`" => "'{$this->CartID}'", "`Price`" => "'{$this->items[$id]->price}'", "`PriceSold`" => "'{$saleprice}'", "`DateTime`" => "NOW()", "`IP`" => "'{$this->IP}'", "`Quantity`" => "'{$this->items[$id]->quantity}'", "`ProductID`" => "'{$id}'");
     return myDBC::insert_Record($Conf["data"]->OrdersTable, $fields);
 }