Guest User

Untitled

a guest
Jul 22nd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. <?
  2. $f2=fopen("list2.txt", "r");
  3. $subs2=Array();
  4.  
  5. $summary2=0;
  6.  
  7. $f=fopen("list.txt", "r");
  8. $subs=Array();
  9.  
  10. $summary=0;
  11. echo "<table border=1>";
  12.  
  13. while(!FEOF($f2))
  14. {
  15. $link2=fgets($f2,10000);
  16. $cat2=explode(".", $link2);
  17. $category2=$cat2[0];
  18. $type="";
  19. //if(strpos($link2, "model"))
  20. //{
  21. // $type2="model";
  22. // }
  23. // elseif(strpos($link2, "brand"))
  24. // {
  25. // $type2="brand";
  26. // }
  27. // elseif(strpos($link2, "tag"))
  28. // {
  29. // $type2="tag";
  30. // }
  31. // else
  32. // {
  33. $type2="category";
  34. // }
  35.  
  36. if(!$subs2[$category2])
  37. $subs2[$category2]=Array($type2=>1);
  38. elseif(!$subs2[$category2][$type2])
  39. $subs2[$category2][$type2]=1;
  40. else
  41. $subs2[$category2][$type2]++;
  42.  
  43. $summary2++;
  44. }
  45.  
  46. while(!FEOF($f))
  47. {
  48. $link=fgets($f,10000);
  49. $cat=explode(".", $link);
  50. $category=$cat[0];
  51. $type="";
  52. //if(strpos($link, "model"))
  53. //{
  54. // $type="model";
  55. //}
  56. //elseif(strpos($link, "brand"))
  57. //{
  58. // $type="brand";
  59. //}
  60. //elseif(strpos($link, "tag"))
  61. //{
  62. // $type="tag";
  63. //}
  64. //else
  65. //{
  66. $type="category";
  67. //}
  68.  
  69. if(!$subs[$category])
  70. $subs[$category]=Array($type=>1);
  71. elseif(!$subs[$category][$type])
  72. $subs[$category][$type]=1;
  73. else
  74. $subs[$category][$type]++;
  75.  
  76. //echo "<tr><td>$link</td><td>".$cat[0]."</td><td>$type</td></tr>";
  77. $summary++;
  78. }
  79. echo "</table><table border=1>";
  80.  
  81. $summary3 = $summary2 + $summary;
  82.  
  83. echo "<h2>Summary: $summary3 links</h2>";
  84. //var_dump($subs2);
  85. $N=1;
  86. foreach($subs as $a=>$b)
  87. {
  88. $catall = $subs2[trim($a)]["category"] + $b["category"];
  89. $proc = round($subs2[trim($a)]["category"]/$catall*100);
  90. // echo "<tr><td>".$a."</td><td>".$b["model"]."</td><td>".$b["brand"]."</td><td>".$b["tag"]."</td><td>".$b["category"]."</td></tr>";
  91. echo "<tr><td>".$a."1</td><td>".$catall."</td><tr><td>".$a."2</td><td>".$subs2[trim($a)]["category"]."</td></tr><tr><td>".$a."3</td><td>".$b["category"]."</td></tr><tr><td>".$a."4</td><td>".$proc."%</td></tr></tr>";
  92. $N=1;
  93. }
  94. ?>
Add Comment
Please, Sign In to add comment