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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:38:03+00:00 2026-06-04T09:38:03+00:00

I have a CURL(in C++) to send my user and pass to remauth.php file

  • 0

I have a CURL(in C++) to send my user and pass to remauth.php file so i think i do something wrong on remuth.php ( because i am basic in php and my program can not run because the auth not passed.)
I use login via Application.

my CURL:

bool Auth_PerformSessionLogin(const char* username, const char* password)
{
curl_global_init(CURL_GLOBAL_ALL);

CURL* curl = curl_easy_init();

if (curl)
{
    char url[255];
    _snprintf(url, sizeof(url), "http://%s/remauth.php", "SITEADDRESS.com");

    char buf[8192] = {0};
    char postBuf[8192];
    _snprintf(postBuf, sizeof(postBuf), "%s&&%s", username, password);

    curl_easy_setopt(curl, CURLOPT_URL, url);
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, AuthDataReceived);
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void*)&buf);
    curl_easy_setopt(curl, CURLOPT_USERAGENT, "IW4M");
    curl_easy_setopt(curl, CURLOPT_FAILONERROR, true);
    curl_easy_setopt(curl, CURLOPT_POST, 1);
    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postBuf);
    curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, -1);
    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);

    CURLcode code = curl_easy_perform(curl);
    curl_easy_cleanup(curl);

    curl_global_cleanup();

    if (code == CURLE_OK)
    {
        return Auth_ParseResultBuffer(buf);

    }
    else
    {
        Auth_Error(va("Could not reach the SITEADDRESS.comt server. Error code from   CURL: %x.", code));

    }

    return false;
  }

curl_global_cleanup();
return false;
}

and my remauth.php:

<?php
ob_start();
$host=""; // Host name 
$dbusername=""; // Mysql username 
$dbpassword=""; // Mysql password 
$db_name=""; // Database name 
$tbl_name=""; // Table name

// Connect to server and select databse.
mysql_connect("$host", "$dbusername", "$dbpassword") or die(mysql_error());
mysql_select_db("$db_name") or die(mysql_error());

// Define $username and $password 
//$username=$username; 
//$password=md5($_POST['password']);
//$password=$password;

$username=$_POST['username']; 
$password=$_POST['password'];
//$post_item[]='action='.$_POST['submit'];


// To protect MySQL injection (more detail about MySQL injection)
$username = stripslashes($username);
$password = stripslashes($password);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);

$sql="SELECT * FROM $tbl_name WHERE username='$username'";
$result=mysql_query($sql);

// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $username and $password, table row must be 1 row
if($count==1){
$row = mysql_fetch_assoc($result);
if (md5(md5($row['salt']).md5($password)) == $row['password']){
    session_register("username");
    session_register("password"); 
    echo "#";
    return true;
 }
 else {
    echo "o";
    return false;
 }
}
else{
echo "o";
return false;
}
ob_end_flush();
?>

///////////////////////////////////

  • 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-04T09:38:04+00:00Added an answer on June 4, 2026 at 9:38 am

    Are you getting a curl error? Is the php script executed at all?

    Have you added the SITEADDRESS merely for posting or is this a define which the compiler should replace with the website you want to connect to? If the second, this will not work inside “”, as it is then treated as a literal and not replaced.

    Also, you are calling curl_global_cleanup() twice, once inside the if clause and once at the end of the function. You should only call it once. Is your function possibly called multiple times? Then you should move the global init and cleanup elsewhere, as curl assumes them to only be called once in a program. This will not solve your actual problem, but it is good practice.

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

Sidebar

Related Questions

I have a program to send POST request to a server. I'm using cURL
I have a cronjob that calls a PHP file via CURL every hour from
I have installed WAMP and running PHP scripts on localhost. I have enabled cURL.
I have read that CURL is way too fast than File Get Contents and
I have a PHP script that uses CURL to fetch a remote page and
I currently run a PHP-script using CURL to send data to another server, to
I have a curl request as below, which should send a PUT request to
I'm trying to upload a file using cURL and the PUT method, I have
I am trying to send a JSON file to do some testing. I have
I have noticed that cURL in PHP returns different data when told to output

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.