Site Cloner PHP Script
Bargain Hunter PHP Script
Job Hunter PHP Script
Site Login and Access Control PHP Script

Custom Script to Use Joomla Framework without Using Joomla

You may want to use Joomla framework since all tables are nicely setup, or you want tom use parts of a Joomla installation and custom code other parts. Coding PHP / mySQL to add users to the Joomla users table is not much different than using a custom users table.  The custom form should be used from the beginning to ensure passwords all use the same methods of encryption. If you use Joomla password system for a few users then switch, you could have login issues.  The key is to only use the custom registration form to keep everything in sync.

However, if you plan to use Joomla CMS and an application running on its own at the same time, you must consider the 3 tables which holds the 3 records for each user. If you just create a user to the user table, the user can be used in a standalone application, but not the Joomla CMS.

Here is some sample code for which you can take a pure php / mySQL form and add a user which can be used with the Joomla CMS or with pure PHP / mySQL.

<?php //check to see form is filled out and session for Super admin exists. We need the name, username, email address and password. The rest we can just insert values…like a typical Joomla registration
if ($_SESSION[‘my_session_id’] && $_POST[‘name’] && $_POST[‘username’] && $_POST[’emailaddress’] && $_POST[‘pword’]) {
$name = $_POST[‘agent_name’];
$username = $_POST[‘username’];
$emailaddress = $_POST[’emailaddress’];
$password = md5($_POST[‘pword’]);
$usertype = $_POST[‘usertype’];
$gid = $_POST[‘gid’];

$params = “admin_language=
language=
editor=
helpsite=
timezone=0”;

$command = “INSERT INTO jos_users VALUES (”, ‘”.addslashes($_POST[name]).”‘, ‘”.addslashes($_POST[username]).”‘, ‘”.addslashes($_POST[emailaddress]).”‘, ‘$password’, ‘”.addslashes($_POST[usertype]).”‘, 0, 0, ‘”.addslashes($_POST[gid]).”‘,   now(), now(), ”, ‘$params’)”;
$result = mysqli_query($db, $command);

$need_id1=mysqli_insert_id($db);

$command = “INSERT INTO jos_core_acl_aro VALUES (NULL, ‘users’, ‘$need_id1’, ‘0’, ‘”.addslashes($_POST[name]).”‘, 0)”;
$result = mysqli_query($db, $command);

$need_id2=mysqli_insert_id($db);

$command = “INSERT INTO jos_core_acl_groups_aro_map VALUES (’18’, ”, ‘$need_id2’)”;
$result = mysqli_query($db, $command);

}
?>

<?php //Here is the form ?>

<form method=POST action=”<?php echo $_SERVER[‘SELF’]; ?>”>
<table>
<tr>
<td align=right>
Name:
</td>
<td align=left>
<input type=text size=25 max=50 name=” name”>
</td>
</tr>
<tr>
<td align=right>
Username:
</td>
<td align=left>
<input type=text size=25 max=50 name=”username”>
</td>
</tr>
<tr>
<td align=right>
Agent Email:
</td>
<td align=left>
<input type=text size=25 max=50 name=”emailaddress”>
</td>
</tr>
<tr>
<td align=right>
Password:
</td>
<td align=left>
<input type=password size=12 max=12 name=”pword”>
</td>
</tr>
<tr>
<td align=right>

</td>
<td align=left>
<input type=”hidden” size=12 max=12 name=”usertype” value=”Registered”>
</td>
</tr>
<tr>
<td align=right>

</td>
<td align=left>
<input type=”hidden” size=12 max=12 name=”gid” value=”18″>
</td>
</tr>
<tr>
<td colspan=2 align=center>
<input type=submit value=”SUBMIT”>
</td>
</tr>
</TABLE><br>
</form>