Skip to content
This repository has been archived by the owner on Dec 16, 2020. It is now read-only.

Commit

Permalink
Fixes #141
Browse files Browse the repository at this point in the history
  • Loading branch information
mgp25 committed Jul 22, 2015
1 parent 2ccff72 commit 212043f
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/snapchat.php
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ public function login($password, $force = FALSE)
return $auth;
}
parent::setGAuth($auth);
$attestation = $this->getAttestation($password, $timestamp);
$attestation = $this->getAttestation($password, $timestamp);

$result = parent::post(
'/loq/login',
Expand Down Expand Up @@ -477,13 +477,30 @@ public function logout()
public function register($username, $password, $email, $birthday, $phone_verification = FALSE, $phone_number = NULL)
{
$timestamp = parent::timestamp();

$dtoken = $this->getDeviceToken();

if($dtoken['error'] == 1)
{
$return['message'] = "Failed to get new Device token set.";
return $return;
}

$attestation = $this->getAttestation($password, $timestamp);

$birthDate = explode("-", $birthday);
$age = (date("md", date("U", mktime(0, 0, 0, $birthDate[0], $birthDate[1], $birthDate[2]))) > date("md") ? ((date("Y") - $birthDate[2]) - 1) : (date("Y") - $birthDate[2]));
$result = parent::post(
'/loq/register',
array(
'age' => $age,
'dsig' => substr(hash_hmac('sha256', $string, $dtoken['data']->dtoken1v), 0, 20),
'dtoken1i' => $dtoken['data']->dtoken1i,
'birthday' => $birthday,
'password' => $password,
'email' => $email,
'timestamp' => $timestamp,
'attestation' => $attestation
),
array(
parent::STATIC_TOKEN,
Expand Down

0 comments on commit 212043f

Please sign in to comment.