}
    $sql = "INSERT INTO {$pilotsTable} (countryCode,CIVL_ID,CIVL_NAME,FirstName,LastName,Sex,Birthdate,pilotID,serverID)\n\t\t\tVALUES(\n\t\t\t'" . makeSane($_POST['countryCode']) . "',\n\t\t\t'" . makeSane($_POST['CIVL_ID']) . "',\n\t\t\t'" . makeSane($_POST['CIVL_NAME'], 2) . "',\n\t\t\t'" . makeSane($_POST['FirstName'], 2) . "',\n\t\t\t'" . makeSane($_POST['LastName'], 2) . "',\n\t\t\t'" . makeSane($_POST['Sex']) . "',\n\t\t\t'" . makeSane($_POST['Birthdate']) . "', \n\t\t\t{$user_id},0) ";
    if (!$db->sql_query($sql)) {
        echo "Error in query : {$sql}<BR>";
    }
    echo "User Added";
    exit;
} else {
    if ($op == 'del') {
        $user_id = makeSane($_POST['id']);
        $sql = "DELETE FROM " . $CONF['userdb']['users_table'] . " WHERE user_id={$user_id} ";
        if (!$db->sql_query($sql)) {
            echo "Error in query : {$sql}<BR>";
        }
        $pilot = new pilot(0, $user_id);
        $pilot->deletePilot(1, 1);
        exit;
    } else {
        if ($op == 'edit') {
            $user_id = makeSane($_POST['id']);
            $sql = "UPDATE {$pilotsTable} SET \n\t\t\tcountryCode='" . makeSane($_POST['countryCode']) . "',\n\t\t\tCIVL_ID='" . makeSane($_POST['CIVL_ID']) . "',\n\t\t\tCIVL_NAME='" . makeSane($_POST['CIVL_NAME'], 2) . "',\n\t\t\tFirstName='" . makeSane($_POST['FirstName'], 2) . "',\n\t\t\tLastName='" . makeSane($_POST['LastName'], 2) . "',\n\t\t\tSex='" . makeSane($_POST['Sex']) . "',\n\t\t\tBirthdate='" . makeSane($_POST['Birthdate']) . "' \n\t\t\tWHERE pilotID={$user_id} AND serverID=0";
            if (!$db->sql_query($sql)) {
                echo "Error in query : {$sql}<BR>";
            }
            $sql = "UPDATE " . $CONF['userdb']['users_table'] . " SET \n\t\t\tusername='******'username'], 2) . "',\n\t\t\tuser_email='" . makeSane($_POST['user_email'], 2) . "'\t\t\n\t\t\tWHERE user_id={$user_id} ";
            if (!$db->sql_query($sql)) {
                echo "Error in query : {$sql}<BR>";
            }
            // change password ?
            $user_password = makeSane($_POST['user_password'], 2);
            if ($user_password) {
示例#2
0
 function deleteAllSyncedPilots()
 {
     global $db, $pilotsTable;
     // if (!$this->gotValues) $this->getFromDB();
     $res = $db->sql_query("SELECT * FROM {$pilotsTable} WHERE  serverID={$this->ID} ");
     if ($res <= 0) {
         echo "Error getting server's pilots from local DB<BR>";
         return;
     }
     echo "Deleting all pilots of server " . $this->ID . " from local DB <HR>";
     while ($row = $db->sql_fetchrow($res)) {
         echo "Deleting pilot " . $row['pilotID'] . " : " . $row['FirstName'] . ' ' . $row['LastName'] . "<BR>";
         $pilotToDelete = new pilot($this->ID, $row['pilotID']);
         $pilotToDelete->deletePilot(0, 1);
         // delete dir of pilot
     }
     //	reset the counter
     //$this->lastPullUpdateID=0;
     // $this->putToDB(1);
 }