Welcome Guest, Not a member yet? Register   Sign In
Bunch of Beginner Qs
#1

[eluser]rufisgumbo[/eluser]
A bunch of random questions that I've put together while working on my first project. any insight would be much appreciated!


Remember Me/Checking Logged in Status
I've implemented a basic login system and there is an option to 'remember me'. If that's done a cookie is set. Usually on regular php sites, I would then have an include that just checks at the top of all protected pages - if session set, else if cookie set...

Where would I put that in this structure? I have a login controller but it seems like this would need to be part of a library/helper so that I can call it throughout various protected sections?


Base URL
Rather than constantly call base_url(), is there any benefit to setting it as a global var? if so, where best to set?


Session Arrays

Can you set a session array var driectly or have to do this ?
Code:
$search= $this->session->userdata('search');
$search['keyword'] = $keyword;
$this->session->set_userdata('search', $search);



Escaping Session data
Like the input class, does the session class have any type of sanatizing/filtering built-in?



How do I bind a value that's used more than once in an sql query

Code:
AND (first_name LIKE '%?%' OR last_name LIKE '%?%' OR company LIKE '%?%')";




Checking for post values

I understood from the user guide that this would return false, if the post input (happens to be radio) was not clicked:

Code:
if( $find['area']   = $this->input->post('area') ){

But it doesn't it's blank and yet it doesn't return false. Perhaps because it is 'set', but set to blank.




Messages In This Thread
Bunch of Beginner Qs - by El Forum - 06-11-2011, 04:28 PM
Bunch of Beginner Qs - by El Forum - 06-11-2011, 05:00 PM



Theme © iAndrew 2016 - Forum software by © MyBB