Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- try {
- $host = "localhost";
- $dbname = "development";
- $user = "root";
- $pass = "ascent";
- # MySQL with PDO_MYSQL
- $LOC_DB = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
- }
- catch(PDOException $e) {
- echo $e->getMessage();
- }
- function identical_values( $arrayA , $arrayB ) {
- sort( $arrayA );
- sort( $arrayB );
- return $arrayA == $arrayB;
- }
- $phase = $_GET['phase'];
- /*
- | 1 | 169 |
- | 2 | 170 |
- | 4 | 171 |
- | 8 | 172 |
- | 16 | 173 |
- | 32 | 174 |
- | 64 | 175 |
- | 128 | 176 |
- | 256 | 177 |
- | 512 | 178 |
- | 1024 | 179 |
- | 2048 | 180 |
- | 4096 | 181 |
- | 8192 | 182 |
- | 16384 | 183 |
- | 32768 | 184 |
- */
- for ($x = 0; $x <= 32; $x++) {
- $phase_mask[$x]['real_id'] = 169+$x;
- $phase_mask[$x]['phase_id'] = pow(2,$x);
- }
- // var_dump($phase_mask);
- for ($x = 0; $x <= 32; $x++) {
- if($phase & $phase_mask[$x]['phase_id'])
- {
- $phase_group_array[$x] = $phase_mask[$x]['real_id'];
- }
- }
- $arraysize = sizeof($phase_group_array);
- if($arraysize==1)
- {
- var_dump($phase_group_array);
- exit;
- }
- for ($x = 367; $x <= 890; $x++) {
- $res2 = $LOC_DB->prepare("SELECT `phase` FROM `dbc_phasexphasegroup` WHERE `group` = :group");
- $res2->bindValue(':group', $x, PDO::PARAM_INT);
- $res2->execute();
- if ($res2->rowCount() > 0) //Van Result
- {
- $j = 0;
- unset($possible_group_array);
- while ($result_row = $res2->fetch())
- {
- $possible_group_array[$j] = $result_row['phase'];
- $j++;
- }
- if(identical_values($possible_group_array,$phase_group_array))
- {
- echo "Phase Group: ".$x." ";
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement