FreiChat related discussions
Logged in Users shown as guests - OpenCart

Hello,

I have succesfully installed freichat in my opencart platform but i can't make out the part with logged in users to pass their id to freichat

This is how my db fields look like
customer_id store_id firstname lastname

hardcode.php

$usertable='oc_customer'; //specifies the name of the table in which your user information is stored.
$row_username='firstname'; //specifies the name of the field in which the user's name/display name is stored.
$row_userid='customer_id';

How should my code look like? Please help me! I'm a beginner in programming.

Also i get an error in acces control -> moderation : Fatal error: Call to a member function fetchAll() on a non-object in /freichat/administrator/admin_files/moderate_users/drivers/base.php on line 130

Lines 128 to 133 below:

$query = "SELECT COUNT( * ) FROM " . $this->db_prefix . $this->usertable . " AS u " . $search_str;
//echo $query;
$count = $this->db->query($query)->fetchAll();
//var_dump($count);
return $count[0][0];
}


Thanks!
George

Hello, I have succesfully installed freichat in my opencart platform but i can't make out the part with logged in users to pass their id to freichat This is how my db fields look like customer_id store_id firstname lastname hardcode.php $usertable='oc_customer'; //specifies the name of the table in which your user information is stored. $row_username='firstname'; //specifies the name of the field in which the user's name/display name is stored. $row_userid='customer_id'; How should my code look like? Please help me! I'm a beginner in programming. Also i get an error in acces control -> moderation : Fatal error: Call to a member function fetchAll() on a non-object in /freichat/administrator/admin_files/moderate_users/drivers/base.php on line 130 Lines 128 to 133 below: $query = "SELECT COUNT( * ) FROM " . $this->db_prefix . $this->usertable . " AS u " . $search_str; //echo $query; $count = $this->db->query($query)->fetchAll(); //var_dump($count); return $count[0][0]; } Thanks! George

Have you completed the steps 1 and 2 given in the documentation : http://codologic.com/docs/doku.php?id=wiki:freichat:user-login-integration ?

About the error uncomment the line

//echo $query;

After the query, then try running the above query in phpmyadmin to see if you get any errors .

Have you completed the steps 1 and 2 given in the documentation : http://codologic.com/docs/doku.php?id=wiki:freichat:user-login-integration ? About the error uncomment the line ```` //echo $query; ```` After the query, then try running the above query in phpmyadmin to see if you get any errors .
Necessity is the mother of all inventions!

Solved the error. Now i can see the logged-in users in moderation tab.

Regarding the 1st and 2nd step, i'm not sure i quite get it how it has to be done.

For the 1st step do i have to search a similiar code or do i have to copy paste the given one(tried to copy paste it but gave me an error) . Below is my login.php page. Sorry for pasting all the page but i don't know exactly what section i should smile.

<?php 
class ControllerAccountLogin extends Controller {
    private $error = array();

