Turn the stool over so the legs are facing up and the seat is flat against the floor.
Remove the screws securing the wobbly leg to the seat, using the Phillips screwdriver.
Insert the tip of a flat-head screwdriver or chisel underneath the head of deeply driven nails to unseat them.
Strike the middle of the seat with the hammer while lifting the wobbly leg out of its hole.
Put wood glue in the bottom of the leg hole. This is optional but will help keep the leg in place.
Twist the top of the wobbly leg back into the hole.
Hammer new nails and screw new screws into the leg until it is firmly in place.