O'Reilly logo

Getting Started with Phalcon by Stephan Miller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Storing session data in Phalcon

First, we are going to give ourselves the ability to log in to our blog and store our user information in our session. We are going to wait to encrypt our passwords and set up permissions for our user until the next chapter. For now, we only want to be able to save a user ID when a user saves a blog post.

We made our changes to the model, but that doesn't mean everything is going to work. Browse to http://localhost/phalconBlog/posts/create and try to create a new post. You will not be able to. Instead, you will see the following error message in your browser because we just created a rule that our database requires every post to have a user ID:

Another problem is that in order to have a user ID, we need a user in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required