[eluser]stuffradio[/eluser]
For some reason it works on my localhost, but not on this live server. Do you see anything wrong with this script?
This is what gets called when the form is posted
Code:
function register()
{
$this->registerlib->username = $this->input->post('username', TRUE);
$this->registerlib->password = $this->input->post('password', TRUE);
$this->registerlib->email = $this->input->post('email', TRUE);
$this->registerlib->user_ip = $this->input->post('user_ip', TRUE);
$this->registerlib->signup();
}
This is the registerlib file
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Registerlib
{
var $username;
var $password;
var $email;
var $user_ip;
function Registerlib()
{
$this->CI =& get_instance();
$this->CI->load->library(array('validation'));
}
function checkaccount()
{
if (strlen($this->username) < 1)
{
$data['error_message'] = 'Your username must be at least 1 characters in length!';
$this->CI->load->view('header');
$this->CI->load->view('home', $data);
$this->CI->load->view('footer');
} else {
$rows = $this->CI->db->get_where('users', array('username' => $this->username));
$count = $rows->num_rows();
if ($count > 0)
{
$data['error_message'] = 'An account with this username already exists!';
$this->CI->load->view('header');
$this->CI->load->view('home', $data);
$this->CI->load->view('footer');
return false;
} else {
return true;
}
}
}
function signup()
{
$rules['username'] = "required";
$rules['password'] = "required";
$rules['email'] = "required";
$this->CI->validation->set_rules($rules);
$fields['username'] = 'Username';
$fields['password'] = 'Password';
$fields['email'] = 'Email Address';
$this->CI->validation->set_fields($fields);
if ($this->checkaccount())
{
if ($this->CI->validation->run() == false)
{
$data['error_message'] = $this->validation->error_string;
$this->CI->load->view('header');
$this->CI->load->view('home', $data);
$this->CI->load->view('footer');
} else {
$data = array(
'username' => $this->username,
'password' => md5($this->password),
'email' => $this->email,
'date' => date("m/d/Y"),
'user_ip' => $this->user_ip
);
$this->CI->db->set($data);
$this->CI->db->insert('users');
$data['success_message'] = 'You have successfully registered an account!';
$this->CI->load->view('header');
$this->CI->load->view('home', $data);
$this->CI->load->view('footer');
}
}
}
}
I don't see anything wrong with it. I know the username/pass for the database is right because I just created a new one and still nothing gets executed.