Welcome Guest, Not a member yet? Register   Sign In
Need Help Creating Registration/Login Form
#1

(This post was last modified: 02-08-2016, 05:54 PM by Rumiko.)

Hi guys! Total CI noob here! Just so we're on the same page, I'm following this tutorial: http://www.kodingmadesimple.com/2015/08/...ation.html

Which covers creating a registration form in Code Igniter with some validation and whatnot. My code looks exactly as it is shown in the tutorial.

I have my database set up:

   

My browser is displaying the form fine: 

   

But after filling out the fields and submitting the form, I get this error in Safari:

   

Any idea what's causing this? If you need any more information, I will be happy to give it to you.
Reply
#2

Found out something. Guess I'm supposed to change my "base_url", which I found in the "application/config.php" file. Right now it's set to blank. What exactly am I supposed to set it to? I tried setting it to "localhost:8888/theFolderMyCodeIgniterFilesAreIn" and I just got a 404 error.
Reply
#3

Could be a permissions setting in Safari's options.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

Hi. I confess I'm not familiar with ::1 notation, and you can't google for strings like that, so I found nothing.

Clearly, Safari can open pages on your server, since you get as far displaying the form. When the form is displayed, what is the URL in the browser's address bar? Is it ::1/something/something or is it localhost/something/something?

Are you already familiar with PHP? Maybe try to narrow down the point at which it gets that error. You can do this by inserting an exit; statement in your code until the error message appears. That is, if execution hits the exit statement before whatever is causing the error, execution will end and you won't get the error. If that happens, move the exit statement forward. When you get the error, it means you moved the exit statement ahead of the error. If you did this line by line, the line above the exit statement is causing the error.
Hey, don't work without a PHP debugger. Several free IDEs have this features built in. Two are NetBeans and CodeLobster. Without a debugger, it's like you're driving with a blindfold on -- you are going to crash!
Reply
#5

I would guess that it would work if you used http://localhost or http://127.0.0.1 instead of http://::1.

See: http://superuser.com/questions/877587/wh...-127-0-0-1

It would seem that in order for Apache to work with ipv6, there is some configuration that needs to be done.
Reply
#6

Your database structure suggests that you are planning of storing the passwords (or a simple hash) in your database. If you have little or no experience in creating a secure login functionality then I would suggest using an existing auth library from people who have such experience.

Some popular ones out there are:
Ion Auth
Community Auth
Reply
#7

(This post was last modified: 02-09-2016, 08:25 AM by InsiteFX.)

::1 - Is the new style od IP Address for localhost.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#8

(02-09-2016, 06:38 AM)Diederik Wrote: Your database structure suggests that you are planning of storing the passwords (or a simple hash) in your database. If you have little or no experience in creating a secure login functionality then I would suggest using an existing auth library from people who have such experience.

Some popular ones out there are:
Ion Auth
Community Auth

That's a good point, but the OP describes himself as a "total CI noob," so what he's working on is probably not going into production. He's just learning.
Hey, don't work without a PHP debugger. Several free IDEs have this features built in. Two are NetBeans and CodeLobster. Without a debugger, it's like you're driving with a blindfold on -- you are going to crash!
Reply
#9

(This post was last modified: 02-09-2016, 10:16 AM by Rumiko.)

(02-08-2016, 06:26 PM)InsiteFX Wrote: Could be a permissions setting in Safari's options.