    public function index() {
        $this->load->model('account/customer');

        // Login override for admin users
        if (!empty($this->request->get['token'])) {
            $this->customer->logout();
            $this->cart->clear();

            unset($this->session->data['wishlist']);
            unset($this->session->data['shipping_address_id']);
            unset($this->session->data['shipping_country_id']);
            unset($this->session->data['shipping_zone_id']);
            unset($this->session->data['shipping_postcode']);
            unset($this->session->data['shipping_method']);
            unset($this->session->data['shipping_methods']);
            unset($this->session->data['payment_address_id']);
            unset($this->session->data['payment_country_id']);
            unset($this->session->data['payment_zone_id']);
            unset($this->session->data['payment_method']);
            unset($this->session->data['payment_methods']);
            unset($this->session->data['comment']);
            unset($this->session->data['order_id']);
            unset($this->session->data['coupon']);
            unset($this->session->data['reward']);
            unset($this->session->data['voucher']);
            unset($this->session->data['vouchers']);

            $customer_info = $this->model_account_customer->getCustomerByToken($this->request->get['token']);

            if ($customer_info && $this->customer->login($customer_info['email'], '', true)) {
                // Default Addresses
                $this->load->model('account/address');

                $address_info = $this->model_account_address->getAddress($this->customer->getAddressId());

                if ($address_info) {
                    if ($this->config->get('config_tax_customer') == 'shipping') {
                        $this->session->data['shipping_country_id'] = $address_info['country_id'];
                        $this->session->data['shipping_zone_id'] = $address_info['zone_id'];
                        $this->session->data['shipping_postcode'] = $address_info['postcode'];    
                    }

                    if ($this->config->get('config_tax_customer') == 'payment') {
                        $this->session->data['payment_country_id'] = $address_info['country_id'];
                        $this->session->data['payment_zone_id'] = $address_info['zone_id'];
                    }
                } else {
                    unset($this->session->data['shipping_country_id']);    
                    unset($this->session->data['shipping_zone_id']);    
                    unset($this->session->data['shipping_postcode']);
                    unset($this->session->data['payment_country_id']);    
                    unset($this->session->data['payment_zone_id']);    
                }

                $this->redirect($this->url->link('account/account', '', 'SSL')); 
            }
        }        

        if ($this->customer->isLogged()) {  
            $this->redirect($this->url->link('account/account', '', 'SSL'));
        }

        $this->language->load('account/login');

        $this->document->setTitle($this->language->get('heading_title'));

        if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
            unset($this->session->data['guest']);

            // Default Shipping Address
            $this->load->model('account/address');

            $address_info = $this->model_account_address->getAddress($this->customer->getAddressId());

            if ($address_info) {
                if ($this->config->get('config_tax_customer') == 'shipping') {
                    $this->session->data['shipping_country_id'] = $address_info['country_id'];
                    $this->session->data['shipping_zone_id'] = $address_info['zone_id'];
                    $this->session->data['shipping_postcode'] = $address_info['postcode'];    
                }

                if ($this->config->get('config_tax_customer') == 'payment') {
                    $this->session->data['payment_country_id'] = $address_info['country_id'];
                    $this->session->data['payment_zone_id'] = $address_info['zone_id'];
                }
            } else {
                unset($this->session->data['shipping_country_id']);    
                unset($this->session->data['shipping_zone_id']);    
                unset($this->session->data['shipping_postcode']);
                unset($this->session->data['payment_country_id']);    
                unset($this->session->data['payment_zone_id']);    
            }

            // Added strpos check to pass McAfee PCI compliance test (http://forum.opencart.com/viewtopic.php?f=10&t=12043&p=151494#p151295)
            if (isset($this->request->post['redirect']) && (strpos($this->request->post['redirect'], $this->config->get('config_url')) !== false || strpos($this->request->post['redirect'], $this->config->get('config_ssl')) !== false)) {
                $this->redirect(str_replace('&amp;', '&', $this->request->post['redirect']));
            } else {
                $this->redirect($this->url->link('account/account', '', 'SSL')); 
            }
        }

        $this->data['breadcrumbs'] = array();

        $this->data['breadcrumbs'][] = array(
            'text'      => $this->language->get('text_home'),
            'href'      => $this->url->link('common/home'),           
            'separator' => false
        );

        $this->data['breadcrumbs'][] = array(
            'text'      => $this->language->get('text_account'),
            'href'      => $this->url->link('account/account', '', 'SSL'),
            'separator' => $this->language->get('text_separator')
        );

        $this->data['breadcrumbs'][] = array(
            'text'      => $this->language->get('text_login'),
            'href'      => $this->url->link('account/login', '', 'SSL'),          
            'separator' => $this->language->get('text_separator')
        );

        $this->data['heading_title'] = $this->language->get('heading_title');

        $this->data['text_new_customer'] = $this->language->get('text_new_customer');
        $this->data['text_register'] = $this->language->get('text_register');
        $this->data['text_register_account'] = $this->language->get('text_register_account');
        $this->data['text_returning_customer'] = $this->language->get('text_returning_customer');
        $this->data['text_i_am_returning_customer'] = $this->language->get('text_i_am_returning_customer');
        $this->data['text_forgotten'] = $this->language->get('text_forgotten');

        $this->data['entry_email'] = $this->language->get('entry_email');
        $this->data['entry_password'] = $this->language->get('entry_password');

        $this->data['button_continue'] = $this->language->get('button_continue');
        $this->data['button_login'] = $this->language->get('button_login');

        if (isset($this->error['warning'])) {
            $this->data['error_warning'] = $this->error['warning'];
        } else {
            $this->data['error_warning'] = '';
        }

        $this->data['action'] = $this->url->link('account/login', '', 'SSL');
        $this->data['register'] = $this->url->link('account/register', '', 'SSL');
        $this->data['forgotten'] = $this->url->link('account/forgotten', '', 'SSL');

