diff --git a/api/auth/Register.php b/api/auth/Register.php index ec67b881fe0d33ebdc86f40ecdf659ff4263d10d..8ee647c8dd87ced5063a81a2d55c1034a6438a7f 100644 --- a/api/auth/Register.php +++ b/api/auth/Register.php @@ -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"', diff --git a/api/profile/get_code.php b/api/profile/get_code.php index 3093e33f104a17ad5a9fafbf5fd01320383675e6..31133aa47986867978fecaf712781f4739278aa2 100644 --- a/api/profile/get_code.php +++ b/api/profile/get_code.php @@ -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; } - +