Created
August 17, 2014 10:38
-
-
Save allinora/054787ce5e7da459ea45 to your computer and use it in GitHub Desktop.
example for brian
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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($currentIser, 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($currentIser, true) . "</pre>"; | |
exit; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The above requires the following changes :
Line:
if (isset($_SESSION['parseData'])){
Line 25:
";print "Current user is
Line 50:
";print "New user is