/** * Add a new user to the database. This user is just able to give and receive referrals. * * @return int */ function update_member() { global $Conf, $order, $User; // Process and store payment information $privateKey = decrypt_data($this->ID, true); // Return the stored encrypted key if (!$privateKey) { // No key exists create a new one. $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)); $tA = $Conf["data"]->UserTable; myDBC::new_andWhere(); myDBC::andWhere("{$tA}.AutoID = '{$this->ID}'"); $fields = array("`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'"); capture_cc($this->ID, '', $privateKey); myDBC::update_Record($tA, $fields, myDBC::get_andWhere(), " LIMIT 1"); }
/** * Get information about a Country. * * @param int $country_id * @return object */ function get_country_by_id($country_id) { global $Conf, $dbconn; myDBC::new_andWhere(); myDBC::andWhere("`AutoID` = {$country_id}"); $q = "SELECT * FROM " . $Conf["data"]->CountryTable . myDBC::get_andWhere() . " LIMIT 1"; $r = mysqli_query($dbconn, $q); $row = mysqli_fetch_object($r); return $row; }
/** * Retrieve all information about a specific item. * * @param int $model_id * @return array */ public function user_comments($id) { global $Conf, $dbconn; myDBC::new_andWhere(); myDBC::andWhere("`AutoID` = '{$id}';"); $tA = $Conf["data"]->UserTable; $q = "SELECT userfirstname, userlastname, comments FROM {$tA}" . myDBC::get_andWhere(); $r = mysqli_query($dbconn, $q); while ($row = mysqli_fetch_object($r)) { $rows[] = $row; } return $rows; }
/** * Get the order's discount amount. * * @param int $CartID * @return float */ static function get_OrderDiscount($CartID) { global $Conf; myDBC::new_andWhere(); myDBC::andWhere("`CartID` = {$CartID}"); $query = "SELECT `promoDiscount` FROM {$Conf["data"]->ShipTable} " . myDBC::get_andWhere() . " LIMIT 1"; myDBC::stdQuery($query, $result); $row = mysqli_fetch_object($result); return $row->promoDiscount; }