        // Added strpos check to pass McAfee PCI compliance test (http://forum.opencart.com/viewtopic.php?f=10&t=12043&p=151494#p151295)
        if (isset($this->request->post['redirect']) && (strpos($this->request->post['redirect'], $this->config->get('config_url')) !== false || strpos($this->request->post['redirect'], $this->config->get('config_ssl')) !== false)) {
            $this->data['redirect'] = $this->request->post['redirect'];
        } elseif (isset($this->session->data['redirect'])) {
            $this->data['redirect'] = $this->session->data['redirect'];

            unset($this->session->data['redirect']);              
        } else {
            $this->data['redirect'] = '';
        }

        if (isset($this->session->data['success'])) {
            $this->data['success'] = $this->session->data['success'];

            unset($this->session->data['success']);
        } else {
            $this->data['success'] = '';
        }

        if (isset($this->request->post['email'])) {
            $this->data['email'] = $this->request->post['email'];
        } else {
            $this->data['email'] = '';
        }

        if (isset($this->request->post['password'])) {
            $this->data['password'] = $this->request->post['password'];
        } else {
            $this->data['password'] = '';
        }

        if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/account/login.tpl')) {
            $this->template = $this->config->get('config_template') . '/template/account/login.tpl';
        } else {
            $this->template = 'default/template/account/login.tpl';
        }

        $this->children = array(
            'common/column_left',
            'common/column_right',
            'common/content_top',
            'common/content_bottom',
            'common/footer',
            'common/header'    
        );

        $this->response->setOutput($this->render());
    }

    protected function validate() {
        if (!$this->customer->login($this->request->post['email'], $this->request->post['password'])) {
            $this->error['warning'] = $this->language->get('error_login');
        }

        $customer_info = $this->model_account_customer->getCustomerByEmail($this->request->post['email']);

        if ($customer_info && !$customer_info['approved']) {
            $this->error['warning'] = $this->language->get('error_approved');
        }

        if (!$this->error) {
            return true;
        } else {
            return false;
        }
    }
}
?>

And here is the freichat code in the index.

<?php

$ses = null; // Return null if user is not logged in 

if(isset($_SESSION['userid']))
{ 
  if($_SESSION['userid'] != null) // Here null is guest 
  { 
   $ses=$_SESSION['userid']; //LOOK, now userid will be passed to FreiChat 
  } 
}

if(!function_exists("freichatx_get_hash")){
function freichatx_get_hash($ses){

       if(is_file("/home/contarad/public_html/prostituatebucuresti.ro/freichat/hardcode.php")){

               require "/home/contarad/public_html/prostituatebucuresti.ro/freichat/hardcode.php";

               $temp_id =  $ses . $uid;

               return md5($temp_id);

       }
       else
       {
               echo "<script>alert('module freichatx says: hardcode.php file not
found!');</script>";
       }

       return 0;
}
}
?>

Thanks,
George

