Welcome Guest, Not a member yet? Register   Sign In
Form ONLY working in Firefox
#1

[eluser]Isern Palaus[/eluser]
Hello,

I recently programed a website and tested everytime with Firefox. Now I've uploaded to the server and I checked that if I try to login with Opera 9 (9.23) or Internet Explorer 7 (7.0.5730.11) and Internet Explorer 6 doesn't works. I've never seen these before and I don't understand why it happens.

Let's see the structure of the users:
Code:
CREATE TABLE IF NOT EXISTS `users` (
  `uid` int(5) NOT NULL auto_increment,
  `username` varchar(32) NOT NULL,
  `password` varchar(64) NOT NULL,
  `email` varchar(128) NOT NULL,
  `time` int(10) default NULL,
  PRIMARY KEY  (`uid`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1;

Now the user.php controller. The code it isn't mine. I found this on this forum and I don't remember who coded it but I used in other projects and works fine.
Code:
<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

class User extends Controller {

    function User() {
        parent::Controller();
        
        $this->load->helper('security');
    }
        
    function _check_login($username)
    {
        
        $password = dohash($this->validation->password);
        
        $query = $this->db->getwhere('users', array('username'=>$username, 'password'=>$password), 1, 0);
        if ($query->num_rows() == 0) {
            $this->validation->set_message('_check_login', 'Invalid login');
            return FALSE;
        }
        return TRUE;
    }
    
    function index()
    {
        redirect('');
    }

    function login()
    {
        $this->load->library('validation');
        
        $rules['username'] = 'trim|required|callback__check_login';
        $rules['password'] = 'trim|required';
        $this->validation->set_rules($rules);
        
        $fields['username'] = 'username';
        $fields['password'] = 'password';
        $this->validation->set_fields($fields);
        
        if ($this->validation->run()) {
            $this->load->helper('date');
            
            $query = $this->db->getwhere('users', array('username' => $this->input->post('username')));
            $row = $query->row();

            $this->session->set_userdata('logged_in', $row->uid);
            
            redirect('admin');
        }
        else
            redirect('');
    }
    
    function logout()
    {
        $this->session->sess_destroy();
        redirect('');
    }

}

?>

Now the main.php/login (who was routed by /login) that calls the view:
Code:
function login()
    {
        if($this->session->userdata('logged_in'))
            redirect('admin');
            
        $data["webTitle"]         = "Acceso usuarios";
        $data["lastNews"]         = $this->pisotones->getLastNews("news",5);
        $data["lastArticles"]     = $this->pisotones->getLastArticles("articles",5);
        
        $this->load->helper("form");
        
        $this->load->view("login",$data);
    }

The view "login":
Code:
<?php
    $this->load->view('header');
?>

            <?php
                $this->load->view('gadgets');
            ?>
            
            <div class="hr">&nbsp;</div>
            
            &lt;!-- Empieza Contenedor Cuerpo Page --&gt;
            <div id="body">
            
                &lt;?=form_open('user/login'); ?&gt;
                    <p>
                        <label for="username">Usuario:</label>
                        &lt;input type="text" name="username" id="username" /&gt;
                    </p>
                    <p>
                        <label for="password">Contrase&ntilde;a:</label>
                        &lt;input type="password" name="password" id="password" /&gt;
                    </p>
                    &lt;input type="submit" value="Entrar" /&gt;
                
                &lt;?=form_close();?&gt;
            </div>
            &lt;!-- Fin Contenedor Cuerpo Page --&gt;
    
&lt;?php
    $this->load->view('footer');
?&gt;

And this is the code. I don't understand why it isn't working on all the browsers. I'm not using AJAX, JavaScript and anything else that can cause a crash in some browsers.

You can check the site in: http://pisotones.ipalaus.es . I created a user and password test and test to see if this only happening on my computer. To logout use the following link: http://pisotones.ipalaus.es/user/logout

Thanks in advance,
-- Isern Palaus




Theme © iAndrew 2016 - Forum software by © MyBB