예제 #1
0
<?php

$register_message = "Registration";
if (isset($_REQUEST['Submit'])) {
    include_once 'ldapexec.php';
    try {
        create_user_account($_REQUEST['login'], $_REQUEST['password'], $_REQUEST['cpassword']);
    } catch (Exception $exception) {
        $register_message = $exception->getMessage();
    }
    if ($register_message == "Registration") {
        echo "Congratulations! You have successfully registered.";
    } else {
        echo "Oops! Some error occurred. <br/>" . $register_message;
    }
} else {
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Login Form</title>
<link href="loginmodule.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h2><?php 
    echo $register_message;
    ?>
</h2>
<form id="loginForm" name="loginForm" method="post" action="register-form.php">
  <table width="300" border="0" align="center" cellpadding="2" cellspacing="0">
예제 #2
0
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 BSD License for more details.

 
##############################################################
*/
error_reporting(E_ALL & ~E_NOTICE);
@set_magic_quotes_runtime(0);
$location .= " > <b>Register New Account</b>";
require_once "global.php";
do_header();
switch ($_REQUEST['do']) {
    case 'register_confirm':
        create_user_account();
        break;
    default:
        print_registration_form();
        break;
}
do_footer();
function print_registration_form()
{
    global $userinfo;
    if ($userinfo[id] != '0') {
        print "You are already a registered user.";
    } else {
        require_once "templates/registration_form.inc.php";
    }
}
<?php

session_start();
// logs in
require_once "../file-includes.php";
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$password = fix_string($request->password);
$username = fix_string($request->username);
if (!username_exists($username) && strlen($username) > 0 && strlen($password) > 0) {
    create_user_account($username, $password);
    log_in($username);
    echo "true";
} else {
    echo 'false';
}
예제 #4
0
//exec($command,$output,$exit_status);
//$exit_status = 2;
//display_command_output("Copy $identity_name-id to /tmp/jb-id",$exit_status,$output,$command,"error");
//$command = "ls -lrt /tmp";
//exec($command,$output,$exit_status);
//$exit_status = 2;
//display_command_output("liste /tmp",$exit_status,$output,$command,"error");
//$command = "cat /tmp/jb-id";
//exec($command,$output,$exit_status);
//$exit_status = 2;
//display_command_output("cat /tmp/jb-id",$exit_status,$output,$command,"error");
// ------------------- DEPLOYEMENT ----------------------
if (test_connection($hostname, $identity_name, $account_name) == 0) {
    // --------------- checking user account
    if (user_exists($identity_name, $account_name, $hostname) != 0) {
        create_user_account($identity_name, $account_name, $hostname, $account_UID, $account_GID, $account_homedir, $GIDname, $id, $GECOS);
    }
    // --------------- getting homedir of current user
    $homedir = get_homedir($identity_name, $account_name, $hostname);
    if ($homedir != "user not found") {
        // --------------- checking ssh directory
        if (user_ssh_dir_exists($identity_name, $account_name, $hostname, $homedir) != 0) {
            create_user_ssh_dir($identity_name, $account_name, $hostname, $homedir);
            chperm_user_ssh_dir($identity_name, $account_name, $hostname, $homedir);
        }
        // --------------- Testing presence of file
        if (authorized_key_exist($identity_name, $account_name, $hostname, "{$homedir}/.ssh/authorized_keys") == 0) {
            archive_authorized_key_file($identity_name, $account_name, $hostname, "{$homedir}/.ssh/authorized_keys");
            get_local_copy_authorized_key_file($identity_name, $account_name, $hostname, "{$homedir}/.ssh/authorized_keys");
        } else {
            // We create an empty file so check_differences will have 2 files to compare.