Solved the error. Now i can see the logged-in users in moderation tab. Regarding the 1st and 2nd step, i&#039;m not sure i quite get it how it has to be done. For the 1st step do i have to search a similiar code or do i have to copy paste the given one(tried to copy paste it but gave me an error) . Below is my login.php page. Sorry for pasting all the page but i don&#039;t know exactly what section i should :). ```` &amp;lt;?php class ControllerAccountLogin extends Controller { private $error = array(); public function index() { $this-&amp;gt;load-&amp;gt;model(&#039;account/customer&#039;); // Login override for admin users if (!empty($this-&amp;gt;request-&amp;gt;get[&#039;token&#039;])) { $this-&amp;gt;customer-&amp;gt;logout(); $this-&amp;gt;cart-&amp;gt;clear(); unset($this-&amp;gt;session-&amp;gt;data[&#039;wishlist&#039;]); unset($this-&amp;gt;session-&amp;gt;data[&#039;shipping_address_id&#039;]); unset($this-&amp;gt;session-&amp;gt;data[&#039;shipping_country_id&#039;]); unset($this-&amp;gt;session-&amp;gt;data[&#039;shipping_zone_id&#039;]); unset($this-&amp;gt;session-&amp;gt;data[&#039;shipping_postcode&#039;]); unset($this-&amp;gt;session-&amp;gt;data[&#039;shipping_method&#039;]); unset($this-&amp;gt;session-&amp;gt;data[&#039;shipping_methods&#039;]); unset($this-&amp;gt;session-&amp;gt;data[&#039;payment_address_id&#039;]); unset($this-&amp;gt;session-&amp;gt;data[&#039;payment_country_id&#039;]); unset($this-&amp;gt;session-&amp;gt;data[&#039;payment_zone_id&#039;]); unset($this-&amp;gt;session-&amp;gt;data[&#039;payment_method&#039;]); unset($this-&amp;gt;session-&amp;gt;data[&#039;payment_methods&#039;]); unset($this-&amp;gt;session-&amp;gt;data[&#039;comment&#039;]); unset($this-&amp;gt;session-&amp;gt;data[&#039;order_id&#039;]); unset($this-&amp;gt;session-&amp;gt;data[&#039;coupon&#039;]); unset($this-&amp;gt;session-&amp;gt;data[&#039;reward&#039;]); unset($this-&amp;gt;session-&amp;gt;data[&#039;voucher&#039;]); unset($this-&amp;gt;session-&amp;gt;data[&#039;vouchers&#039;]); $customer_info = $this-&amp;gt;model_account_customer-&amp;gt;getCustomerByToken($this-&amp;gt;request-&amp;gt;get[&#039;token&#039;]); if ($customer_info &amp;&amp; $this-&amp;gt;customer-&amp;gt;login($customer_info[&#039;email&#039;], &#039;&#039;, true)) { // Default Addresses $this-&amp;gt;load-&amp;gt;model(&#039;account/address&#039;); $address_info = $this-&amp;gt;model_account_address-&amp;gt;getAddress($this-&amp;gt;customer-&amp;gt;getAddressId()); if ($address_info) { if ($this-&amp;gt;config-&amp;gt;get(&#039;config_tax_customer&#039;) == &#039;shipping&#039;) { $this-&amp;gt;session-&amp;gt;data[&#039;shipping_country_id&#039;] = $address_info[&#039;country_id&#039;]; $this-&amp;gt;session-&amp;gt;data[&#039;shipping_zone_id&#039;] = $address_info[&#039;zone_id&#039;]; $this-&amp;gt;session-&amp;gt;data[&#039;shipping_postcode&#039;] = $address_info[&#039;postcode&#039;]; } if ($this-&amp;gt;config-&amp;gt;get(&#039;config_tax_customer&#039;) == &#039;payment&#039;) { $this-&amp;gt;session-&amp;gt;data[&#039;payment_country_id&#039;] = $address_info[&#039;country_id&#039;]; $this-&amp;gt;session-&amp;gt;data[&#039;payment_zone_id&#039;] = $address_info[&#039;zone_id&#039;]; } } else { unset($this-&amp;gt;session-&amp;gt;data[&#039;shipping_country_id&#039;]); unset($this-&amp;gt;session-&amp;gt;data[&#039;shipping_zone_id&#039;]); unset($this-&amp;gt;session-&amp;gt;data[&#039;shipping_postcode&#039;]); unset($this-&amp;gt;session-&amp;gt;data[&#039;payment_country_id&#039;]); unset($this-&amp;gt;session-&amp;gt;data[&#039;payment_zone_id&#039;]); } $this-&amp;gt;redirect($this-&amp;gt;url-&amp;gt;link(&#039;account/account&#039;, &#039;&#039;, &#039;SSL&#039;)); } } if ($this-&amp;gt;customer-&amp;gt;isLogged()) { $this-&amp;gt;redirect($this-&amp;gt;url-&amp;gt;link(&#039;account/account&#039;, &#039;&#039;, &#039;SSL&#039;)); } $this-&amp;gt;language-&amp;gt;load(&#039;account/login&#039;); $this-&amp;gt;document-&amp;gt;setTitle($this-&amp;gt;language-&amp;gt;get(&#039;heading_title&#039;)); if (($this-&amp;gt;request-&amp;gt;server[&#039;REQUEST_METHOD&#039;] == &#039;POST&#039;) &amp;&amp; $this-&amp;gt;validate()) { unset($this-&amp;gt;session-&amp;gt;data[&#039;guest&#039;]); // Default Shipping Address $this-&amp;gt;load-&amp;gt;model(&#039;account/address&#039;); $address_info = $this-&amp;gt;model_account_address-&amp;gt;getAddress($this-&amp;gt;customer-&amp;gt;getAddressId()); if ($address_info) { if ($this-&amp;gt;config-&amp;gt;get(&#039;config_tax_customer&#039;) == &#039;shipping&#039;) { $this-&amp;gt;session-&amp;gt;data[&#039;shipping_country_id&#039;] = $address_info[&#039;country_id&#039;]; $this-&amp;gt;session-&amp;gt;data[&#039;shipping_zone_id&#039;] = $address_info[&#039;zone_id&#039;]; $this-&amp;gt;session-&amp;gt;data[&#039;shipping_postcode&#039;] = $address_info[&#039;postcode&#039;]; } if ($this-&amp;gt;config-&amp;gt;get(&#039;config_tax_customer&#039;) == &#039;payment&#039;) { $this-&amp;gt;session-&amp;gt;data[&#039;payment_country_id&#039;] = $address_info[&#039;country_id&#039;]; $this-&amp;gt;session-&amp;gt;data[&#039;payment_zone_id&#039;] = $address_info[&#039;zone_id&#039;]; } } else { unset($this-&amp;gt;session-&amp;gt;data[&#039;shipping_country_id&#039;]); unset($this-&amp;gt;session-&amp;gt;data[&#039;shipping_zone_id&#039;]); unset($this-&amp;gt;session-&amp;gt;data[&#039;shipping_postcode&#039;]); unset($this-&amp;gt;session-&amp;gt;data[&#039;payment_country_id&#039;]); unset($this-&amp;gt;session-&amp;gt;data[&#039;payment_zone_id&#039;]); } // Added strpos check to pass McAfee PCI compliance test (http://forum.opencart.com/viewtopic.php?f=10&amp;t=12043&amp;p=151494#p151295) if (isset($this-&amp;gt;request-&amp;gt;post[&#039;redirect&#039;]) &amp;&amp; (strpos($this-&amp;gt;request-&amp;gt;post[&#039;redirect&#039;], $this-&amp;gt;config-&amp;gt;get(&#039;config_url&#039;)) !== false || strpos($this-&amp;gt;request-&amp;gt;post[&#039;redirect&#039;], $this-&amp;gt;config-&amp;gt;get(&#039;config_ssl&#039;)) !== false)) { $this-&amp;gt;redirect(str_replace(&#039;&amp;amp;&#039;, &#039;&amp;&#039;, $this-&amp;gt;request-&amp;gt;post[&#039;redirect&#039;])); } else { $this-&amp;gt;redirect($this-&amp;gt;url-&amp;gt;link(&#039;account/account&#039;, &#039;&#039;, &#039;SSL&#039;)); } } $this-&amp;gt;data[&#039;breadcrumbs&#039;] = array(); $this-&amp;gt;data[&#039;breadcrumbs&#039;][] = array( &#039;text&#039; =&amp;gt; $this-&amp;gt;language-&amp;gt;get(&#039;text_home&#039;), &#039;href&#039; =&amp;gt; $this-&amp;gt;url-&amp;gt;link(&#039;common/home&#039;), &#039;separator&#039; =&amp;gt; false ); $this-&amp;gt;data[&#039;breadcrumbs&#039;][] = array( &#039;text&#039; =&amp;gt; $this-&amp;gt;language-&amp;gt;get(&#039;text_account&#039;), &#039;href&#039; =&amp;gt; $this-&amp;gt;url-&amp;gt;link(&#039;account/account&#039;, &#039;&#039;, &#039;SSL&#039;), &#039;separator&#039; =&amp;gt; $this-&amp;gt;language-&amp;gt;get(&#039;text_separator&#039;) ); $this-&amp;gt;data[&#039;breadcrumbs&#039;][] = array( &#039;text&#039; =&amp;gt; $this-&amp;gt;language-&amp;gt;get(&#039;text_login&#039;), &#039;href&#039; =&amp;gt; $this-&amp;gt;url-&amp;gt;link(&#039;account/login&#039;, &#039;&#039;, &#039;SSL&#039;), &#039;separator&#039; =&amp;gt; $this-&amp;gt;language-&amp;gt;get(&#039;text_separator&#039;) ); $this-&amp;gt;data[&#039;heading_title&#039;] = $this-&amp;gt;language-&amp;gt;get(&#039;heading_title&#039;); $this-&amp;gt;data[&#039;text_new_customer&#039;] = $this-&amp;gt;language-&amp;gt;get(&#039;text_new_customer&#039;); $this-&amp;gt;data[&#039;text_register&#039;] = $this-&amp;gt;language-&amp;gt;get(&#039;text_register&#039;); $this-&amp;gt;data[&#039;text_register_account&#039;] = $this-&amp;gt;language-&amp;gt;get(&#039;text_register_account&#039;); $this-&amp;gt;data[&#039;text_returning_customer&#039;] = $this-&amp;gt;language-&amp;gt;get(&#039;text_returning_customer&#039;); $this-&amp;gt;data[&#039;text_i_am_returning_customer&#039;] = $this-&amp;gt;language-&amp;gt;get(&#039;text_i_am_returning_customer&#039;); $this-&amp;gt;data[&#039;text_forgotten&#039;] = $this-&amp;gt;language-&amp;gt;get(&#039;text_forgotten&#039;); $this-&amp;gt;data[&#039;entry_email&#039;] = $this-&amp;gt;language-&amp;gt;get(&#039;entry_email&#039;); $this-&amp;gt;data[&#039;entry_password&#039;] = $this-&amp;gt;language-&amp;gt;get(&#039;entry_password&#039;); $this-&amp;gt;data[&#039;button_continue&#039;] = $this-&amp;gt;language-&amp;gt;get(&#039;button_continue&#039;); $this-&amp;gt;data[&#039;button_login&#039;] = $this-&amp;gt;language-&amp;gt;get(&#039;button_login&#039;); if (isset($this-&amp;gt;error[&#039;warning&#039;])) { $this-&amp;gt;data[&#039;error_warning&#039;] = $this-&amp;gt;error[&#039;warning&#039;]; } else { $this-&amp;gt;data[&#039;error_warning&#039;] = &#039;&#039;; } $this-&amp;gt;data[&#039;action&#039;] = $this-&amp;gt;url-&amp;gt;link(&#039;account/login&#039;, &#039;&#039;, &#039;SSL&#039;); $this-&amp;gt;data[&#039;register&#039;] = $this-&amp;gt;url-&amp;gt;link(&#039;account/register&#039;, &#039;&#039;, &#039;SSL&#039;); $this-&amp;gt;data[&#039;forgotten&#039;] = $this-&amp;gt;url-&amp;gt;link(&#039;account/forgotten&#039;, &#039;&#039;, &#039;SSL&#039;); // Added strpos check to pass McAfee PCI compliance test (http://forum.opencart.com/viewtopic.php?f=10&amp;t=12043&amp;p=151494#p151295) if (isset($this-&amp;gt;request-&amp;gt;post[&#039;redirect&#039;]) &amp;&amp; (strpos($this-&amp;gt;request-&amp;gt;post[&#039;redirect&#039;], $this-&amp;gt;config-&amp;gt;get(&#039;config_url&#039;)) !== false || strpos($this-&amp;gt;request-&amp;gt;post[&#039;redirect&#039;], $this-&amp;gt;config-&amp;gt;get(&#039;config_ssl&#039;)) !== false)) { $this-&amp;gt;data[&#039;redirect&#039;] = $this-&amp;gt;request-&amp;gt;post[&#039;redirect&#039;]; } elseif (isset($this-&amp;gt;session-&amp;gt;data[&#039;redirect&#039;])) { $this-&amp;gt;data[&#039;redirect&#039;] = $this-&amp;gt;session-&amp;gt;data[&#039;redirect&#039;]; unset($this-&amp;gt;session-&amp;gt;data[&#039;redirect&#039;]); } else { $this-&amp;gt;data[&#039;redirect&#039;] = &#039;&#039;; } if (isset($this-&amp;gt;session-&amp;gt;data[&#039;success&#039;])) { $this-&amp;gt;data[&#039;success&#039;] = $this-&amp;gt;session-&amp;gt;data[&#039;success&#039;]; unset($this-&amp;gt;session-&amp;gt;data[&#039;success&#039;]); } else { $this-&amp;gt;data[&#039;success&#039;] = &#039;&#039;; } if (isset($this-&amp;gt;request-&amp;gt;post[&#039;email&#039;])) { $this-&amp;gt;data[&#039;email&#039;] = $this-&amp;gt;request-&amp;gt;post[&#039;email&#039;]; } else { $this-&amp;gt;data[&#039;email&#039;] = &#039;&#039;; } if (isset($this-&amp;gt;request-&amp;gt;post[&#039;password&#039;])) { $this-&amp;gt;data[&#039;password&#039;] = $this-&amp;gt;request-&amp;gt;post[&#039;password&#039;]; } else { $this-&amp;gt;data[&#039;password&#039;] = &#039;&#039;; } if (file_exists(DIR_TEMPLATE . $this-&amp;gt;config-&amp;gt;get(&#039;config_template&#039;) . &#039;/template/account/login.tpl&#039;)) { $this-&amp;gt;template = $this-&amp;gt;config-&amp;gt;get(&#039;config_template&#039;) . &#039;/template/account/login.tpl&#039;; } else { $this-&amp;gt;template = &#039;default/template/account/login.tpl&#039;; } $this-&amp;gt;children = array( &#039;common/column_left&#039;, &#039;common/column_right&#039;, &#039;common/content_top&#039;, &#039;common/content_bottom&#039;, &#039;common/footer&#039;, &#039;common/header&#039; ); $this-&amp;gt;response-&amp;gt;setOutput($this-&amp;gt;render()); } protected function validate() { if (!$this-&amp;gt;customer-&amp;gt;login($this-&amp;gt;request-&amp;gt;post[&#039;email&#039;], $this-&amp;gt;request-&amp;gt;post[&#039;password&#039;])) { $this-&amp;gt;error[&#039;warning&#039;] = $this-&amp;gt;language-&amp;gt;get(&#039;error_login&#039;); } $customer_info = $this-&amp;gt;model_account_customer-&amp;gt;getCustomerByEmail($this-&amp;gt;request-&amp;gt;post[&#039;email&#039;]); if ($customer_info &amp;&amp; !$customer_info[&#039;approved&#039;]) { $this-&amp;gt;error[&#039;warning&#039;] = $this-&amp;gt;language-&amp;gt;get(&#039;error_approved&#039;); } if (!$this-&amp;gt;error) { return true; } else { return false; } } } ?&amp;gt; ```` And here is the freichat code in the index. ```` &amp;lt;?php $ses = null; // Return null if user is not logged in if(isset($_SESSION[&#039;userid&#039;])) { if($_SESSION[&#039;userid&#039;] != null) // Here null is guest { $ses=$_SESSION[&#039;userid&#039;]; //LOOK, now userid will be passed to FreiChat } } if(!function_exists(&quot;freichatx_get_hash&quot;)){ function freichatx_get_hash($ses){ if(is_file(&quot;/home/contarad/public_html/prostituatebucuresti.ro/freichat/hardcode.php&quot;)){ require &quot;/home/contarad/public_html/prostituatebucuresti.ro/freichat/hardcode.php&quot;; $temp_id = $ses . $uid; return md5($temp_id); } else { echo &quot;&amp;lt;script&amp;gt;alert(&#039;module freichatx says: hardcode.php file not found!&#039;);&amp;lt;/script&amp;gt;&quot;; } return 0; } } ?&amp;gt; ```` Thanks, George

