Afghan president survives attack