Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6234449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:29:15+00:00 2026-05-24T10:29:15+00:00

I am trying to implant facebook registration on my site. I used this tutorial:

  • 0

I am trying to implant facebook registration on my site.

I used this tutorial: http://www.9lessons.info/2011/01/user-signup-using-facebook-data.html

When I click ‘register’ and it’s time for the code to insert the data into the database I get this error:

Warning: mysql_connect() [function.mysql-connect]: Access denied for
user ‘USERNAME’@’HOST’ (using password: YES) in
/home/a9297472/public_html/store_user_data.php on line 44

(I censored the real username and host)

According to the error the host and username were right.
Here is the process code:

<?php
include('config/db_con.php');
define('FACEBOOK_APP_ID', 'APP ID'); // Place your App Id here
define('FACEBOOK_SECRET', 'APP SECRET'); // Place your App Secret Here

// No need to change the function body
function parse_signed_request($signed_request, $secret) 
{
    list($encoded_sig, $payload) = explode('.', $signed_request, 2);
    // decode the data
    $sig = base64_url_decode($encoded_sig);
    $data = json_decode(base64_url_decode($payload), true);
    if (strtoupper($data['algorithm']) !== 'HMAC-SHA256')
    {
        error_log('Unknown algorithm. Expected HMAC-SHA256');
        return null;
    }

    // check sig
    $expected_sig = hash_hmac('sha256', $payload, $secret, $raw = true);
    if ($sig !== $expected_sig) 
    {
        error_log('Bad Signed JSON signature!');
        return null;
    }
    return $data;
}
function base64_url_decode($input) 
{
    return base64_decode(strtr($input, '-_', '+/'));
}
if ($_REQUEST) 
{
    $response = parse_signed_request(
        $_REQUEST['signed_request'],
        FACEBOOK_SECRET
    );

    $name = $response["registration"]["name"];
    $email = $response["registration"]["email"];
    $password = $response["registration"]["password"];
    $gender = $response["registration"]["gender"];
    $dob = $response["registration"]["birthday"];

    // Connecting to database
    mysql_connect("$host", "$username", "$password")or die("cannot connect");
    mysql_select_db("$db_name")or die("cannot select DB");

    // Inserting into users table
    $result = mysql_query("
INSERT INTO users (
    name, email, password, gender, dob
) VALUES (
    '$name', '$email', '$password', '$gender', '$dob')
");

    if($result){
    // User successfully stored
    }
    else
    {
        // Error in storing
    }
}
else 
{
    echo '$_REQUEST is empty';
}

?>

I double checked everything.
The host,username,password & db_name are the same details I use in other parts of the site and it works fine.
What did I do wrong?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T10:29:15+00:00Added an answer on May 24, 2026 at 10:29 am

    Your $password for the db is being overwritten here:

    $password = $response["registration"]["password"];

    I assume you want to use the one from db_con.php
    😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to follow this MSDN tutorial to get a web response but not getting
trying to get a regex that will match a url e.g. 'http://www.test.com' and then
Trying to use this method (gist of which is use self.method_name in the FunnyHelper
Trying to do this, but is it wrong? Below is my style and script
Trying to write this small program to help me in my Stats class, everything
Trying to find some information on this but am unable to get any results
Trying to reproduce the problem from this question , I've found I can't plot
Trying to display a new page, in a new window when the user clicks
Trying to launch and pass tel. no. to skype by this code from my
Trying to get this query to work. I'm having issues with brackets I think.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.