Try this:

Open backend->Additional and turn on PHP debug .

Then check the file freichat/freixlog.log for any errors .

Try this: Open backend-&amp;gt;Additional and turn on PHP debug . Then check the file freichat/freixlog.log for any errors .
Necessity is the mother of all inventions!

this is what i have:

May 16, 2014, 9:37 am: main.php loaded

May 16, 2014, 9:37 am: Inserted the user with the following data :: Username = Guest-1o4 And ID = 1400467779 Default status = I am available

May 16, 2014, 9:37 am: main.php loaded

May 16, 2014, 9:37 am: main.php loaded

May 16, 2014, 9:38 am: main.php loaded

May 16, 2014, 9:38 am: main.php loaded

May 16, 2014, 9:41 am: main.php loaded

May 16, 2014, 9:49 am: main.php loaded

May 16, 2014, 9:49 am: Inserted the user with the following data :: Username = Guest-a0cg And ID = 1400720264 Default status = I am available

May 16, 2014, 9:53 am: main.php loaded

May 16, 2014, 9:59 am: main.php loaded

May 16, 2014, 9:59 am: main.php loaded

May 16, 2014, 10:00 am: main.php loaded

May 16, 2014, 10:00 am: main.php loaded

May 16, 2014, 10:02 am: main.php loaded