I tested it in Firefox (without setting the base_url in the config and got the same kind of message. When I tested it in Chrome, the signup button did absolutely nothing.


(02-08-2016, 07:03 PM)RobertSF Wrote: Hi. I confess I'm not familiar with ::1 notation, and you can't google for strings like that, so I found nothing.

Clearly, Safari can open pages on your server, since you get as far displaying the form. When the form is displayed, what is the URL in the browser's address bar? Is it ::1/something/something or is it localhost/something/something?

Are you already familiar with PHP? Maybe try to narrow down the point at which it gets that error. You can do this by inserting an exit; statement in your code until the error message appears. That is, if execution hits the exit statement before whatever is causing the error, execution will end and you won't get the error. If that happens, move the exit statement forward. When you get the error, it means you moved the exit statement ahead of the error. If you did this line by line, the line above the exit statement is causing the error.

When the form page is loaded up, it says "localhost:8888" in the address bar. No subfolder or anything afterward. My route.php is set up so that the default controller is the controller handling the user_registration_view.php (my form), so that's what loads up automatically.

I've dabbled in PHP, but it's been quite a while and I need to refresh on it.


(02-08-2016, 07:37 PM)skunkbad Wrote: I would guess that it would work if you used http://localhost or http://127.0.0.1 instead of http://::1.

See: http://superuser.com/questions/877587/wh...-127-0-0-1

It would seem that in order for Apache to work with ipv6, there is some configuration that needs to be done.


I'm not sure why it's going to ::1. I'm physically typing in "localhost:8888" to get to the form, just like I usually do when i'm working in my local server and want to preview a file. Yet, upon submitting the form, the address switches to ::1.


Do you guys have any comment on the "base_url" thing? It had gotten rid of the ::1 error when I set it to "http://localhost:8888/myProjectFolder." Which I guess is progress? (haha)

Now it just says "The requested URL /myProjectFolder/index.php/User/register was not found on this server."

Not sure what the User/register is supposed to be, but I'm guessing it has to do with the code below in the user_registration_view.php :

Code:
<div class="row">
   <div class="col-md-6 col-md-offset-3">
       <div class="panel panel-default">
           <div class="panel-heading">
               <h4>User Registration Form</h4>
           </div>
              <div class="panel-body">
     HERE ->   <?php $attributes = array("name" => "registrationform");
               echo form_open("User/register", $attributes);?>  <- TO HERE
               <div class="form-group">
                   <label for="name">First Name</label>
                   <input class="form-control" name="fname" placeholder="Your First Name" type="text" value="<?php echo set_value('fname'); ?>" />
                   <span class="text-danger"><?php echo form_error('fname'); ?></span>
               </div>

               <div class="form-group">
                   <label for="name">Last Name</label>
                   <input class="form-control" name="lname" placeholder="Last Name" type="text" value="<?php echo set_value('lname'); ?>" />
                   <span class="text-danger"><?php echo form_error('lname'); ?></span>
               </div>
               
               <div class="form-group">
                   <label for="email">Email ID</label>
                   <input class="form-control" name="email" placeholder="Email-ID" type="text" value="<?php echo set_value('email'); ?>" />
                   <span class="text-danger"><?php echo form_error('email'); ?></span>
               </div>

               <div class="form-group">
                   <label for="subject">Password</label>
                   <input class="form-control" name="password" placeholder="Password" type="password" />
                   <span class="text-danger"><?php echo form_error('password'); ?></span>
               </div>

               <div class="form-group">
                   <label for="subject">Confirm Password</label>
                   <input class="form-control" name="cpassword" placeholder="Confirm Password" type="password" />
                   <span class="text-danger"><?php echo form_error('cpassword'); ?></span>
               </div>

               <div class="form-group">
                   <button name="submit" type="submit" class="btn btn-default">Signup</button>
                   <button name="cancel" type="reset" class="btn btn-default">Cancel</button>
               </div>
               <?php echo form_close(); ?>
               <?php echo $this->session->flashdata('msg'); ?>
           </div>
       </div>
   </div>
</div>


I know it's accessing index.php (which right now is just whatever Code Igniter has for it as code by default) because the "Index File" config is set to : $config['index_page'] = 'index.php';

I'm assuming I would change that to the home page of my site (after the successful registration), correct?

Either way, I don't know what the User/register is at the end of that address. But that's probably what's causing the 404 error now.
Reply
#10

(02-09-2016, 09:50 AM)RobertSF Wrote:
(02-09-2016, 06:38 AM)Diederik Wrote: Your database structure suggests that you are planning of storing the passwords (or a simple hash) in your database. If you have little or no experience in creating a secure login functionality then I would suggest using an existing auth library from people who have such experience.

Some popular ones out there are:
Ion Auth
Community Auth

That's a good point, but the OP describes himself as a "total CI noob," so what he's working on is probably not going into production. He's just learning.

Yeah, I'm trying to learn it currently. Watched a course on Lynda, read some of the documentation, figured I'd try to tackle it...And failing pretty hard right now ^^'
Reply




Theme © iAndrew 2016 - Forum software by © MyBB