Jump to:

23007 Posts in 11866 Topics by 2828 members

General Questions

SilverStripe Forums » General Questions » $_SESSION ??

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1249 Views
  • DB_steve
    Avatar
    Community Member
    7 Posts

    $_SESSION ?? Link to this post

    I have developed an all PHP site frontend with much SQL
    operations. One of the needs is to link from the PHP system
    to the SS portion as the SS design is really great for handling the
    CMS part.

    I can not figure out how to send the session data to the SS system.
    I am using this method from the frontend

    $_SESSION['session_var'] = "Testing123";

    and

    <form action='sessionTest2.php' method='POST'>

    I have the frontend linking well to the SS portion.
    But I want to lock down the SS portion so the user has to come thru
    the frontend. I figure I can lock it down if I pass the session info to the SS start page,
    but how to accomplish this task?

    Thanks so very much.
    Steve

  • UncleCheese
    Avatar
    4085 Posts

    Re: $_SESSION ?? Link to this post

    Sessions are handled by Session::get() and Session::set(), AFAIK.

    If you're trying to keep your form secure, however, you want to use the permission class.

       if(!Permission::check('ADMIN')) {
                Security::permissionFailure($this,
                   "You must be logged in to use this form."
                );
       }

  • DB_steve
    Avatar
    Community Member
    7 Posts

    Re: $_SESSION ?? Link to this post

    thanks for the reply.

    All well and good, except, I really need an example of how to do this.

    Where does one place the code to accomplish the transfer of $_SESSION data?

    Do you have a complete example I can study and test?

    Once I see the mechanism, I will better understand the process.

    Thanks again
    Steve

  • david_nash
    Avatar
    Community Member
    55 Posts

    Re: $_SESSION ?? Link to this post

    How'd you go with this Steve?

    I'm trying to get my head around SS sessions myself. I believe to get your $_SESSION data, in the controller you can use
    Session::start($_SESSION) and it should transfer everything to the Session object.

    see http://api.silverstripe.com/default/Session.html#__construct

    Is this what you did?

    1249 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.