May 16, 2014, 10:02 am: Inserted the user with the following data :: Username = Guest-1o4 And ID = 1400467779 Default status = I am available

May 16, 2014, 10:02 am: main.php loaded

May 16, 2014, 10:02 am: main.php loaded

May 16, 2014, 10:02 am: main.php loaded

May 16, 2014, 10:03 am: main.php loaded

this is what i have: May 16, 2014, 9:37 am: main.php loaded May 16, 2014, 9:37 am: Inserted the user with the following data :: Username = Guest-1o4 And ID = 1400467779 Default status = I am available May 16, 2014, 9:37 am: main.php loaded May 16, 2014, 9:37 am: main.php loaded May 16, 2014, 9:38 am: main.php loaded May 16, 2014, 9:38 am: main.php loaded May 16, 2014, 9:41 am: main.php loaded May 16, 2014, 9:49 am: main.php loaded May 16, 2014, 9:49 am: Inserted the user with the following data :: Username = Guest-a0cg And ID = 1400720264 Default status = I am available May 16, 2014, 9:53 am: main.php loaded May 16, 2014, 9:59 am: main.php loaded May 16, 2014, 9:59 am: main.php loaded May 16, 2014, 10:00 am: main.php loaded May 16, 2014, 10:00 am: main.php loaded May 16, 2014, 10:02 am: main.php loaded May 16, 2014, 10:02 am: Inserted the user with the following data :: Username = Guest-1o4 And ID = 1400467779 Default status = I am available May 16, 2014, 10:02 am: main.php loaded May 16, 2014, 10:02 am: main.php loaded May 16, 2014, 10:02 am: main.php loaded May 16, 2014, 10:03 am: main.php loaded

