Example #1
0
 /**
  *  POSTのユニークチェックを行う
  *
  *  @access public
  *  @return bool    true:2回目以降のPOST false:1回目のPOST
  */
 public static function isDuplicatePost()
 {
     // use raw post data
     if (isset($_POST['uniqid'])) {
         $uniqid = $_POST['uniqid'];
     } else {
         if (isset($_GET['uniqid'])) {
             $uniqid = $_GET['uniqid'];
         } else {
             return false;
         }
     }
     // purge old files
     Ethna_Util::purgeTmp("uniqid_", 60 * 60 * 1);
     $container = Ethna_Container::getInstance();
     $filename = sprintf("%s/uniqid_%s_%s", $container->getDirectory('tmp'), $_SERVER['REMOTE_ADDR'], $uniqid);
     if (file_exists($filename) == false) {
         touch($filename);
         return false;
     }
     $st = stat($filename);
     if ($st[9] + 60 * 60 * 1 < time()) {
         // too old
         return false;
     }
     return true;
 }
Example #2
0
 function isDuplicatePost()
 {
     if (!isset($_POST['uniqid'])) {
         return false;
     }
     Ethna_Util::purgeTmp('uniqid_', $this->config->get('repost_interval'));
     $c =& Ethna_Controller::getInstance();
     $filename = sprintf('%s/uniqid_%s_%s', $c->getDirectory('tmp'), $_SERVER['REMOTE_ADDR'], $_POST['uniqid']);
     if (!is_file($filename)) {
         touch($filename);
         return false;
     }
     return true;
 }