function itemsupdate($userid, $ordercode)
 {
     $query = 'UPDATE #__ticketmaster_orders' . ' SET userid = ' . (int) $userid . ' WHERE ordercode =  ' . $ordercode . ' ';
     ## Do the query now
     $this->_db->setQuery($query);
     ## When query goes wrong.. Show message with error.
     if (!$this->_db->query()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     $db = JFactory::getDBO();
     ## Check if waiting list is turned on:
     $sql = "SELECT show_waitinglist \n\t\t\t\t\tFROM #__ticketmaster_config \n\t\t\t\t\tWHERE configid = 1";
     $db->setQuery($sql);
     $config = $db->loadObject();
     if ($config->show_waitinglist == 1) {
         $query = 'UPDATE #__ticketmaster_waitinglist' . ' SET userid = ' . (int) $userid . ' WHERE ordercode =  ' . $ordercode . ' ';
         ## Do the query now
         $this->_db->setQuery($query);
         ## When query goes wrong.. Show message with error.
         if (!$this->_db->query()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         $path_include = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_ticketmaster' . DS . 'classes' . DS . 'confirmation.php';
         include_once $path_include;
         $sendconfirmation = new confirmation((int) $ordercode);
         $sendconfirmation->SendWaitingList();
     }
     return true;
 }
 function itemsupdate($userid, $ordercode)
 {
     $query = 'UPDATE #__ticketmaster_orders' . ' SET userid = ' . (int) $userid . ' WHERE ordercode =  ' . $ordercode . ' ';
     ## Do the query now
     $this->_db->setQuery($query);
     ## When query goes wrong.. Show message with error.
     if (!$this->_db->query()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     ## TRIGGER INVOICING PLUGIN AND RELATED onAfterCheckout
     JPluginHelper::importPlugin('rdmediahelpers');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('OnAfterCheckout', array($vars));
     $db = JFactory::getDBO();
     ## Check if waiting list is turned on:
     $sql = "SELECT show_waitinglist\n\t\t\t\t\tFROM #__ticketmaster_config\n\t\t\t\t\tWHERE configid = 1";
     $db->setQuery($sql);
     $config = $db->loadObject();
     if ($config->show_waitinglist == 1) {
         $query = 'UPDATE #__ticketmaster_waitinglist' . ' SET userid = ' . (int) $userid . ' WHERE ordercode =  ' . $ordercode . ' ';
         ## Do the query now
         $this->_db->setQuery($query);
         ## When query goes wrong.. Show message with error.
         if (!$this->_db->query()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         $path_include = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_ticketmaster' . DS . 'classes' . DS . 'confirmation.php';
         include_once $path_include;
         $sendconfirmation = new confirmation((int) $ordercode);
         $sendconfirmation->SendWaitingList();
     }
     return true;
 }
 function _updateClient($eid, $id)
 {
     $mainframe = JFactory::getApplication();
     ## Include the confirmation class to sent the tickets.
     $path = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_ticketmaster' . DS . 'classes' . DS . 'confirmation.php';
     $override = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_ticketmaster' . DS . 'classes' . DS . 'override' . DS . 'confirmation.php';
     ## Check if the override is there.
     if (file_exists($override)) {
         ## Yes, now we use it.
         require_once $override;
     } else {
         ## No, use the standard
         require_once $path;
     }
     if (isset($eid)) {
         $sendconfirmation = new confirmation((int) $eid);
         $sendconfirmation->doConfirm();
         $sendconfirmation->doSend();
     }
     $mainframe->redirect('index.php', JText::_('COM_TICKETMASTER_CONFIRM_OK'));
 }
 function _doConfirm($eid)
 {
     ## Include the confirmation class to sent the tickets.
     $path = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_ticketmaster' . DS . 'classes' . DS . 'confirmation.php';
     $override = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_ticketmaster' . DS . 'classes' . DS . 'override' . DS . 'confirmation.php';
     ## Check if the override is there.
     if (file_exists($override)) {
         ## Yes, now we use it.
         require_once $override;
     } else {
         ## No, use the standard
         require_once $path;
     }
     if (isset($eid)) {
         $sendconfirmation = new confirmation((int) $eid);
         $sendconfirmation->doConfirm();
         $sendconfirmation->doSend();
     }
 }
    {
        if (isset($_GET["code"])) {
            $this->code = $_GET["code"];
            $this->check_code();
        } else {
            header("location: ../index.php");
        }
    }
    private function check_code()
    {
        $select_confirmation_from_db = $this->conn->prepare("select confirmation_code from registered_users where confirmation_code = :code");
        $select_confirmation_from_db->execute(array('code' => $this->code));
        $result = $select_confirmation_from_db->fetch(PDO::FETCH_ASSOC);
        if ($result) {
            $confirm_account = $this->conn->prepare("update registered_users set is_confirmed = 1 where confirmation_code = :code");
            $confirm_account->execute(array('code' => $this->code));
            //Deleting confirmation code so if user visits the same page again, or tried to visit with same confirmation code, throw error because code's been deleted once used.
            $delete_confirmation_code = $this->conn->prepare("update registered_users set confirmation_code = '' where confirmation_code = :code");
            $delete_confirmation_code->execute(array('code' => $this->code));
            session_start();
            $_SESSION["acc_con"] = "acc_con";
            header("location: account_confirmed.php");
        }
        if (!$result) {
            header("location: ../index.php");
        }
    }
}
include "../connection_to_db.php";
$confirm = new confirmation($conn);
$confirm->set_code($_GET);
 function validate()
 {
     $mainframe = JFactory::getApplication();
     ## Getting the POST variables.
     $post = JRequest::get('post');
     if ($this->ordercode == 0) {
         $msg = JText::_('COM_TICKETMASTER_NO_VALID_ID');
         $mainframe->redirect('index.php?option=com_ticketmaster', $msg);
     }
     if ($this->id == 0) {
         $msg = JText::_('COM_TICKETMASTER_NO_VALID_ID');
         $mainframe->redirect('index.php?option=com_ticketmaster', $msg);
     }
     ## GETTING THE MODEL TO SAVE
     $model = $this->getModel('validate');
     ## OK, all tickets have been added to the database session.<br />
     ## We need to update the table for total-tickets.
     $path_include = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_ticketmaster' . DS . 'classes' . DS . 'confirmation.php';
     include_once $path_include;
     if (isset($this->ordercode)) {
         $sendconfirmation = new confirmation((int) $this->ordercode);
         $sendconfirmation->doConfirm();
         $sendconfirmation->doSend();
     }
     if (!$model->update($this->ordercode, $this->id)) {
         $msg = JText::_('COM_TICKETMASTER_VALIDATION_FAILED');
         $mainframe->redirect('index.php?option=com_ticketmaster', $msg);
     }
     $msg = JText::_('COM_TICKETMASTER_VALIDATED');
     $mainframe->redirect('index.php?option=com_ticketmaster', $msg);
 }
    function getConfig()
    {
        if (empty($this->_data)) {
            $db = JFactory::getDBO();
            ## Making the query for showing all the cars in list function
            $sql = 'SELECT * FROM #__ticketmaster_config WHERE configid = 1';
            $db->setQuery($sql);
            $data = $db->loadObject();
            if ($data->show_waitinglist == 1) {
                ## Check if waiting list is turned on:
                $sql = 'SELECT COUNT(id) AS total 
						FROM #__ticketmaster_waitinglist 
						WHERE sent = 0
						AND ordercode = ' . (int) $this->ordercode . '';
                $db->setQuery($sql);
                $waiters = $db->loadObject();
                if ($waiters->total != 0) {
                    $path_include = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_ticketmaster' . DS . 'classes' . DS . 'confirmation.php';
                    include_once $path_include;
                    $sendconfirmation = new confirmation((int) $this->ordercode);
                    $sendconfirmation->SendWaitingList();
                }
            }
        }
        return $data;
    }