0

I am curently trying to learn codeigniter soooo please be patient.

I've got this form to login with codeigniter.

    <!DOCTYPE html>
<html>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">



    <title>Login Page</title>

    <!-- Bootstrap core CSS -->
    <link href="assets/css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="assets/css/styles.css" rel="stylesheet">

    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
    <script src="js/ie-emulation-modes-warning.js"></script>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->


    <script src="assets/js/TweenLite.min.js"></script>
  </head>
  <body>

    <div class="navbar navbar-default navbar-custom navbar-fixed-top" role="navigation">
    <div class="container container-nav">
      <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">Toggle Nav</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>

        </button><a class="navbar-brand" href="#">RAN</a>

      </div>
      <div class="navbar-collapse collapse">
        <ul class="nav navbar-nav">
          <li><a href="#">Home</a>

          </li>
          <li><a href="#">About</a>

          </li>
        </ul>
        <ul class="nav navbar-nav navbar-right">
          <li><a href="#">News</a>

          </li>
          <li><a href="#">Blog</a>

          </li>
          <li><a href="#">Contact</a>

          </li>
        </ul>
      </div>
    </div>
  </div>

<div class="container">
  <div class="jumbotron">
    <div class="row">
        <div class="col-md-12">
            <div class="pr-wrap" >
                <div class="pass-reset">
                    <label>
                        Enter the email you signed up with</label>
                    <input type="email" placeholder="Email" />
                    <input type="submit" value="Submit" class="pass-reset-submit btn btn-success btn-sm" />
                </div>
            </div>
            <div class="wrap" >
                <p class="form-title">
                    Sign In</p>
                <form class="login">
                <input class="form-control" id="txt_username" name="txt_username" placeholder="Username" type="text" value="<?php echo set_value('txt_username'); ?>" />
                    <span class="text-danger"><?php echo form_error('txt_username'); ?></span>
                <input class="form-control" id="txt_password" name="txt_password" placeholder="Password" type="password" value="<?php echo set_value('txt_password'); ?>" />
                    <span class="text-danger"><?php echo form_error('txt_password'); ?></span>
                <input id="btn_login" name="btn_login" type="submit" class="btn btn-success btn-sm" value="Login" />
                <div class="remember-forgot">
                    <div class="row">
                        <div class="col-md-6">
                            <div class="checkbox">
                                <label>
                                    <input type="checkbox" />
                                    Remember Me
                                </label>
                            </div>
                        </div>
                        <div class="col-md-6 forgot-pass-content">
                            <a href="javascription:void(0)" class="forgot-pass">Forgot Password</a>
                        </div>
                    </div>
                </div>
                </form>
                <?php echo form_close(); ?>
          <?php echo $this->session->flashdata('msg'); ?>
            </div>
        </div>
    </div>

    </div>
</div> 


    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script src="assets/js/bootstrap.js"></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>

    <script>$(document).ready(function(){
  $(document).mousemove(function(e){
     TweenLite.to($('body'), 
        .5, 
        { css: 
            {
                backgroundPosition: ""+ parseInt(event.pageX/8) + "px "+parseInt(event.pageY/'12')+"px, "+parseInt(event.pageX/'15')+"px "+parseInt(event.pageY/'15')+"px, "+parseInt(event.pageX/'30')+"px "+parseInt(event.pageY/'30')+"px"
            }
        });
  });
});</script>
  </body>
</html>

I have no users on mysql tables so when i try some random users and password i see them in the URL browser above...

Lets say i try to put username: admin ---- pass: admin

and i can see it on the url like this

http://localhost/login/?txt_username=admin&txt_password=admin&btn_login=Login#

This is a php thing i guess but can anyone help me since im a baby starter at php codeigniter etc? :)

Thank you for your time

3 Answers3

1

You have to do like this.

<form class="login" method="post" action="<?= base_url("controller/function") ?>">

method="post"

To hide the parameters in url

See about post vs get here. Also see this

action

To tell which function to be called to validate login credentials. And your logic should be written in that function.

Community
  • 1
  • 1
Niranjan N Raju
  • 11,832
  • 3
  • 19
  • 41
0

if you to pass that username and password to tables first you have to done some setting in config folder of codigniter like setting autoload of helperclass and librabry class

or if you want pass just both username and password to controller follow this code

<?php echo form_open("user/login"); ?>
   ---here is your html login control
<?php echo form_close() ?>

when You click on submit button it transfer to user controller's login method.

Shah NIral
  • 320
  • 3
  • 13
0

You are missing the HTML attribute, unless you attend to send all your data with Jquery, you are required to use the form attribute.

killstreet
  • 1,124
  • 12
  • 30