Skip to content

Instantly share code, notes, and snippets.

@matheusgimenez
Created March 11, 2014 00:00
Show Gist options
  • Save matheusgimenez/9476995 to your computer and use it in GitHub Desktop.
Save matheusgimenez/9476995 to your computer and use it in GitHub Desktop.
<?php
require("../../../initdata.php");
include("sdk/mta_sdk.php");
require("ipsRegistry.php");
ipsRegistry::init();
$acao = $_GET['acao'];
if ($acao == "registro") {
$member = IPSMember::load( $email, 'none', 'email' );
if ( !$member['member_id'] )
{
echo "false";
}
else{
$input = mta::getInput(); // $input[0] is username, $input[1] is password, $input[2] is e-mail
mta::doReturn($input[0]);
//$passSalt = IPSMember::generatePasswordSalt(5);
//$passCompiled = IPSMember::generateCompiledPasshash($passSalt, md5($input[1]));
$user = IPSMember::create(array('core' => array('email' => $input[2], 'password' => $input[1], 'name' => $input[0], 'members_display_name' => $input[0])));
}
}
if ($acao == "login"){
$input = mta::getInput();
mta::doReturn($input[0]);
$member = IPSMember::load( $input[0], 'none', 'email' );
if ( !$member['member_id'] )
{
echo "false";
exit;
}
if ( IPSMember::authenticateMember( $member['member_id'], $input[1] ) )
{
echo "true";
}
else
{
echo "false";
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment