emotrend

Activation keys

Jan 4th, 2019
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. <?php
  2.  
  3. $input = explode("&", readline());
  4. $pattern = '/[A-Za-z0-9]{16,24}/';
  5.  
  6. $keys = [];
  7. $tempStr = "";
  8. for ($i = 0; $i < count($input);$i++){
  9. if (preg_match($pattern, $input[$i])) {
  10. for ($j = 0; $j < strlen($input[$i]);$j++){
  11. if (strlen($input[$i]) === 16) {
  12. $tempStr .= "-" . substr($input[$i], $j, 4);
  13. $j = $j + 4 - 1;
  14. } else if (strlen($input[$i]) === 25) {
  15. $tempStr .= "-" . substr($input[$i], $j, 5);
  16. $j = $j + 5 - 1;
  17. }
  18. }
  19. $tempStr = ltrim($tempStr, "-");
  20. for ($n = 0; $n < strlen($tempStr);$n++) {
  21. if (ctype_digit($tempStr[$n])) {
  22. $tempStr[$n] = 9 - $tempStr[$n];
  23. }
  24. }
  25. $tempStr = strtoupper($tempStr);
  26. $keys[] = $tempStr;
  27. $tempStr = "";
  28. }
  29. }
  30. echo implode(", ", $keys);
Advertisement
Add Comment
Please, Sign In to add comment