Jump to content

register page wont work , acces denied for user


Go to solution Solved by Ch0cu3r,

Recommended Posts

I followed a tutorial for making a secure login system for my website, and now when i completed the tutorial it isnt working as it is supposed to. 

 

when i click the register page on my site it gives the error code Warning: mysqli::mysqli(): (HY000/1045): Access denied for user 'sec_user'@'localhost' (using password: YES) in C:\wamp\www\gip\includes\db_connect.php on line 

 

im a newbie to php so please help me :(

 

 

db_connect.php

register.php

 Access denied for user 'sec_user'@'localhost' (using password: YES) in C:\wamp\www\gip\includes\db_connect.php on line 3 
sec_user

Does your MySQL have a user called "sec_user"? If not, then change it to root, that should work. 

 

A Post I recently made may help you; http://forums.phpfreaks.com/topic/287759-loginregister-help/?p=1476134 You can find it here. :)

 // TODO: 

    // We'll also have to account for the situation where the user doesn't have

    // rights to do registration, by checking what type of user is attempting to

    // perform the operation.

 

    if (empty($error_msg)) {

        // Create a random salt

        $random_salt = hash('sha512', uniqid(openssl_random_pseudo_bytes(16), TRUE));

 

        // Create salted password 

        $password = hash('sha512', $password . $random_salt);

 

        // Insert the new user into the database 

        if ($insert_stmt = $mysqli->prepare("INSERT INTO members (username, email, password, salt) VALUES (?, ?, ?, ?)")) {

            $insert_stmt->bind_param('ssss', $username, $email, $password, $random_salt);

            // Execute the prepared query.

            if (! $insert_stmt->execute()) {

                header('Location: ../error.php?err=Registration failure: INSERT');

            }

        }

        header('Location: ./register_success.php');

    }

}

?>

 

this is where the bug is but i cant really see it xs

  • Solution

You are getting that error because you do not have the openssl extension enabled. You need to open your php.ini and enable the openssl extension.

 

You appear to be using WAMP. If I rememeber you can open the php.ini file from the wamp taskbar icon, by left clicking it and selecting PHP > php.ini now find the following line

;extension=php_openssl.dll

and remove the semi-colon at the start of the line. Save the php.ini and restart Apache.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.