Looks like freichat is treating users as guests .

Does $_SESSION['userid']; contain the userid of the current user ?

Try dumping the variable after the line :

$ses = null;

and see if it actually contains the userid .

Looks like freichat is treating users as guests . Does ````$_SESSION[&#039;userid&#039;];```` contain the userid of the current user ? Try dumping the variable after the line : ```` $ses = null; ```` and see if it actually contains the userid .
Necessity is the mother of all inventions!

How exactly do i do this?
Sorry for asking, but i am really newbie in programming, i just know some html and css smile

Thanks a lot for your time!
George

How exactly do i do this? Sorry for asking, but i am really newbie in programming, i just know some html and css :) Thanks a lot for your time! George

Make changes in your copy paste code so that it looks like below:

<?php

$ses = null; // Return null if user is not logged in 

if(isset($_SESSION['userid']))
{ 
  if($_SESSION['userid'] != null) // Here null is guest 
  { 
   $ses=$_SESSION['userid']; //LOOK, now userid will be passed to FreiChat 
  } 
}  

echo "The userid of the current user id: " . $_SESSION['userid'];  
..... and the rest of the code follows

Then reload your website and see if you get the userid correctly .

Make changes in your copy paste code so that it looks like below: ```` &amp;lt;?php $ses = null; // Return null if user is not logged in if(isset($_SESSION[&#039;userid&#039;])) { if($_SESSION[&#039;userid&#039;] != null) // Here null is guest { $ses=$_SESSION[&#039;userid&#039;]; //LOOK, now userid will be passed to FreiChat } } echo &quot;The userid of the current user id: &quot; . $_SESSION[&#039;userid&#039;]; ..... and the rest of the code follows ```` ___ Then reload your website and see if you get the userid correctly .
Necessity is the mother of all inventions!

