Simple upload filter script for Article 13 of EU copyright reform
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.5 KiB

  1. <?php
  2. $CONFIG = array();
  3. $CONFIG['sqliteFile'] = 'uploadfilter.sqlite3';
  4. $CONFIG['fileDir'] = '/tmp';
  5. $CONFIG['validationCount'] = 1;
  6. $CONFIG['emailTemplate'] = './email.template';
  7. $db = new PDO('sqlite:' . $CONFIG['sqliteFile']);
  8. $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  9. $db->exec("CREATE TABLE IF NOT EXISTS files (
  10. id INTEGER PRIMARY KEY,
  11. filePath TEXT,
  12. fileHash TEXT)");
  13. $db->exec("CREATE TABLE IF NOT EXISTS emails (
  14. id INTEGER PRIMARY KEY,
  15. email TEXT,
  16. firstName TEXT,
  17. lastName TEXT,
  18. UNIQUE(email))");
  19. $db->exec("CREATE TABLE IF NOT EXISTS validations (
  20. id INTEGER PRIMARY KEY,
  21. fileId INTEGER,
  22. email TEXT,
  23. token TEXT,
  24. validated BOOLEAN,
  25. FOREIGN KEY(fileId) REFERENCES files(id),
  26. FOREIGN KEY(email) REFERENCES emails(email))");
  27. /*
  28. // demo emails!
  29. $query = $db->prepare("INSERT INTO emails (email,firstName,lastName) VALUES (:email,:firstName,:lastName);");
  30. $query->execute(array(':email' => 'upload-filter1@example.com', ':firstName' => 'Firstname1', ':lastName' => 'Lastname1'));
  31. $query->execute(array(':email' => 'upload-filter2@example.com', ':firstName' => 'Firstname2', ':lastName' => 'Lastname2'));
  32. $query->execute(array(':email' => 'upload-filter3@example.com', ':firstName' => 'Firstname3', ':lastName' => 'Lastname3'));
  33. $query->execute(array(':email' => 'upload-filter4@example.com', ':firstName' => 'Firstname4', ':lastName' => 'Lastname4'));
  34. $query->execute(array(':email' => 'upload-filter5@example.com', ':firstName' => 'Firstname5', ':lastName' => 'Lastname5'));
  35. */