Windows PHP Bulk Build packaged Android program apk-Channel txt implant apk file

Source: Internet
Author: User
Tags windows download ziparchive

Server Installation PHP Environment

Download Android-sdk-windows Download JDK

1. Open the ZIP support C:/windows/php.ini and open the exec

2.APK Support
MIME Add. apk application/vnd.android.package-archive

3. Install JAVASDK (to be consistent with Android's edit version)

4. Edit IIS Bind permissions (www:www), directory does not have permissions to cause build to fail

5. Configure two virtual hosts

a:down.coolaj.cn for download

B:make.cookaj.cn used to make a signature

6. Down index.php

<?PHP/** Created on 2012-5-21 * coolaj.cn*///Var_dump ($id);functionCocode () {foreach($_get  as $k=$v){        $id=$k;  Break; }     if($_get[' U ']){        $id=$_get[' U ']; }    if(Is_numeric($id)){        return $id; }ElseIf($id&&Preg_match('/^u/',$id)) {            $id=Base64_decode(substr($id, 1). ' = ') >>2; return $id; }}$id=Cocode ();if(file_exists(' Bbshenqi '.$id.". APK ") | |Empty($id)){    if(Empty($id)){        Header(' location:http://www.coolaj.cn/bbshenqi.apk '); Exit; }    Header(' Location:http://down.coolaj.cn/bbshenqi '.$id.‘. apk);}Else{    $CC=file_get_contents("Http://make.coolaj.cn/makeapk.php?apkname=".$id.‘ &r= Simple Encryption '); if($CC= = ' OK '){        if(file_exists(' Bbshenqi '.$id.". apk)){            Echo' <meta http-equiv= ' Content-type "content=" text/html; CHARSET=GBK "/>"; Echo' <a href= ' Http://down.coolaj.cn/bbshenqi '.$id.‘. APK "> Build failed, click Retry </a>"; Exit; }        Header(' Location:http://down.coolaj.cn/bbshenqi '.$id.‘. apk); } }?>

 

7.makeapk.php

<?PHPSet_time_limit(0);functionZip$dir,$filename,$missfile=Array(),$addfromString=Array()){    if(!file_exists($dir) || !Is_dir($dir)){         die(' Can not exists dir '.$dir); }    if(Strtolower(End(Explode(‘.‘,$filename))! = ' Zip '){         die(' Only support zip files '); }    $dir=Str_replace(‘\\‘,‘/‘,$dir); $filename=Str_replace(‘\\‘,‘/‘,$filename); if(file_exists($filename)){         die(' The zip file '.$filename. ' has exists! '); }    $files=Array(); GetFiles ($dir,$files); if(Empty($files)){         die(' The Dir is empty '); }    $zip=Newziparchive; $res=$zip->open ($filename, Ziparchive::CREATE); if($res===TRUE) {        foreach($files  as $v){            if(!In_array(Str_replace($dir.‘ /‘,‘‘,$v),$missfile)){                $zip->addfile ($v,Str_replace($dir.‘ /‘,‘‘,$v)); //$zip->addfile ($v, Str_replace ($dir. '/', './', $v));            }        }        if(!Empty($addfromString)){            foreach($addfromString  as $v){                $zip->addfromstring ($v[0],$v[1]); }        }        $zip-Close (); //Echo ' unsigin apk ok!<br> ';}Else {        Echo' Failed '; }}functionGetFiles$dir,&$files=Array()){    if(!file_exists($dir) || !Is_dir($dir)){return;} if(substr($dir,-1) = = '/'){        $dir=substr($dir, 0,strlen($dir)-1); }    $_files=Scandir($dir); foreach($_files  as $v){        if($v! = '. ' &&$v! = ' ... '){            if(Is_dir($dir.‘ /‘.$v) {GetFiles ($dir.‘ /‘.$v,$files); }Else{                $files[] =$dir.‘ /‘.$v; }        }    }    return $files;}functionFile_content_replace ($filename,$search,$replace){    $string=file_get_contents($filename); $new _string=Str_replace($search,$replace,$string); if($string!=$new _string)file_put_contents($filename,$new _string);}functionGOAPK ($file){    exec("Del bbshenqi.zip"); exec("Del bbshenqi.apk"); exec("Del Gosign.bat"); exec("Del D:\android\apk\bbshenqi\assets\unionid.txt"); exec("Copy/y demo.bat gosign.bat"); File_content_replace ("Gosign.bat", "00000.apk",$file.‘. apk); exec(' Echo '.$file.‘ >d:\android\apk\bbshenqi\assets\unionid.txt '); Zip ("Bbshenqi", "Bbshenqi.zip"); exec("Copy/y bbshenqi.zip bbshenqi.apk"); exec("Gosign.bat");}if($_get[' Apkname ']){    $name=$_get[' Apkname ']; $r=$_get[' R ']; if($r= = ' Yourpass ') {goapk ($name); Echo' OK '; }}Exit;?>

8.demo.bat

Key key.  "D:\android\android-sdk-windows\tools\zipalign"-V 4 bbshenqi_signed.apk d:\apk\bbshenqi00000. Apkdel bbshenqi_signed. Apkdel Bbshenqiapk

Windows PHP Bulk Build packaged Android program apk-Channel txt implant apk file

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.