Skip to content
Snippets Groups Projects
Commit 2ecd0ee0 authored by Haidar's avatar Haidar
Browse files

feat: add register php fix

parent c8517747
Branches main
Tags v2
No related merge requests found
......@@ -18,16 +18,17 @@ $conn = Database::getInstance();
$conn->begin_transaction();
$sql = "INSERT INTO users (username, email, password) VALUES (?, ?, ?)";
$query = "SELECT IFNULL(MAX(id), 0) + 1 AS next_user_id FROM users";
$result = $conn->query($query);
$row = $result->fetch_assoc();
$nextUserId = $row['next_user_id'];
$sql = "INSERT INTO users (username, email, password, id) VALUES (?, ?, ?,?)";
$stmt = $conn->prepare($sql);
$stmt->bind_param("sss", $username, $email, $en_password);
$stmt->bind_param("ssss", $username, $email, $en_password, $nextUserId);
if ($stmt->execute() === TRUE) {
try {
$query = "SELECT IFNULL(MAX(id), 0) + 1 AS next_user_id FROM users";
$result = $conn->query($query);
$row = $result->fetch_assoc();
$nextUserId = $row['next_user_id'];
$arg0 = $nextUserId;
$arg1 = password_hash($password, PASSWORD_BCRYPT);
......@@ -41,7 +42,7 @@ if ($stmt->execute() === TRUE) {
</Envelope>';
// echo $requestBody;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, '192.168.6.193:8081/code');
curl_setopt($curl, CURLOPT_URL, '10.97.51.237:8081/code');
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
'Content-Type: text/xml; charset="utf-8"',
......
......@@ -10,17 +10,16 @@ $stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc();
$UserId = $row['id'];
// echo $UserId;
$requestBody = '<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<getCode xmlns="http://service.example.org/">
<arg0 xmlns="">' . $UserId . '</arg0>
</getCode>
</Body>
</Envelope>';
// echo $requestBody;
$curl = curl_init();
<Body>
<getCode xmlns="http://service.example.org/">
<arg0 xmlns="">' . $UserId . '</arg0>
</getCode>
</Body>
</Envelope>';
// echo $requestBody;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, '10.97.51.237:8081/getCode');
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
......@@ -40,4 +39,4 @@ $requestBody = '<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
$value = (string) $returnValue[0];
echo $value;
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment