1 photoresistor 2 leds (sorry for my english)

Yes, probably it would not work.
I just try to give a tips, not a programm. The tips are you have a deal with timing,
and should use a time checking subroutine, like millis();
I think in my example there is a timing issue, as it overwrite newvalue any cycle.
And photoresistors are slow devices, so value from the sensor couldn't change fast enough.
Put a delay(500), after last line, it will slow the speed.