You are suffering from a problem with the kidneys, probably a stone.
The kidneys are situated just under the ribs at the back. The ureter is a fine tube that collects the urine from the kidneys and takes it down to the bladder situated in front of the abdomen just above the genital regions.
A stone lodged in the ureter will cause the type of pain that you are suffering from - pain starting at the back (near the kidneys) and coming around to the front (following the path of the ureter) and finally radiating to the scrotum (near the bladder) and the back of legs.
You need to get a special Xray called an IVP - it will help to outline the entire urinary tract and show up the stone in the tract. You will also need an ultrasonogram.
Please consult your doctor. Meanwhile you have already taken the wise step of drinking lots of water (at leat 10 - 12 glasses) to flush out the stone. You can also take Motrin 500mg to help decrease the intensity of pain.
I hope this helps.
Let me know if you need more input. If not, please click on the green"Accept" button on this page. A positive rating and adding a bonus will be warmly appreciated.