if it is affected by gravity it has weight. if it has weight it has mass.
I've never heard this law before. Weight is a force. Force = Mass * Acceleration. Gravity is (in this case) acceleration.
Therefore, a Photon (Mass 0): Force = 0 * Gravity therefore Force = 0 N
Interestingly, when looking at it with this tool, Acceleration = Force / Mass. Mass is 0, therefore acceleration is undefined (which fits, because a Photon doesn't accelerate in any manner we can define).
The point of the matter is, when one looks at gravity the way it's supposed to be looked at (based on current theories), it is only a curve in space time. Photons, though they aren't accelerating, are moving. If you put a ball on a trampoline and push it along, it will travel in a straight line. Now stand ahead of and to the right of the ball. The ball will curve towards you, and depending on how fast it's going, it may hit you. You, in this experiment, are a representation of gravity. The bending in the trampoline is the curve that gravity creates in space-time.
Only in Newtonian physics is mass entirely a pre-requisite of being affected by gravity. Though in modern physics, having mass still makes gravity's effect more obvious.
oh and the speed of light is not constant
Also not quite true. Light travels at different speeds, yes, however:
c (299,792,458 meters per second) is the speed of light in a vacuum.
In any vacuum, light will travel at c.
When you change the medium (say, to a pure oxygen environment), the speed of light will also change. Coincidentally, if you go anywhere else in the world (I'll even say the universe), and measure the speed of light in a different pure oxygen environment, you'll find the same speed as you did with the first pure oxygen environment.