How to use a double 7 segment with atmega32
One thing about 7 segment displays is that they have no memory. Typically the way to control more than one is to:

display on digit 1 -> switch to digit 2 -> display on digit 2 -> switch to digit 1 -> display on digit 1 -> switch to digit 2 -> and so on. 

You are setting digit 1, and then switching to digit 2 (so digit 1 is now off) and stopping after that.

You should constantly cycle between the digits to keep all of them on. If you do this fast enough it will appear like they are both always on.

The "weird bar" you are seeing looks like the color-inverted digit 0. I generally suggest applying a mask to the values you write to PORTD to make sure you are actually only changing bits 0-3. Do something like this:

PORTD &amp;= ~0xF;      // Clear bits 0-3
PORTD |= num &amp; 0xF; // Write bits 0-3