Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2017
513
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.14 KB | None | 0 0
  1. <?php
  2. require_once __DIR__ . '/db_connect.php';
  3.  
  4. $type = '0';
  5. $username = 'username';
  6. $password = 'pass';
  7. $name = 'john';
  8. $mobile = '9090909090';
  9. $email = 'abc@gmail.com';
  10. $alias = strtr($name, array (' ' => '-'));
  11.  
  12.  
  13.  
  14. define( '_JEXEC', 1 );
  15. define('JPATH_BASE', dirname(__FILE__) );
  16. define( 'DS', DIRECTORY_SEPARATOR );
  17.  
  18. require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
  19. require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
  20.  
  21. $app = JFactory::getApplication('site');
  22. $app->initialise();
  23.  
  24.  
  25.  
  26. require_once(JPATH_BASE.DS.'components'.DS.'com_users'.DS.'models'.DS.'registration.php');
  27.  
  28.  
  29. $lang = JFactory::getLanguage();
  30. $extension = 'com_users';
  31. $base_dir = JPATH_SITE;
  32. $language_tag = 'en-GB';
  33. $reload = true;
  34. $lang->load($extension, $base_dir, $language_tag, $reload);
  35.  
  36. $model = new UsersModelRegistration();
  37. jimport('joomla.mail.helper');
  38. jimport('joomla.user.helper');
  39.  
  40.  
  41.  
  42.  
  43. $block = '0';
  44. $sendEmail = '0';
  45. $activation = '1';
  46. $data = array( 'username' => $username,
  47. 'name' => $name,
  48. 'email1' => $email,
  49. 'password1' => $password, // First password field
  50. 'password2' => $password, // Confirm password field
  51. 'sendEmail' => $sendEmail,
  52. 'activation' => $activation,
  53. 'mobile' => $mobile,
  54. 'groups' =>array("2","10"));
  55. $response = $model->register($data);
  56. echo $data['mobile'];
  57.  
  58. $mobile = null; // line 60 at root/libraries/joomla/user/user.php
  59.  
  60. <field
  61. name="mobile"
  62. type="text"
  63. description="COM_USERS_DESIRED_USERNAME"
  64. filter="mobile"
  65. label="COM_USERS_REGISTER_USERNAME_LABEL"
  66. message="COM_USERS_REGISTER_USERNAME_MESSAGE"
  67.  
  68. size="30" />
  69.  
  70. public function register()
  71.  
  72. <?php
  73. define('_JEXEC', 1);
  74. define('JPATH_BASE', __DIR__);
  75. define('DS', DIRECTORY_SEPARATOR);
  76.  
  77. /* Required Files */
  78. require_once(JPATH_BASE . DS . 'includes' . DS . 'defines.php');
  79. require_once(JPATH_BASE . DS . 'includes' . DS . 'framework.php');
  80. $app = JFactory::getApplication('site');
  81. $app->initialise();
  82.  
  83. require_once(JPATH_BASE . DS . 'components' . DS . 'com_users' . DS . 'models' . DS . 'registration.php');
  84. //not necessary
  85. //require_once(JPATH_BASE.DS.'libraries'.DS.'joomla'.DS.'application'.DS.'component'.DS.'helper.php';
  86.  
  87. $model = new UsersModelRegistration();
  88. jimport('joomla.mail.helper');
  89. jimport('joomla.user.helper');
  90. $language = JFactory::getLanguage();
  91. $language->load('com_users', JPATH_SITE);
  92. $type = '0';
  93. $username = 'username';
  94. $password = 'pass';
  95. $name = 'john';
  96. $mobile = '9090909090';
  97. $email = 'abc@gmail.com';
  98. $alias = strtr($name, array(' ' => '-'));
  99. $username = 'adam';
  100. $name = 'adam24';
  101. $email = 'adam@mailinator.com';
  102. $password = 'adam';
  103. $block = '0';
  104. $sendEmail = '0';
  105. $activation = '1';
  106. $data = array('username' => $username,
  107. 'name' => $name,
  108. 'email1' => $email,
  109. 'password1' => $password, // First password field
  110. 'password2' => $password, // Confirm password field
  111. 'sendEmail' => $sendEmail,
  112. 'activation' => $activation,
  113. 'mobile' => $mobile,
  114. 'groups' => array("2", "10"));
  115. $response = $model->register($data);
  116. echo $data['mobile'];
  117.  
  118. echo $model->register($data);
  119. if (version_compare(PHP_VERSION, '5.3.1', '<')) {
  120. die('Your host needs to use PHP 5.3.1 or higher to run this version of Joomla!');
  121. }
  122. ?>
  123.  
  124. <!-- db result -->
  125. <tr>
  126. <th>id</th>
  127. <th>name</th>
  128. <th>username</th>
  129. <th>email</th>
  130. <th>password</th>
  131. <th>block</th>
  132. <th>sendEmail</th>
  133. <th>registerDate</th>
  134. <th>lastvisitDate</th>
  135. <th>activation</th>
  136. <th>params</th>
  137. <th>lastResetTime</th>
  138. <th>resetCount</th>
  139. <th>otpKey</th>
  140. <th>otep</th>
  141. <th>requireReset</th>
  142. <th>mobile</th>
  143. </tr>
  144.  
  145. <tr>
  146. <td>382</td>
  147. <td>adam24</td>
  148. <td>adam</td>
  149. <td>adam@mailinator.com</td>
  150. <td>$2y$10$CWsR0Ab9AZNvze2l/2Teiek3mzZ3EqyxnAzuYcv9CTaMCeSud5pza</td>
  151. <td>1</td>
  152. <td>0</td>
  153. <td>2015-10-26 22:16:16</td>
  154. <td>NULL</td>
  155. <td>fa37ff46e1be16c6029723c395c0f156</td>
  156. <td>{}</td>
  157. <td>NULL</td>
  158. <td>0</td>
  159. <td></td>
  160. <td></td>
  161. <td>0</td>
  162. <td>9090909090</td>
  163. </tr>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement