1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-30 06:18:58 +01:00
* * Changes for use .env file and not a php with sensible data

* * Changes for use .env file and not a php with sensible data

* * Changes for use .env file and not a php with sensible data

* * Changes for use .env file and not a php with sensible data

* Changes for use .env files
* Moving $settings to .env file

* Update testing.php

syntax

* Update testing.php
This commit is contained in:
Vitor Mattos 2017-01-17 11:29:37 -02:00 committed by Daniil Gentili
parent 64afc0290b
commit bc97fff5e7
3 changed files with 9 additions and 6 deletions

View File

@ -1 +1,2 @@
NUMBER=+5521999596772
MTPROTO_NUMBER=+123456789
MTPROTO_SETTINGS=[]

1
.gitignore vendored
View File

@ -72,7 +72,6 @@ target/
*.swp
vendor
*bak
number.php
token.php
*~uploading*
session.mad

View File

@ -12,25 +12,28 @@ If not, see <http://www.gnu.org/licenses/>.
*/
require_once 'vendor/autoload.php';
$settings = [];
if (file_exists('web_data.php')) {
require_once 'web_data.php';
}
$MadelineProto = \danog\MadelineProto\Serialization::deserialize('session.madeline');
if (file_exists('number.php') && $MadelineProto === false) {
if (file_exists('.env')) {
$dotenv = new Dotenv\Dotenv(__DIR__);
$dotenv->load();
}
$settings = json_decode(getenv('MTPROTO_SETTINGS'), true) ?: [];
if ($MadelineProto === false) {
$MadelineProto = new \danog\MadelineProto\API($settings);
$checkedPhone = $MadelineProto->auth->checkPhone(// auth.checkPhone becomes auth->checkPhone
[
'phone_number' => getenv('NUMBER'),
'phone_number' => getenv('MTPROTO_NUMBER'),
]
);
\danog\MadelineProto\Logger::log($checkedPhone);
$sentCode = $MadelineProto->phone_login(getenv('NUMBER'));
$sentCode = $MadelineProto->phone_login(getenv('MTPROTO_NUMBER'));
\danog\MadelineProto\Logger::log($sentCode);
echo 'Enter the code you received: ';
$code = fgets(STDIN, (isset($sentCode['type']['length']) ? $sentCode['type']['length'] : 5) + 1);