title: a simple way to expire an activation link in php?
body: <p>just need a simple way to expire an activation link which is sent to the users on my site via email. currently the date that users registered stored in mysql database.
  the link that's sent in the email is like this: /activation.php?id=20</p>
  
  <p>this is my activation</p>
  
  <pre><code>    &lt;? 
  include_once "scripts/connect_to_mysql.php";
  // Get the member id from the URL variable
  $id = $_REQUEST['id'];
  $id = ereg_replace("[^0-9]", "", $id); // filter everything but numbers for security
  if (!$id) {
      echo "Missing Data to Run";
      exit(); 
  }
  // Update the database field named 'email_activated' to 1
  $sql = mysql_query("UPDATE members SET emailactivated='1' WHERE id='$id'"); 
  // Check the database to see if all is right now 
  $sql_doublecheck = mysql_query("SELECT * FROM members WHERE id='$id' AND emailactivated='1'"); 
  $doublecheck = mysql_num_rows($sql_doublecheck); 
  if($doublecheck == 0){ 
  // Print message to the browser saying we could not activate them
  print "&lt;br /&gt;&lt;br /&gt;&lt;div align=\"center\"&gt;&lt;h3&gt;&lt;strong&gt;&lt;font color=red&gt;Your account could not be activated!&lt;/font&gt;&lt;/strong&gt;&lt;h3&gt;&lt;br /&gt;&lt;/div&gt;"; 
  } elseif ($doublecheck &gt; 0) {
  // Print a success message to the browser cuz all is good 
  // And supply the user with a link to your log in page, please alter that link line 
  print "&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;&lt;font color=\"#0066CC\"&gt;&lt;strong&gt;Your account has been activated!&lt;br /&gt;&lt;br /&gt;
  &lt;/strong&gt;&lt;/font&gt;&lt;a href=\"\"&gt;Click Here&lt;/a&gt; to log in now.&lt;/h3&gt;"; 
  } 
  ?&gt;
  </code></pre>