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 7563085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:34:29+00:00 2026-05-30T13:34:29+00:00

Updade: Ok so I’ve fixed my previous problem (Besides the SQLinjection which I’m not

  • 0

Updade:

Ok so I’ve fixed my previous problem (Besides the SQLinjection which I’m not sure how to patch but for now it’s unimportant) however I need to get it to detect Male or Female and strip some characters from it too… This is the code I did for that

I defined the variable here:

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

I then defined newgender here

$new_gender = "F";

However I then added an if statement which was supposed to detect if it was Male and change it to “M”

if($gender == "Male"){
$new_gender = "M";
}

The code seems to be simply ignoring the if statement as it always renders as a F for female. (I need the code this way or a similar alternative because the way the sql database works it needs to be 1 letter long so M or F only.

My second problem is having the registered time show up in the DB but if someone can solve this problem first I’ll update it with my other issue.

Many thanks,

Brad

I’ve been trying to make it so when a user clicks register with facebook it adds there information into my database. I’m getting an error however so not sure what to do… Here’s the code, please help me in any way you can.

    <?php
define('FACEBOOK_APP_ID', '276105599128518');
define('FACEBOOK_SECRET', 'mysecretappidhere');

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) {
  echo '<p>signed_request contents:</p>';
  $response = parse_signed_request($_REQUEST['signed_request'], 
                                       FACEBOOK_SECRET);
//$no_longer_needed_but_save_for_backup = explode(' ',$name,2);
//$dunno = $name_arr[0];
//$dunno = isset($name_arr[1])?$name_arr[1]:'';
//$Location_Array = $response["registration"]["location"]["name"];

$uname = $response["registration"]["username"];
$rname = $response["registration"]["name"];
$seckey = $response["registration"]["seckey"];
$email = $response["registration"]["email"];
$password = $response["registration"]["password"];
$gender = $response["registration"]["gender"];
$ip_last = $_SERVER['REMOTE_ADDR'];
$sessionKey = 'RevCMS-'.rand(9,999).'/'.substr(sha1(time()).'/'.rand(9,9999999).'/'.rand(9,9999999).'/'.rand(9,9999999),0,33);

// Connecting to database
mysql_connect('localhost', 'root', 'mypasswouldbehere') or die("MySQL Error: " . mysql_error());
mysql_select_db('phoenix3') or die("MySQL Error: " . mysql_error());

// Inserting into users table
$result = mysql_query("INSERT INTO users (id, username, real_name, password, mail, auth_ticket, rank, credits, vip_points, activity_points, activity_points_lastupdate, look, gender, motto, acount_created, last_online, online, ip_last, ip_reg, home_room, respect, daily_respect_points, daily_pet_respect_points, newbie_status, is_muted, mutant_penalty, mutant_penalty_expire, block_newfriends, hide_online, hide_inroom, mail_verified, vip, volume, seckey) 
VALUES 
(NULL, '$uname', '$rname', '$password', '$email', '$sessionKey','8', '10000', '0', '0', '0', '-', '$gender', 'I <3 Tropical-Resort', 'time()', ' . time() . ', '0', '$ip_last', '$ip_last', '8', '0', '3', '3', '0', '0', '0', '0', '0', '0', '0', '1', '0', '100', '$seckey')");
if($result){         

echo"should/'ve stored";
// GOT RESULTS
}
else
{
echo "error";
// Error in storing
}
}
else 
{
echo '$_REQUEST is empty';
}
?>

Yours,
Brad

  • 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-30T13:34:31+00:00Added an answer on May 30, 2026 at 1:34 pm

    ceejayoz fixed the issue, echoing echo mysql_error(); solves the issue as it tells you ALL the mysql problems you have. To fix the gender issue which was I needed to shorten it from Male to “M” or Female to “F” just use PHP’s substr so example is…

    $gender = substr("$fbgender", -4, 1);
    

    Thanks everyone who helped,
    -Brad

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

Sidebar

Related Questions

Update : Looks like the query does not throw any timeout. The connection is
Update: Now that it's 2016 I'd use PowerShell for this unless there's a really
Update 2: thanks again to @deepak-azad, I managed to solve my problem : here
UPDATE: I made a mistake in my debugging - this question is not relavent
UPDATE: Sorry I was wrong with my assumption of the problem. Its due to
I am currently running into a problem where an element is coming back from
* UPDATE: *I've already answered my question. But you can still give me advise
UPDATE maybe changing the Bitmap size in the new Activity may fix the problem
UPDATE: This problem goes away when I deploy as an exploded EAR i.e. by
UPDATE: Now looking for Package Name as opposed to PID I have an app

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.