Welcome Guest, Not a member yet? Register   Sign In
What is the best practice for age verification landing page in CI?
#3

[eluser]weboap[/eluser]
you can set your default controller in the routes.php
something like
Code:
$route['default_controller'] = "verification";

to the verification controller (call the file verification) withing it you can use sessions
in the index load a view that will have your links

Code:
<html>
    <head>
        <title>Verify Your Age</title>
    </head>
    <body>
        <a href="http://mysite.com/verification/check">I am over 18</a> |  
        <a href="http://www.google.com/">Get me out of here!</a>
    &lt;/body&gt;
&lt;/html&gt;



in the verification controller you can create the function
Code:
.....
public function check(){

$newdata = array(
                   'over18'  => true,
                   'passcheck'     => true
               );

$this->session->set_userdata($newdata);

//then redirect the user to the real landing page

redirect('/home', 'location', 301);

}


then in the constructor of every controller you check if

Code:
$over18 = false;
$passcheck = false;

$over18 = $this->session->userdata('over18');
//making sure the user didn't land on the page from outside.

$passcheck = $this->session->userdata('passcheck');

if(!$passcheck){
//take him to verify
redirect('/verification', 'location', 301);
}


if(!$over18){

header("Location: http://google.com, TRUE, 302");  

}


well this is a quick solution, somebody may have better. good luck.


Messages In This Thread
What is the best practice for age verification landing page in CI? - by El Forum - 05-10-2012, 12:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB