Skip to content

Instantly share code, notes, and snippets.

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