Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

PHP 

User Registration

EDIT: Since I had to use [ paste ] and can't change anything, it's worth noting I've fixed lines 25 and 19.

So I'm working on a user registration/login system and I can't seem to find where I've messed up with the registration here:

register_action.php


connection.php


register.html
Code
<html>
    <head>
    </head>
    <body>
        <form action="register_action.php" method="post" id="form">
        <br>
        <p>Username:<input type="text" name="user" class="user"></p>
        <p>Pass:</p> <input type="text" name="pwd" class="pwd">
        Email: <input type="text" name="email" class="email">
            <br>
        
        <div align="center"><input type="submit" value="insert" form="form"></div>
        </form>
            <br>

    </div>

    </body>
</html>

From what I can see everything should work alright, but it doesn't so clearly something's wrong. Thanks.
PHP Code

<?php 
$stmt
->execute; 

->

PHP Code

<?php 
$stmt
->execute(); 

That will probably do the trick.
(Nov 21, 2016 06:16 PM)PartTimeNinja Wrote:  
PHP Code

<?php 
$stmt
->execute; 

->

PHP Code

<?php 
$stmt
->execute(); 

That will probably do the trick.

Still not working unfortunately.
Assuming you fixed lines 19 and 25 as you said, the only line you need to fix is line 23, a semicolon is missing at the end of the line.

If you fixed these three, it should work. (if it doesn't work, make sure both database and table have the name "userdata" as stated in the scripts)
(Nov 21, 2016 06:40 PM)Mr.Steven Wrote:  Assuming you fixed lines 19 and 25 as you said, the only line you need to fix is line 23, a semicolon is missing at the end of the line.

If you fixed these three, it should work. (if it doesn't work, make sure both database and table have the name "userdata" as stated in the scripts)

Thanks loads, though it's still not quite working.

Database name is forum_users now and updated connection.php accordingly, and the table is userdata.

Is there something wrong with my PDO statement or something maybe?
(Nov 21, 2016 06:50 PM)Disparity Wrote:  Thanks loads, though it's still not quite working.

Database name is forum_users now and updated connection.php accordingly, and the table is userdata.

Is there something wrong with my PDO statement or something maybe?
Are you getting any errors?

If not, insert these lines on top of register_action.php and try again.
PHP Code

<?php 
ini_set
('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL); 

I tested your script and it worked just fine after fixing these 3 lines.
(Nov 21, 2016 06:52 PM)Mr.Steven Wrote:  Are you getting any errors?

If not, insert these lines on top of register_action.php and try again.
PHP Code

<?php 
ini_set
('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL); 

I tested your script and it worked just fine after fixing these 3 lines.

Didn't have errors enabled. Added that and realized for whatever reason FileZilla failed to upload a fixed version of connection.php. Thanks!
What webhosts manage to install PHP and not have errors turned on by default?? I suppose once it's online, errors should be turned off, but even then it should be a conscious decision to turn them off. Hosts shouldn't assume the server is for production and not for development (or both)



--
Programmer for Hire
{C#/.NET/Rust/Go/Java/PHP}


I have been doing this in my utilities.inc.php file that I put at the top of every php page ->

PHP Code

<?php 
/* Turn on error reporting */
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
if (
filter_input(INPUT_SERVER, 'SERVER_NAME', FILTER_SANITIZE_URL) == "localhost") {
    
error_reporting(-1); // -1 = on || 0 = off
} else {
    
error_reporting(0); // -1 = on || 0 = off
} 

that way I don't have to worry local or remote server.
Life is a fig newton of you imagination! ~ https://www.brainwaveblitz.com/canyousol..._solve.php
(Nov 22, 2016 01:54 AM)FeatureBug Wrote:  What webhosts manage to install PHP and not have errors turned on by default?? I suppose once it's online, errors should be turned off, but even then it should be a conscious decision to turn them off. Hosts shouldn't assume the server is for production and not for development (or both)

I'm using my personal VPS for this to get a feel of Linux servers and how webservers work, and I never thought to enable them. 😊
Fyi: you can edit paste :P, just paste it under your own account and not guest.
...
(Nov 23, 2016 04:14 AM)RumbleFrog Wrote:  Fyi: you can edit paste :P, just paste it under your own account and not guest.

Don't have an account and can't be bothered to make one. 😝
you'll want to sanitise the email variable too, especially if you're storing it later. the password is being hashed so that's fine


Possibly Related Threads...
Thread / Author Replies Views Last Post
[PHP] by CodeCompilerAZApr 15, 2020 04:24 PM 5 234 Apr 15, 2020 04:24 PM
Last Post: ropslide
[PHP] by realsunjesterFeb 1, 2019 12:50 AM 11 513 Feb 1, 2019 12:50 AM
Last Post: Squito
[PHP] by h4xx0r.Apr 21, 2013 11:14 PM 1 87 Apr 21, 2013 11:14 PM
Last Post: Linux.