在
$this->load->view('config');
$dbhost = $this->config->item("dbhost");
$dbuser = $this->config->item("dbuser");
$dbpass = $this->config->item("dbpass");
$msdb=mssql_connect($dbhost,$dbuser,$dbpass);
mssql_select_db("QPAccountsDB",$msdb);
$account = $_POST['user'];
$LogonPass = md5($_POST['password']);
$sql = "select Accounts from AccountsInfo where Accounts = '$account' and LogonPass = '$LogonPass' ";
//echo $sql."<br/>";
$result = mssql_query($sql, $msdb);
$row = mssql_fetch_array($result, MSSQL_ASSOC);
//$row = mssql_fetch_array($result, MSSQL_ASSOC)
mysql_free_result($result);
mssql_close($msdb);
//echo $row;
if(!empty($row)){
$redirect = base_url('account/message')."?status=success";
$newdata = array(
'username' => $this->encrypt->encode($row['Accounts']),
'id' => $this->encrypt->encode($row['UserID']),
'logged_in' => TRUE
);
$this->session->set_userdata($newdata);
//echo $this->encrypt->decode($this->session->userdata('username'));
header("Location:".$redirect);
}else{
$redirect = base_url('customer/login')."?status=fail";
header("Location:".$redirect);
}