Welcome Guest, Not a member yet? Register   Sign In
Redirect
#4

[eluser]james byrne[/eluser]
I can not figure it out can someone look at my code and let me know what is up. Thanks in advance for your help:

<?php

class Admin extends Controller {

function Admin() {
parent::Controller();

$this->load->helper(array('url','form','date'));
$this->load->library('session');
$this->load->library('validation');
$this->load->library('password');
$this->load->library('email');
}

function index() {
$username = $this->session->userdata('bidder_first_name');

$data['john'] = "This is just a test";

$this->load->view('admin',$data);
}

function login() {

if($this->session->userdata('bidder_logged_in')=="true") {
redirect('admin/index');
}

if(@$_POST["submitted"] == "true") {

$username = @$_POST["bidder_username"];
$password = $this->password->encrypt(@$_POST["bidder_password"]);

$array = array('email'=>$username, 'password'=>$password);
$this->db->where($array);
$this->db->from("users");
$result = $this->db->get();

if($result->num_rows() < 1) {
$data['error'] = "The username/password you provided was incorrect. Please try again.";
$this->load->view('login',$data);
} else {
$array = array('bidder_first_name'=>$result->row()->first_name,
'bidder_username'=>$result->row()->email,
'bidder_logged_in'=>true,
"bidder_id"=>$result->row()->id);
$this->session->set_userdata($array);
redirect('admin/index/');
}
} else {
$this->load->view('login');
}
}

function logout() {
$this->session->sess_destroy();
redirect('admin/');
}

function new_user() {

}
}
?&gt;


Messages In This Thread
Redirect - by El Forum - 12-20-2007, 12:11 AM
Redirect - by El Forum - 12-20-2007, 12:44 AM
Redirect - by El Forum - 12-20-2007, 12:58 AM
Redirect - by El Forum - 12-20-2007, 09:53 PM
Redirect - by El Forum - 12-20-2007, 11:36 PM
Redirect - by El Forum - 12-22-2007, 11:14 AM
Redirect - by El Forum - 12-22-2007, 03:52 PM
Redirect - by El Forum - 12-22-2007, 06:31 PM
Redirect - by El Forum - 12-22-2007, 06:46 PM
Redirect - by El Forum - 12-22-2007, 07:08 PM
Redirect - by El Forum - 12-22-2007, 07:14 PM



Theme © iAndrew 2016 - Forum software by © MyBB