/** * 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 }
/** * Copy user details to the Shipping table after an order has been processed. * * @return int */ function copy_user() { global $Conf, $cart, $order; $ccNum = substr($order->cardnumber, strlen($order->cardnumber) - 4, 4); $fields = array("`CartID`" => "'{$this->CartID}'", "`billEmail`" => "'{$this->username}'", "`billFirstname`" => "'{$this->BILLFirstName}'", "`billLastname`" => "'{$this->BILLLastName}'", "`billCompany`" => "'{$this->BILLCompany}'", "`billAddr1`" => "'{$this->BILLAddress1}'", "`billAddr2`" => "'{$this->BILLAddress2}'", "`billCity`" => "'{$this->BILLCity}'", "`billState`" => "'{$this->BILLState}'", "`billZip`" => "'{$this->BILLZip}'", "`billCountry`" => "'{$this->BILLCountry}'", "`billPhone`" => "'{$this->BILLPhone}'", "`billAltPhone`" => "'{$this->BILLAltPhone}'", "`shipFirstname`" => "'{$this->SHIPFirstName}'", "`shipLastname`" => "'{$this->SHIPLastName}'", "`shipAddr1`" => "'{$this->SHIPAddress1}'", "`shipAddr2`" => "'{$this->SHIPAddress2}'", "`shipCity`" => "'{$this->SHIPCity}'", "`shipState`" => "'{$this->SHIPState}'", "`shipZip`" => "'{$this->SHIPZip}'", "`shipCountry`" => "'{$this->SHIPCountry}'", "`shipPhone`" => "'{$this->SHIPPhone}'", "`shipAltPhone`" => "'{$this->SHIPAltPhone}'", "`shipComments`" => "'{$this->SHIPComments}'", "`orderShipping`" => "'{$cart->Shipping}'", "`orderTax`" => "'{$order->tax}'", "`orderTotal`" => "'{$order->chargetotal}'", "`orderDate`" => "NOW()", "`promoCode`" => "'{$this->promoCode}'", "`promoDiscount`" => "'{$order->discount}'", "`referredBy`" => "''", "`paymentType`" => "'{$order->cardtype}'"); myDBC::insert_Record($Conf['data']->ShipTable, $fields); return myDBC::last_insert_id(); }