Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. <?php
  2. /* * * * *
  3. * JoomLogin For Unity3D
  4. * ------------------------------
  5. * Developed by Víctor Gil Uría © Brainmedia.es 2013
  6. * Just upload this file to your joomla root folder
  7. * * * * */
  8.  
  9. define( '_JEXEC', 1 );
  10. define( 'JPATH_BASE', realpath(dirname(__FILE__)));
  11. define( 'DS', DIRECTORY_SEPARATOR );
  12. require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
  13. require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
  14. $mainframe = JFactory::getApplication('site');
  15. $mainframe->initialise();
  16. if(isset($_REQUEST['u'])){
  17. $username = $_REQUEST['u'];
  18. // echo "USER SET " . $username;
  19. }else{
  20. $username = '';
  21. // echo "USER NOT SET";
  22. }
  23.  
  24. if(isset($_REQUEST['p'])){
  25. $password = $_REQUEST['p'];
  26. // echo "PW SET " . $password;
  27. }else{
  28. $password = '';
  29. // echo "PW NOT SET";
  30. }
  31.  
  32. $user =& JUser::getInstance($username);
  33. //var_dump($user);
  34. if(!is_null($user->email)){
  35. $status = 1;
  36. }else{
  37. $status = 0;
  38. }
  39. $result = JFactory::getApplication()->login(array('username'=>$username, 'password'=>$password));
  40. if($result){
  41. echo '"status":"2","email":"' . $user->email . '","name":"' . $user->name . '","id":"' . $user->id . '"';
  42. }else{
  43. echo '"status":"' . $status .'","email":"' . $user->email . '","name":"' . $user->name . '"';
  44. }
  45.  
  46. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement