Commit | Line | Data |
---|---|---|
8de51304 H |
1 | <?php\r |
2 | $start = 0;\r | |
3 | $stop = 99;\r | |
4 | $length = strlen($stop);\r | |
5 | $base = 10;\r | |
6 | \r | |
7 | //Banner\r | |
8 | //echo("Please wait, while computing...\n\n");\r | |
9 | \r | |
10 | //init\r | |
11 | srand(time());\r | |
12 | $rada = "";\r | |
13 | $notfoundlast = -3;\r | |
14 | $error = 1;\r | |
15 | $origstop = $stop;\r | |
16 | \r | |
17 | while($error) {\r | |
18 | \r | |
19 | $stop = $origstop+rand(0,10);\r | |
20 | \r | |
21 | for($i=$start;$i<=$stop;$i++) {\r | |
22 | $bi = $i;\r | |
23 | $i = base_convert($i, 10, $base);\r | |
24 | if(strpos($rada, $i) == 0) {\r | |
25 | \r | |
26 | if( $i[0] == $rada[strlen($rada)-1] ) {\r | |
27 | $i = substr($i, 1);\r | |
28 | $rada = $rada.$i;\r | |
29 | } elseif( $rada[0] == $i[strlen($i)-1] ) { \r | |
30 | $rada = substr($rada, 1);\r | |
31 | $rada = $i.$rada;\r | |
32 | } else {\r | |
33 | if(rand(0,1)) { \r | |
34 | $rada = $i.$rada;\r | |
35 | } else {\r | |
36 | $rada = $rada.$i;\r | |
37 | }\r | |
38 | }\r | |
39 | \r | |
40 | //echo($i);\r | |
41 | $i = $bi;\r | |
42 | }\r | |
43 | }\r | |
44 | \r | |
45 | for($i=0;$i<(strlen($rada)-$length);$i++) {\r | |
46 | $sub = substr($rada, $i, $length);\r | |
47 | for($x=0;$x<$length;$x++) {\r | |
48 | $rada[($i+$x)] = "R";\r | |
49 | \r | |
50 | }\r | |
51 | $rada = str_replace($sub, "", $rada);\r | |
52 | \r | |
53 | $replace="";\r | |
54 | for($x=0;$x<$length;$x++) {\r | |
55 | $replace = $replace."R";\r | |
56 | }\r | |
57 | \r | |
58 | $rada = str_replace($replace, $sub, $rada);\r | |
59 | }\r | |
60 | \r | |
61 | //echo($rada);\r | |
62 | \r | |
63 | //Test\r | |
64 | //echo("\n\n");\r | |
65 | $error = 0;\r | |
66 | $notfound = 0;\r | |
67 | for($i=$start;$i<=$stop;$i++) {\r | |
68 | $bi = $i;\r | |
69 | $i = base_convert($i, 10, $base);\r | |
70 | if(!eregi($i, $rada)) {\r | |
71 | //echo("Not found: $i\n");\r | |
72 | \r | |
73 | if( $i[0] == $rada[strlen($rada)-1] ) {\r | |
74 | $i = substr($i, 1);\r | |
75 | $rada = $rada.$i;\r | |
76 | } elseif( $rada[0] == $i[strlen($i)-1] ) { \r | |
77 | $rada = substr($rada, 1);\r | |
78 | $rada = $i.$rada;\r | |
79 | } else {\r | |
80 | if(rand(0,1)) { \r | |
81 | $rada = $i.$rada;\r | |
82 | } else {\r | |
83 | $rada = $rada.$i;\r | |
84 | }\r | |
85 | }\r | |
86 | \r | |
87 | $error = 1;\r | |
88 | $notfound++;\r | |
89 | }\r | |
90 | $i = $bi;\r | |
91 | }\r | |
92 | //echo("Total not found: $notfound\n");\r | |
93 | if($notfoundlast == $notfound) { $error = 0; }\r | |
94 | $notfoundlast = $notfound;\r | |
95 | \r | |
96 | }\r | |
97 | \r | |
98 | for($i=$start;$i<=$stop;$i++) {\r | |
99 | if(!eregi($i, $rada)) {\r | |
100 | $rada = $rada.$i;\r | |
101 | }\r | |
102 | }\r | |
103 | \r | |
104 | echo("\n\n");\r | |
105 | echo($rada);\r | |
106 | //system("pause");\r | |
107 | \r | |
108 | /*\r | |
109 | 0-99:8970684924807965464133322998867361605944383525181110958785777637155047403128219391753027262000142345666906\r | |
110 | :9084787636241342213919946403730181714887749279538935855325108368660504433128211675657061524298202326454759697280\r | |
111 | :9594403292141101847565345422718137390898872605749946682585030241916233631528355170969780912038434861646767793100\r | |
112 | */\r |