Skip to content

Instantly share code, notes, and snippets.

@appsird
Forked from allinora/index.php
Last active August 29, 2015 14:05
Show Gist options
  • Save appsird/b6c8d4dbb68c02dd6c15 to your computer and use it in GitHub Desktop.
Save appsird/b6c8d4dbb68c02dd6c15 to your computer and use it in GitHub Desktop.
<?php
date_default_timezone_set("UTC");
require_once(__DIR__ . "/config.php"); // This defines PARSE_APP_ID, PARSE_REST_KEY, PARSE_MASTER_KEY
require 'vendor/autoload.php';
use Parse\ParseClient;
use Parse\ParseObject;
use Parse\ParseQuery;
use Parse\ParseACL;
use Parse\ParsePush;
use Parse\ParseUser;
use Parse\ParseInstallation;
use Parse\ParseException;
use Parse\ParseAnalytics;
use Parse\ParseFile;
use Parse\ParseCloud;
session_start();
if (isset($_SESSION['parseData']))
{ $currentUser = ParseUser::getCurrentUser();
print "Current user is <pre>" . print_r($currentUser, true) . "</pre>";
exit;
}
ParseClient::initialize(PARSE_APP_ID, PARSE_REST_KEY, PARSE_MASTER_KEY);
$username = substr(md5(rand()), 0, 7);
$password = 'test01pw';
print "Creating user account with : $username<br>\n";
$user = new ParseUser();
$user->setUsername($username);
$user->setPassword($password);
try {
$user->signUp();
} catch (ParseException $ex) {
die("Exception: " . $ex->getMessage());
}
$currentUser = ParseUser::getCurrentUser();
print "New user is <pre>" . print_r($currentUser, true) . "</pre>";
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment