Welcome Guest, Not a member yet? Register   Sign In
User Login
#1

[eluser]GamingFusion[/eluser]
I have made a simple Login Script that asks the user for their username and password.

Heres my problem, when i go to the login page it doesn't display. I think it has somehting to do with my if statement at the top but it should work.

here is my code
----View----
Code:
<?php
$this->database->checkLogin();

if ($loggedIn == FALSE)
{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html &gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
&lt;title&gt;&lt;?=$title?&gt;&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
<h1>&lt;?=$heading?&gt;</h1>
<hr />
  
&lt;?php echo validation_errors(); ?&gt;

&lt;?=form_open('theater/checkLogin');?&gt;

<table>
    <tr>
        <td>Username: </td><td>&lt;input name="username" class="input" type="text" value="&lt;?php echo set_value('username'); ?&gt;" /&gt;&lt;/td>
    </tr>
    <tr>
        <td>Password: </td><td>&lt;input name="password" class="input" type="password" /&gt;
        </td>
        <td>&lt;?=form_submit('submit', 'Login');?&gt;</td>
    </tr>
</table>

&lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt;
&lt;?php
}else{
    echo 'Logged In';
    //redirect('theater', 'refresh');
}
?&gt;

----model----
Code:
function checkLogin()
    {
        $u1 = get_cookie('username');
        $p1 = get_cookie('password');

        $logged = $this->db->get_where('users', array ('username' => $u1, 'password' => $p1));

        //Rename some of the $logged['variables'] with easier names.
        $uId = $logged['id'];
        $uName = $logged['username'];
        
        if ($uName) {
            return $data['loggedIn'] = TRUE;
        }else{
            return $data['loggedIn'] = FALSE;
        }
    }


Messages In This Thread
User Login - by El Forum - 11-02-2009, 05:37 PM
User Login - by El Forum - 11-02-2009, 05:47 PM
User Login - by El Forum - 11-02-2009, 06:26 PM
User Login - by El Forum - 11-02-2009, 07:19 PM
User Login - by El Forum - 11-02-2009, 09:10 PM
User Login - by El Forum - 11-02-2009, 09:12 PM
User Login - by El Forum - 11-02-2009, 09:50 PM
User Login - by El Forum - 11-02-2009, 09:58 PM
User Login - by El Forum - 11-02-2009, 10:05 PM
User Login - by El Forum - 11-02-2009, 10:07 PM
User Login - by El Forum - 11-02-2009, 10:24 PM
User Login - by El Forum - 11-03-2009, 12:19 AM
User Login - by El Forum - 11-03-2009, 04:29 PM
User Login - by El Forum - 11-03-2009, 06:51 PM
User Login - by El Forum - 11-03-2009, 07:04 PM
User Login - by El Forum - 11-03-2009, 07:37 PM
User Login - by El Forum - 11-04-2009, 03:28 PM
User Login - by El Forum - 11-04-2009, 06:55 PM
User Login - by El Forum - 11-04-2009, 07:01 PM
User Login - by El Forum - 11-05-2009, 03:22 PM
User Login - by El Forum - 11-05-2009, 04:05 PM
User Login - by El Forum - 11-05-2009, 05:41 PM



Theme © iAndrew 2016 - Forum software by © MyBB