My code doesn't work.

    digitalRead(LED2);
    unsigned long currentMillis = millis();
    if ((LED2 == HIGH) && (currentMillis - previousMillis >= OnTime))

You are still reading the state of the pin named LED2, throwing away the result then testing the value of the pin.

Same with LED1

    digitalRead(LED1);
    unsigned long currentMillis = millis();
    if ((LED1 == HIGH) && (currentMillis - previousMillis >= OnTime))