Welcome Guest, Not a member yet? Register   Sign In
Set cookie and session
#1

[eluser]JayArias[/eluser]
I have been trying this past day to set the cookie and start a session so that I can keep my self logged in and cant seem to get it working.
Quote:&lt;?php if(!defined('BASEPATH')) exit("<h1>QOPQKJDQKLAFELWW)#@P$O@KAMDEWLREWFWELJWRWFWE</h1>");
session_start();
Class Login extends controller
{
function Login()
{
parent::Controller();
}

function index()
{

$data['base'] = $this->config->item('base_url');
$data['title'] = "Login @ www.dominicanosaqui.com";
$data['welcome_message'] = "<strong>Login</strong><br/><p>Welcome to dominicanos aqui we are currently in CLOSE BETA but mean while you can register your account, we will open to the public soon.";
$this->load->view('login',$data);
$this->load->library('validation');
}
function auth($email, $password){
$this->load->helper('url');
$this->load->library('validation');
$user_table = "members";
$this->load->helper('url');

$rules['login_email'] = "required|min_lenght[4]|max_lenght[25]|alpha_dash";
$rules['login_password'] = "required|min_lenght[4]|max_lenght[25]|alpha_dash";

$this->validation->set_rules($rules);

$fields['login_email'] = "email";
$fields['login_password'] = "password";

$email = $this->input->post('email');
$password = sha1(md5(md5($this->input->post('password'))));

$this->validation->set_rules($fields);
$this->load->database('default');
$auth_query = $this->db->query("SELECT * FROM `members` WHERE `email` = '$email' AND `password` = '$password'");
$member = $auth_query->row_array();
$check_member = $auth_query->num_rows();
if($check_member > 0) //check member
{
$this->load->helper('cookie');
echo "cookied...";
}else{
echo "Check your password & username";
}
}
}//close class
?&gt;




Theme © iAndrew 2016 - Forum software by © MyBB