<?php if (!isset($seo_tag_id) || empty($seo_tag_id)) { exit; } include_once 'includes/session_ajax.php'; #/ Check Caller if (!isset($_SERVER['HTTP_REFERER'])) { exit; } $allowed = array('localhost', 'www.collaborateusa.com', 'collaborateusa.com', 'new.collaborateusa.com', 'cusa-local'); if (!in_array($_SERVER['SERVER_NAME'], $allowed)) { exit; } #/ Check User $user_id = (int) @$_SESSION["CUSA_Main_usr_id"]; if ($user_id <= 0) { exit; } $_POST = format_str($_POST); $_GET = format_str($_GET); $action_id = (int) @$_GET['ai']; if ($action_id <= 0) { exit; } ///////////////////////////////////////////////////////////////////////// include_once '../includes/patronage_points_func.php'; #/Give Points $pgiven = generate_ppoints($user_id, $action_id); //var_dump($pgiven); die();
public function create_voice() { // get var in post $title = rtrim(ltrim($this->input->post('voc_title', true))); $desc = $this->input->post('voc_desc', true); $tags = $this->input->post('voc_tags', true); $cat_id = $this->input->post('voc_cat', true); // check title is not empty if (!empty($title)) { // check voice is valid if ($this->is_valid_voice_cat($cat_id)) { // decode to array $tags = @json_decode($tags); // check tags is array if (is_array($tags)) { $tags_id = json_encode($this->_filter_tags($tags)); // upload file and return data where error or success $upload_image = $this->_upload_voice_image(); if ($upload_image["status"] == true) { $user_id = $this->get_logged_uid(); // check valid user if ($user_id) { $image_data = $upload_image["upload_data"]; // set inserting data $voice_data = array("user_id" => $user_id, "voice_cat_id" => $cat_id, "voice_tag_ids" => $tags_id, "question_text" => $title, "voice_details" => $desc, "voice_pic" => $image_data->file_name, "added_on" => c_now()); // insert voice to voice table $this->db->insert('user_voices', $voice_data); // generate patronage points generate_ppoints($user_id, 'create_voice'); // voice successfully created $this->_set_message(self::SUCCESS, "Your voice successfully created."); } else { // invalid user login $this->_set_message(self::ERROR, "You are not valid user."); } } else { $this->_set_message(self::ERROR, $upload_image["error"]); } } else { $this->_set_message(self::ERROR, "Voice Tags invalid format."); } } else { $this->_set_message(self::ERROR, "Voice Category invalid."); } } else { $this->_set_message(self::ERROR, "Voice Title can't be blank."); } redirect(base_url() . $this->_config["my_voices_url"]); }
public function vote_cast($uid = 0, $vid = 0, $vval = "") { $result = array("status" => false, "message" => "", "data" => array()); // check valid user $user = $this->is_valid_user($uid); if ($user) { // check valid voice if ($this->is_valid_voice($vid)) { // check vote value if ($this->is_valid_vote_value($vval)) { $sql = "SELECT * FROM voices_votes WHERE user_id=? AND voice_id=?"; $rsl = $this->db->query($sql, array($uid, $vid)); // check already vote casted if ($rsl->num_rows() < 1) { $data = array("voice_id" => $vid, "user_id" => $uid, "vote_value" => $vval, "voted_on" => c_now()); if ($this->db->insert("voices_votes", $data)) { $voice = $this->get_single_voice($vid); $result["message"] = "Vote successfully cast."; $result["status"] = true; $result["data"]["vote"] = $this->get_last_vote(); $result["data"]["voice"] = $voice["data"]; // generate patronage points if ($vval == 'i_see') { generate_ppoints($uid, 'vote_yes'); } else { if ($vval == 'i_dont_see') { generate_ppoints($uid, 'vote_no'); } } } else { $result["message"] = "vote insertion failed."; } } else { $result["message"] = "Already vote casted."; } } else { $result["message"] = "Invalid vote value."; } } else { $result["message"] = "{$vid} id can't exists in voices"; } } else { $result["message"] = "Invalid user login."; } return $result; }
$pp_act = 'visit_privacy_policy'; break; //Privacy Policy //Privacy Policy case '2': $pp_act = 'visit_info_statement'; break; //Information Statement //Information Statement case '4': $pp_act = 'visit_tos'; break; //Terms of Use } if (!empty($pp_act)) { generate_ppoints($user_id, $pp_act); } } #- ///////////////////////////////////////////////////////////////////// ##/Special Process for PDF Content if (isset($page_info['pdf_content']) && @strlen($page_info['pdf_content']) > 10) { //$pdf = DOC_ROOT.'assets/media/docs/'.$page_info['pdf_content']; $pdf = 'assets/media/docs/' . $page_info['pdf_content']; header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); header("Expires: Sat, 26 Jul 2007 05:00:00 GMT"); header('Accept-Ranges: bytes'); header('Content-Length: ' . filesize($pdf)); header('Content-Encoding: none'); header('Content-Type: application/pdf');
function save_user_payment($user_id, $user_POST, $save_arr, $attempted_on) { global $seo_tag, $consts; #/ Save user_payments $sql_1 = "INSERT INTO user_payments (user_id, invoice, amount, transaction_id, gateway_name, gateway_payer_id, gateway_msg, payment_status, paid_on)\n values ('{$user_id}', '', '{$save_arr['amount']}', '{$save_arr['transaction_id']}', '{$save_arr['gateway_name']}', '{$save_arr['gateway_payer_id']}', '{$save_arr['gateway_msg']}', '{$save_arr['payment_status']}', '{$attempted_on}')"; @mysql_exec($sql_1, 'save'); $user_payment_id = (int) @mysql_insert_id(); if ($user_payment_id > 0) { #/ Setup & Save Invoice ID $invoice_str = str_pad($user_payment_id, 4, "0", STR_PAD_LEFT); $user_id_str = str_pad($user_id, 3, "0", STR_PAD_LEFT); $invoice_id = 'CUSA-' . $user_id_str . '-' . $invoice_str; $sql_3 = "UPDATE user_payments SET invoice='{$invoice_id}' WHERE id='{$user_payment_id}'"; @mysql_exec($sql_3, 'save'); #/ Send Payment Email to User $subject = "[{$invoice_id}] Payment Receipt from collaborateUSA.com"; $heading = "Payment Receipt & Invoice from collaborateUSA.com"; $body_in = payment_receipt($invoice_id, $save_arr, $user_POST); send_mail($user_POST['email_add'], $subject, $heading, $body_in, 'collaborateUSA.com', $consts['mem_support_em']); #/ Send Payment Email to Admin $subject = "[{$invoice_id}] Payment Received at collaborateUSA.com"; $heading = "Payment Invoice from collaborateUSA.com"; $body_in = payment_invoice($invoice_id, $save_arr, $user_POST); send_mail($consts['mem_support_em'], $subject, $heading, $body_in); #/ Generate ThankYou Notification include_once '../includes/notif_func.php'; $notif_data = array('template_id' => "7", 'user_id' => "{$user_id}", 'from_user_id' => "0", 'objects' => "{$invoice_id}", 'object_id' => '0', 'object_location' => ''); @generate_notification($notif_data); #/ Allocate & Assign Patronage Points include_once '../includes/patronage_points_func.php'; @generate_ppoints($user_id, 'join_share'); #/ Clear Sessions unset($_SESSION['pay_chk']); unset($_SESSION['reshash']); unset($_SESSION['signup_cart']); unset($_SESSION['payer_id']); unset($_SESSION['Payment_Amount']); #/ Lock & Redirect $_SESSION['signup_success'] = '1'; $_SESSION['signup_stage'] = 'signup-details'; reset_attempt_counts(); //redirect_me('signup-details'); //ajax based not possible to redirect return true; } }