Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7816039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:43:25+00:00 2026-06-02T05:43:25+00:00

I’m trying to make my first login without just downloading a file and implementing

  • 0

I’m trying to make my first login without just downloading a file and implementing it in my site.

So I made a member model (model_member) and a controller (account). In the view file im checking if the user is logged in and if they’ve made a character or not and to display different things based on the results of that.

But its saying I am logged in even though im not. Or my session is messing up and when i close the browser its staying logged in. (haha)

Here is my code:

Model:

 class model_member extends CI_Model {
    public function save ($data) {
        $this->db->insert('member', $data);

        $this->session->set_userdata('email', $data['email']);
        $this->session->set_userdata('password', $data['password']);
    }

    public function isLoggedIn () {
        if ($this->session->userdata('email')) {
            return true;
        } else if ($this->session->userdata('email')) {
            return false;
        }
    }
}

Controller:

 public function register () {
        //Load model
        $this->load->model('model_member');

        //If post send pass and email to model
        if ($this->input->post()) {
            $data['email'] = $this->input->post('email');
            $data['password'] = md5($this->input->post('password'));
            $this->model_member->save($data);
        }

        //Set title
        $data['title'] = 'Register';

        //Load view
        $this->template->write_view('content', 'account/register', $data);
        $this->template->render();
    }

And just for the sake of it, my view: (using a codeigniter template)

 <div id ="game-home">
<div id="intro">
    <? if ($loggedIn == true && $charMade == false) { ?>
        <a href="#">Make a Character</a>
    <? } else if ($loggedIn == False && $charMade == false) { ?>
        <a href="#">Make an Account</a>
    <? } else if ($loggedIn == true && $charMade == true) { ?>
        Game Coming Soon!
    <? } ?>
</div>

It’s saying make a character not matter what. I’ve looked over it for a while and im hoping it isnt just something stupid. Thanks in advance for the help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T05:43:26+00:00Added an answer on June 2, 2026 at 5:43 am

    Answer ———-

    “Have you tried this in another browser? Just to make sure, that is not a session problem. Btw, for testing purpose you should use this: $this->session->sess_destroy(); somewhere. If the CodeIgniter’s own session uses cookie to store session data, it can cause your problem even after a browser restart.” – Gergely Bacso

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
i want to parse a xhtml file and display in UITableView. what is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.