From e1aeddc0caf35268d85f5167f6aa6767fcd03e01 Mon Sep 17 00:00:00 2001 From: Daniel Tartavel Date: Sat, 30 Nov 2019 00:55:06 +0100 Subject: [PATCH] debuggage --- nconnector.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/nconnector.php b/nconnector.php index 50386d9..d0a9b0e 100755 --- a/nconnector.php +++ b/nconnector.php @@ -36,6 +36,7 @@ $doldb->query("SELECT login, firstname, lastname, pass_crypted, fk_adherent_type while ($user = $doldb->result->fetch_assoc()) { //$flag+=1; + $insert = false; if ($user["fk_user_valid"] == null) $user["fk_user_valid"] = 0; $ncdb->query("SELECT uid FROM oc_accounts WHERE uid='" . $user["login"] . "'"); echo "login:" . ($user["login"]) . EOL; @@ -51,11 +52,19 @@ while ($user = $doldb->result->fetch_assoc()) $status = $r["configvalue"] ; }else { + $insert = true; $status = 1; } if ( $user["fk_user_valid"] != $status ) { - $query = "UPDATE oc_preferences SET configvalue = '" . $user["fk_user_valid"] ."' WHERE userid='" . $user["login"] . "' AND appid='core' AND configkey='enabled'" ; + if ( $insert ) + { + $query = "INSERT INTO oc_preferences (configvalue) VALUES ( '" . $user["fk_user_valid"] . "' ) "; + }else + { + $query = "UPDATE oc_preferences SET configvalue = '" . $user["fk_user_valid"] ."' WHERE userid='" . $user["login"] . "' AND appid='core' AND configkey='enabled'" ; + + } $ncdb->query( $query ); echo $query; } @@ -75,7 +84,7 @@ while ($user = $doldb->result->fetch_assoc()) $data["address"]["value"] = (concat ($address, utf8_encode($user["town"]))); $data["email"]["value"] = $user["email"]; print_r($data); - if (($account_data = json_encode($data)) == false ) + if ( ($account_data = json_encode($data)) == false ) { echo json_last_error(); exit (0);