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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:43:32+00:00 2026-05-26T17:43:32+00:00

Here is my code of Qt creator to send the data to PHP server

  • 0

Here is my code of Qt creator to send the data to PHP server and get the response.

QNetworkAccessManager *manager = new QNetworkAccessManager(this);
QNetworkAccessManager::connect(manager, SIGNAL(finished(QNetworkReply*)),this ,          SLOT(replyFinished(QNetworkReply*)));
QNetworkRequest *request = new   QNetworkRequest(QUrl("http://68.169.55.41/fss/verifylogindetails.php"));
QByteArray postData =" {\"estate_id\":\"hsr\",\"emp_pin\":1234,\"emp_id\":\"santhosh\"}";
request->setRawHeader( "User-Agent" , "Mozilla Firefox" );
request->setRawHeader( "charset", "utf-8" );
request->setRawHeader( "Connection", "keep-alive" );
manager->post(*request, postData );
}

void MainWindow::replyFinished(QNetworkReply *reply)
{
 QString data = reply->readAll().trimmed();
 qDebug() << data;
} 

And here is my php code to receive the login data and comparing with database values and sending the response.

<?php
include 'config.php'; 
$data = json_decode($_SERVER['HTTP_JSON']);
$con = mysql_connect($host, $user_name, $password);
if (!$con)
{
die('Could not connect: '.mysql_error());
}
mysql_select_db($db_name, $con);
$result = mysql_query("SELECT * FROM login_data_table");
while($row = mysql_fetch_array($result))
{
if((strcasecmp( $row['Emp_Id'], $data->emp_id) == 0) && ($row['Emp_Pin'] == $data- >emp_pin) && (strcasecmp( $row['Estate_Id'], $data->estate_id) == 0))
{
echo "SUCCESS"; 
}
else
{
echo "FAIL";
}
}
mysql_close($con);
?>

My problem is….. Always i am getting FAIL message from server. Even i am sending correct login details. please help me where i am wrong in my code.

  • 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-26T17:43:32+00:00Added an answer on May 26, 2026 at 5:43 pm

    I will post a piece of code from my own program. Hopefully this will help:

    void MainWindow::sendPost(url)
    {
        QUrl params;
        params.addQueryItem("usrname", login);
        params.addQueryItem("passwrd", password);
    
        QByteArray data;
        data.append(params.toString());
        data.remove(0,1);
    
        QNetworkAccessManager *manager = new QNetworkAccessManager(this);
        QNetworkReply *reply = manager->post(QNetworkRequest(url), data);
        CONNECT(reply, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
    }
    
    void MainWindow::replyFinished(QNetworkReply *reply)
    {
     QString data = reply->readAll().trimmed();
     qDebug() << data;
    } 
    

    PHP code will get values from program using $_POST array ($_POST[‘usrname’] and $_POST[‘password’] hold both values sent from the program), not $_SERVER. I have no idea why did you use $_SERVER.

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

Sidebar

Related Questions

Ok the error is showing up somewhere in this here code if($error==false) { $query
enter code here I have a table on SQL server 2005 with bigint primary
See here: http://code.google.com/p/ie7-js/ Does anyone have any experience or remarks about this javascript? Is
I have this code here: var infiltrationResult; while(thisOption) { var trNode = document.createElement('tr'); var
I have this code here, which is intended to allow any type of arguments:
Can't get it to scroll horizontally. What am I missing? Here's my code in
Consider this code: public void actionPerformed(ActionEvent e) { setEnabled(false); new SwingWorker<File, Void>() { private
Ok, here's the specs: Dev Server: Windows, WAMP, PHP 5+, Codeigniter Live Server: Ubuntu
I modified the code here (http://www.w3schools.com/PHP/php_ajax_database.asp) to update and display my database after an
I executed the following C# code to Test environment and PROD server: This code

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.