i want to block the ipadress of clients they send more request server from samp ip adress (hackers).
how i send mac code to particular ip adress and receiving the mac code from user and compare with original mac code..
You generally can't do this in php though. A PHP script isn't executed until AFTER the post has completed. To even potentially protect against DOS you would need to deny access before the post has completed, even better if you can do it before anything is sent from the client.
You are better off using .htaccess like this:
order allow,deny
deny from 127.0.0.1
allow from all
You might want to use PHP script to log the malicious request for further processing (e.g. to report them), but other then thatusing PHP is not appropriate.