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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T12:01:16+00:00 2026-06-16T12:01:16+00:00

I am trying to make a simple login system I am using AFNetworking and

  • 0

I am trying to make a simple login system

I am using AFNetworking and this is my login function as it stands:

- (void) login {

NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:email.text, @"email", password.text, @"password", nil];

AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:@"http://localhost:8888"]];
[httpClient setParameterEncoding:AFFormURLParameterEncoding];

NSMutableURLRequest *request = [httpClient requestWithMethod:@"POST"
                                                        path:@"http://localhost:8888/api.php"
                                                  parameters:params];


AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];

[httpClient registerHTTPOperationClass:[AFHTTPRequestOperation class]];

[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
    NSString *response = [operation responseString];
    NSLog(@"response: [%@]",response);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    NSLog(@"error: %@", [operation error]);
}];

[operation start];

}

It is returning status 400 “bad request” so I am assuming my post is malformed. But I can’t seem to find what is wrong with it?

Here is a glance at the login APi

function login() {

    // Check for required params
    if (isset($_POST['email']) && isset($_POST['password'])) { 

        // Put params into local variables
        $email = $_POST['email'];
        $pass = $_POST['password'];

        echo 'Your email:' + $email + 'and password: ' + $password;

        // look up params in db
        $stmt = $this->db->prepare('SELECT `email`, `password`, `group_name` FROM `User` WHERE `email` = ? AND `password` = ?'); 
        $stmt->bind_param('ss', $email, $password); 
        $stmt->execute();
        $stmt->bind_result($u_email, $u_password, $group_name);
        while ($stmt->fetch()) {
            break;
        }

        $stmt->close();

        // Bail if code doesn't exist

        // Return unlock code, encoded with JSON
        $result = array(
            "group_name" => $group_name,
        );

        sendResponse(200, json_encode($result));
        return true;
    } 

    sendResponse(400, 'Invalid request');
    return false;
}  

So as you can see the email / password are not being sent with the post as their values are not set.

What is the issue here?

  • 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-06-16T12:01:18+00:00Added an answer on June 16, 2026 at 12:01 pm

    get wireshark on the machine running the web host.

    http://www.wireshark.org/

    then you can read the network traffic coming in on the server.

    perhaps its not even getting to the server. or perhaps port 8888 is blocked.

    Or maybe the http request is malformed and the server does not know what to do so it returns a 400

    for the filter you can use

    tpc.port == 8888
    

    this way it will only show tcp traffic on port 8888

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

Sidebar

Related Questions

Yo. I'm trying to make a simple login system in PHP and my problem
I'm trying to make simple script using jquery $post function to pass data to
Im trying to make a symple login system using swingf, I am having some
I'm trying to make a simple login form. The wordpress function is_user_logged_in() always returns
Trying to make a simple number clicker control for BlackBerry 6/7, like this: At
Trying to make a simple program to catalogue books. Something like this, for example:
Trying to make a simple program to catalogue books. Something like this, for example:
I'm trying to make a simple login script that will check the inputted username
I'm trying to create a simple login system that will have the forms and
im currently trying to make a simple IRC Gui Client. Im using the SmartIrc4net

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.