Welcome Guest, Not a member yet? Register   Sign In
Trying to create a login form with no success
#1

[eluser]maddtechwf[/eluser]
I have setup CI and have it working just fine. My initial login page shows up great but when I try to run the login, it tells me that my "function" is not available. I've checked my code and it looks correct. I've been trying to follow the NETTUTS tutorial. Has anyone gotten a login form to work correctly?

Reference Video URL: http://net.tutsplus.com/tutorials/php/co...y-6-login/
#2

[eluser]TheFuzzy0ne[/eluser]
Welcome to the CodeIgniter forums!

Please could you paste the exact error. I'm not familiar with any PHP error that says "function is not available".
#3

[eluser]maddtechwf[/eluser]
Sorry, I was paraphrasing when I wrote that post last night. This is what it posts back to me.

The requested URL /weeklydebrief-backup/login/validate_credentials was not found on this server.

This is what my login controller looks like.

Code:
<?php

class Login extends CI_Controller {

public function index()
{
  $data['main_content'] = 'login_form';
  $this->load->view('includes/template', $data);
}

public function validate_credentials()
{
  $this->load->model('membership_model');
  $query = $this->membership_model->validate();
  
  if($query)
  {
   $data = array(
    'username' => $this->input->post('username'),
    'is_logged_in' => true
   );
  
   $this->session->set_userdata($data);
   redirect('site/members_area');
  }
  else
  {
   $this->index();
  }
}
}

#4

[eluser]LuckyFella73[/eluser]
Hi,

it seems that your .htaccess for rewriting urls isn't set up properly if
setup up at all (or you didn't remove "index.php" in your config file)
Code:
// application/config.php:
$config['index_page'] = '';

Did you read this page of the user guide:
http://ellislab.com/codeigniter/user-gui.../urls.html

Here you find needed information about the .htaccess for rewriting urls.

#5

[eluser]maddtechwf[/eluser]
Okay, so I've looked at the link you provided and this link and I still cannot get everything to work.

Essentially, I have two parts to my app. I have a public section that I want people to be able to access which consists of 5 pages. I then have a member's area that I only want people to access after logging in.

Any help would be great.
#6

[eluser]mpar612[/eluser]
Hi there, not sure if this will help, but that tut is quite old and intended for Codeigniter 1.x. Quite a bit changed with the release of Codeigniter 2. You might find this tut a little more helpful.
#7

[eluser]maddtechwf[/eluser]
Thanks for that link. I really needed that newer video. I guess my biggest issue right now is my .htaccess file. I've always had mine created with any PHP application that I have used so I'm not exactly sure how to create my own and what to put in there to get it to work for me. I would appreciate any help.

The link that someone provided above was nice but it still didn't answer what I needed to do. When I put it in place, none of my pages worked after that.
#8

[eluser]TheFuzzy0ne[/eluser]
What operating system is your server running on?

When you say none of your pages worked, what error did you get? Was it a 404, or a 500 error? I'd just like to confirm that mod_rewrite is enabled and working.

Where is your Web application with regards to the Web root? Is it in the Web root, or within a sub-directory within the Web root?
#9

[eluser]maddtechwf[/eluser]
I'm running Linux on my server. I have wordpress installed and it's .htaccess is working just fine.
#10

[eluser]TheFuzzy0ne[/eluser]
Please try my .htaccess file:
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{REQUEST_URI} ^/(system|application|html_store)
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php?/$1 [L]
</IfModule>




Theme © iAndrew 2016 - Forum software by © MyBB