Hello,

I made changes in the code and it doesn't echo the $_SESSION['userid']; - all i can see in the header is just the text. but stragely i can see the users in moderation. Where did i make a mistake? smile

Thanks,
George

Hello, I made changes in the code and it doesn&#039;t echo the $_SESSION[&#039;userid&#039;]; - all i can see in the header is just the text. but stragely i can see the users in moderation. Where did i make a mistake? :) Thanks, George

Somehow i made an accidental breakthrough. Here is the code:

$ses = $customer_id = $this->customer->getId();

if(isset($_SESSION['$customer_id']))
{ 
  if($_SESSION['$customer_id'] != null) // Here null is guest 
  { 
   $ses=$_SESSION['$customer_id']; //LOOK, now userid will be passed to FreiChat 
  } 
}

I see now it shows me the logged in users when i am logged out. Can you help me please with correcting the code above?

Thanks,
George

Somehow i made an accidental breakthrough. Here is the code: ```` $ses = $customer_id = $this-&amp;gt;customer-&amp;gt;getId(); if(isset($_SESSION[&#039;$customer_id&#039;])) { if($_SESSION[&#039;$customer_id&#039;] != null) // Here null is guest { $ses=$_SESSION[&#039;$customer_id&#039;]; //LOOK, now userid will be passed to FreiChat } } ```` I see now it shows me the logged in users when i am logged out. Can you help me please with correcting the code above? Thanks, George

I do not know how does your authentication system work , so i guess it should be this way:

$customer_id = $this->customer->getId();
$ses = null;  

if($customer_id)
{ 

   $ses = $customer_id; //LOOK, now userid will be passed to FreiChat  
}

I assumed that the $customer_id variable is 0 (i.e false) when the user is a guest .

I do not know how does your authentication system work , so i guess it should be this way: ```` $customer_id = $this-&amp;gt;customer-&amp;gt;getId(); $ses = null; if($customer_id) { $ses = $customer_id; //LOOK, now userid will be passed to FreiChat } ```` I assumed that the `$customer_id` variable is 0 (i.e false) when the user is a guest .
Necessity is the mother of all inventions!
2.58k
10
0
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft