Jump to content

AhmedMostafa50

New Members
  • Posts

    2
  • Joined

  • Last visited

AhmedMostafa50's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Yes I know it But I'm in a partner with advertising company Among its conditions visit page/24 hours
  2. I would like to limit the access of a function i've created to once every 24 hour based on the users IP address. I would also like the PHP script to delete the MySQL record if it's older than 24 hours. If the user already has used the function within 24 hours, show them a message and prevent the script from continue running. If the user already has used the function but 24 hours has passed since he used the function, delete the MySQL record and let the script continue running. <?php $ip = $_SERVER['REMOTE_ADDR']; $con=mysqli_connect("domain.com.mysql","domain_com","domain_password","domain_database"); $result = mysqli_query($con,"SELECT * FROM ipblock WHERE ip='".$ip."'"); while($row = mysqli_fetch_array($result)); if($ip == $row['ip']) //and code for checking how old the record is { // The user has used the function within 24 hours, kill the script. echo "Come back in 24 hours"; exit; } else { // Looks clear, let them use the function $MyFunction = true; } ?> I'm lost and as you can see i am also missing some statements for deleting old records (-24 hours).. Could anyone provide me with an example of how to do this? Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.