Advertisement
Guest User

Untitled

a guest
Aug 31st, 2015
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. <?php
  2. $ori = file_get_contents("./ori.org");
  3. $new = "";
  4. $ori = chunk_split(bin2hex($ori), 2, " ");
  5.  
  6.  
  7. $expl_file = explode(" ", $ori);
  8. foreach($expl_file as $value) {
  9.  
  10. $val = chr(hexdec($value));
  11. if (!preg_match("/[^0-9a-zA-Z ]/", $val)) {
  12. $new .= chr(hexdec($value));
  13. }
  14.  
  15. }
  16. //echo $new; exit();
  17.  
  18. // # let the party start.... search for ecu infos
  19.  
  20. $found = false;
  21. $found_type = "";
  22.  
  23. $edc15_boschhw = "";
  24. $edc15_swnr = "";
  25. $edc15_swvs = "";
  26. $edc15_vwnr = "";
  27.  
  28. // BOSCH EDC15 ?
  29. preg_match_all("/0281(.*?) /", $new, $search0281);
  30.  
  31. if (isset($search0281[1][0]) and strlen($search0281[1][0])==6) {
  32. // IT'S EDC15
  33. $found = true; $found_type = "Bosch EDC";
  34. $edc15_error = false;
  35. $edc15_boschhw = "0281".$search0281[1][0];
  36.  
  37. // GET SOFTWARE NR
  38. preg_match_all("/1037(.*?) /", $new, $search1037);
  39. if (isset($search1037[1][0])) {
  40. $edc15_swnr = substr($search1037[1][0], 0, 6);
  41. if (is_numeric($edc15_swnr)) {
  42. $edc15_swnr = "1037".$edc15_swnr;
  43. }
  44.  
  45. }
  46.  
  47. // GET VW NUMBER
  48. if ($found) {
  49. preg_match_all("/03(.*?) /", $new, $searchVWNR);
  50. foreach($searchVWNR[1] as $val) {
  51. if (strlen($val)==9 and !is_numeric(substr($val, -2))) {
  52. $edc15_vwnr = "03".$val;
  53. }
  54. }
  55. }
  56.  
  57. }
  58.  
  59. if ($found) {
  60. echo "ECU-Type: <strong>".$found_type."</strong><br />";
  61. echo "Bosch-Number: ".$edc15_boschhw."<br />";
  62. echo "Software-Number: ".$edc15_swnr."<br />";
  63. echo "VW Part Number: ".$edc15_vwnr."<br />";
  64. }
  65.  
  66. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement