The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End if stament help Reply To: if stament help


Hi I tried that but for some reason when user is logged in still shows log in form. It should show session print_r and also a thumbnail.

    echo '<div class="row">';
    echo '<div class="col-lg-4 pull-right">';
    echo '<div class="panel panel-default module">';
    echo '<div class="hot-link"><h3 class="panel-title main-title">User Login Control</h3>', '</div>';
    echo '<div class="panel-body">';

    if(isset($_SESSION['is_logged_in']) && $_SESSION['is_logged_in'] == 1){

        echo '<div class="col-md-4">';
        echo '<a href="#" class="thumbnail"><img data-src="holder.js/100%x180" alt="...">';
        echo '</a>';
        echo '<br>';
        echo '<a href="logout" class="btn btn-primary" role="button">Log Out';
        echo '</a>';
        echo '</div>';

        echo '<div class="col-md-8">';
        echo '<pre>';
        print_r ($this->session->all_userdata());
        echo '</pre>';
        echo '</div>';

    } else {

        // Form Open
        $data = array(
        'name' => 'login',
        'id' => 'login',
        'role' =>   'form',
        'class' => 'spacer-padding-lg',

        echo form_open('users/success', $data); 

        // User Email
        echo '<div class="form-group">';
        $data = array(
            'name' => 'email',
            'id' => 'email',
            'placeholder'       => 'Email',
            'class'       => 'form-control',
        echo form_input($data);
        echo '</div>';
        echo form_error('email', '<div class="error">', '</div>');

        // User Password
        echo '<div class="form-group">';
        $data = array(
            'name' => 'password',
            'id' => 'password',
            'placeholder' => 'Password',
            'class' => 'form-control',
        echo form_password($data);
        echo '</div>';
        echo form_error('password', '<div class="error">', '</div>'); 

        // Remember Me
        $data = array(
            'name' => 'users',
            'id' => 'users',
            'value' => 'accept',
            'checked' => TRUE,

        echo '<div class="form-group">';
        echo form_checkbox($data);
        echo ' <label>Remember Me</label>';
        echo '</div>';

        // Submit Forum Button
        $data = array(
            'id' => 'submit',
            'name' => 'submit',
            'class' => 'btn btn-primary',
            'value' =>  'Sign In',
        echo form_submit($data);

        // Form Close
        echo form_close();


    echo '</div>';
    echo '</div>';
    echo '</div>';
    echo '</div>';