IMEI sum Check PHP

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    IMEI sum Check PHP

    Just needs to be fixed and it will work with some networks....

    PHP Code:
    <?
    //Grabs the IMEI
    $imei = $_REQUEST["imei"];

    //Loops all the Odd IMEI numbers, then times it by 2
    for( $i = 0 ; $i<14 ; $i++ ) {
        $imei1 = $imei{$i}*2;
    //THIS is where the main error is. It always shows up as Zero.
        $imei1a = $imei1a + $imei1{0} + $imei1{1}); 
    }
    //Another Loop, For even numbers
    for( $i = 1; $i<14; $i++) {
        $imei2 = $imei{$i}*1;
        $imei2a = $imei2 + $imei2a;
    }

    //Adds the Results together.
    $imei3 = $imei2a + $imei1a;

    //If the Remainder is 0 the sum check equals zero
    if($imei3 % 10 == 0) {
     $sum == 0;
     }
    //Otherwise:
         else {
        $sum == 10 - $imei3 % 10; 
        }
        //Validation stage - Finds if valid or not
    if($imei3 % 10 != $sum) {
        echo 'Invalid';
        } else {
            echo 'Valid!';
            }
        
    ?>
    find this

    PHP Code:
    for( $i $i<14 $i++ ) 
    {    
    $imei1a[$i] = $imei[$i]*2;    } 
    BakGat
    Code:
    class Counter {
    public:
      void Count();
      int  ReadDisplay();
    private:
      int  CurrentCount;
    };








    Back up my hard drive? How do I put it in reverse?
    My Community
    BakGat
    sigpic

    #2
    How u r going to obtain there imei nos?

    Comment


      #3
      Its to validate.... read before you post.....
      BakGat
      Code:
      class Counter {
      public:
        void Count();
        int  ReadDisplay();
      private:
        int  CurrentCount;
      };








      Back up my hard drive? How do I put it in reverse?
      My Community
      BakGat
      sigpic

      Comment


        #4
        Originally posted by bOrN2pwn View Post
        Its to validate.... read before you post.....
        then how it depends on network?
        Follow me @ksg91 | My Blog: http://ksg91.com | Nokia Blog: http://NokiaTips.in

        Comment


          #5
          Originally posted by bOrN2pwn View Post
          Just needs to be fixed and it will work with some networks....

          PHP Code:
          <?
          //Grabs the IMEI
          $imei = $_REQUEST["imei"];

          //Loops all the Odd IMEI numbers, then times it by 2
          for( $i = 0 ; $i<14 ; $i++ ) {
              $imei1 = $imei{$i}*2;
          //THIS is where the main error is. It always shows up as Zero.
              $imei1a = $imei1a + $imei1{0} + $imei1{1}); 
          }
          //Another Loop, For even numbers
          for( $i = 1; $i<14; $i++) {
              $imei2 = $imei{$i}*1;
              $imei2a = $imei2 + $imei2a;
          }

          //Adds the Results together.
          $imei3 = $imei2a + $imei1a;

          //If the Remainder is 0 the sum check equals zero
          if($imei3 % 10 == 0) {
           $sum == 0;
           }
          //Otherwise:
               else {
              $sum == 10 - $imei3 % 10; 
              }
              //Validation stage - Finds if valid or not
          if($imei3 % 10 != $sum) {
              echo 'Invalid';
              } else {
                  echo 'Valid!';
                  }
              
          ?>
          find this

          PHP Code:
          for( $i $i<14 $i++ ) 
          {    
          $imei1a[$i] = $imei[$i]*2;    } 


          i first saw it here IMEI sum Check PHP - Nokia Flash Reverse Electronic Engineering. looks nice.
          Last edited by bogart; 16.04.10, 03:10.

          Comment


            #6
            lol bogart good reply ;)
            www.inbuzunar.mobi - Your mobile portal pocket

            Comment


              #7
              Is this any good?

              It seems to work for me but is probably doing everything the hardest way ever..

              Code:
              function checkImei($imei) {
              	$i = 0;
              	$total = 0;
              	
              	$imei = strval($imei);
              	
              	while ($i < 14) {
              		$digit = intval($imei[$i]);
              		
              		if ($i == 1 || $i == 3 || $i == 5 || $i == 7 || $i == 9 || $i == 11 || $i == 13) {
              			$num = $digit * 2;
              			$num = strval($num);
              			
              			if ($num > 9) {
              				$digit1 = intval($num[0]);
              				$digit2 = intval($num[1]);
              				
              				$new_num = $digit1 + $digit2;
              				
              			} else {
              				$new_num = $num;
              			}
              		} else {
              			$new_num = $digit;
              		}
              		$total = $total + $new_num;
              	
              		$i++;
              	}
              	$tens = $total / 10;
              	$int = intval($tens);
              
              	$checksum = 10 - ($total - ($int * 10));
              	
              	$result = strval(substr($imei,0,14)).strval($checksum);
              
              	if ($imei == $result) {
              		return true;
              	} else {
              		return false;
              	}
              }
              Also only works for 15 digit IMEI not IMEISV which, from what I have looked at, you just have to accept as a random bunch of number 16 characters long.

              Comment


                #8
                Originally posted by godsmurf View Post
                Is this any good?

                It seems to work for me but is probably doing everything the hardest way ever..

                Code:
                function checkImei($imei) {
                $i = 0;
                $total = 0;
                
                $imei = strval($imei);
                
                while ($i < 14) {
                $digit = intval($imei[$i]);
                
                if ($i == 1 || $i == 3 || $i == 5 || $i == 7 || $i == 9 || $i == 11 || $i == 13) {
                $num = $digit * 2;
                $num = strval($num);
                
                if ($num > 9) {
                $digit1 = intval($num[0]);
                $digit2 = intval($num[1]);
                
                $new_num = $digit1 + $digit2;
                
                } else {
                $new_num = $num;
                }
                } else {
                $new_num = $digit;
                }
                $total = $total + $new_num;
                
                $i++;
                }
                $tens = $total / 10;
                $int = intval($tens);
                
                $checksum = 10 - ($total - ($int * 10));
                
                $result = strval(substr($imei,0,14)).strval($checksum);
                
                if ($imei == $result) {
                return true;
                } else {
                return false;
                }
                }
                Also only works for 15 digit IMEI not IMEISV which, from what I have looked at, you just have to accept as a random bunch of number 16 characters long.
                IMEI contain ONLY 15 digits...
                so as far as that concerne.. it's fine...
                other than that code is useless...
                you can obtain IMEI, only from unsecured networks... that suck..
                It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt.
                ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ !
                ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.
                キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

                Comment

                Working...
                X