예제 #1
0
 public function generateFileServerCredentials()
 {
     $this->credentials[Server::SERVER_ROLE_FS]['login'] = '******' . time() . gen_string(6) . '_FS';
     //hardcoded
     $this->credentials[Server::SERVER_ROLE_FS]['password'] = gen_string(3, 'abcdefghijklmnopqrstuvwxyz') . gen_string(2, '0123456789') . gen_string(3, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
     return true;
 }
예제 #2
0
 public function add($task_)
 {
     $task_->id = gen_string(8);
     $task_->init();
     $this->tasks[] = $task_;
     $this->save($task_);
 }
예제 #3
0
 public function generateApplicationServerCredentials()
 {
     $prefs = $this->prefs->get('SessionManagement', 'localusers');
     if ($prefs['override_password'] != 0 || !(array_key_exists('password', $_POST) && strlen($_POST['password']) > 0)) {
         $this->override_password = true;
     }
     if ($this->override_password) {
         $password = gen_string(3, 'abcdefghijklmnopqrstuvwxyz') . gen_string(2, '0123456789') . gen_string(3, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
     } else {
         $password = $_POST['password'];
     }
     $this->credentials[Server::SERVER_ROLE_APS]['login'] = $this->user->getAttribute('login');
     $this->credentials[Server::SERVER_ROLE_APS]['password'] = $password;
     return true;
 }
예제 #4
0
파일: mb_strlen-1k.php 프로젝트: ning/ub
<?php

// once
function gen_string($len)
{
    $s = '';
    while ($len--) {
        $s .= chr(mt_rand(33, 126));
    }
    return $s;
}
// init
$s = gen_string(1024);
// time
$j = mb_strlen($s);
예제 #5
0
            }
        }
    }
    die;
}
try {
    $db = new PDO('sqlite:' . $db);
} catch (PDOException $e) {
    die('Unable to connect to the database.' . $e);
}
if (isset($args['add'])) {
    if (!get("uid", false)) {
        die("Please specify a uid\n");
    }
    try {
        $key = get("nokey", false) ? false : gen_string(10);
        $prep = $db->prepare("INSERT INTO servers (`uid`, `key`, `os`, `hostname`, `node`, `provider`, `disabled`, `time`) VALUES (?, ?, ?, ?, ?, ?, ?)");
        $prep->execute(array($args['uid'], $key ? $key : 0, get("os", 0), get("hostname", $args['uid']), get("node", "n/a"), get("provider", "n/a"), get("disabled", 0), time()));
        echo "Successfully added server\n";
        if ($key) {
            echo "Update your StatSend configuration file to include this key: {$key}\n";
        }
    } catch (PDOException $e) {
        echo "Error occurred while adding server: {$e}\n";
    }
} else {
    if (isset($args['delete'])) {
        if (!get("delete", false)) {
            die("Please specify a uid (--delete=uid)\n");
        }
        try {
예제 #6
0
function generate_server_id()
{
    return gen_string(5, 'abcdefghijklmnopqrstuvwxyz0123456789');
}
예제 #7
0
<?php

function gen_string($len)
{
    $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
    $string = '';
    for (; $len >= 1; $len--) {
        $position = rand() % strlen($chars);
        $string .= substr($chars, $position, 1);
    }
    return $string;
}
$config = "/etc/shopex/skomart.com/setting.conf.en";
$text = gen_string(1024);
$encrypt_text = null;
var_dump($text);
$encrypt_text = NULL;
shopex_data_encrypt_ex($config, $text, $encrypt_text);
var_dump($encrypt_text);
$decrypt_text = NULL;
shopex_data_decrypt_ex($config, $encrypt_text, $decrypt_text);
var_dump($decrypt_text);
예제 #8
0
print "<div class=\"title\">recover your password</div>\n<div class=\"container2\">";
if (isset($_GET['email'])) {
    print "Type your e-mail address into the box below and click on the send button.  You'll be sent an e-mail containing information on how to reset your password.<br /><br /><table><form action=\"recoverpass.php\" method=\"post\"><tr><th>E-mail address:</th><td><input type=\"text\" name=\"email\" /></td></tr><tr><td><input type=\"submit\" name=\"sendemail\" value=\"send\" /></td></tr></form></table>";
} elseif (isset($_POST['sendemail'])) {
    $email = escape_string($_POST['email']);
    if (is_valid_email($email) == FALSE) {
        cust_die("That is not a valid e-mail address.");
    }
    // see if it's in the database
    connect_sql();
    $query = "SELECT 1 FROM `users` WHERE `email`='{$email}' LIMIT 1";
    $query = @query($query) or die("Error checking the database.");
    if (num_rows($query) == 0) {
        cust_die("No user has that e-mail address.");
    }
    $string = gen_string($email);
    $there = "SELECT 1 FROM `pass_recovery` WHERE `email`='{$email}' LIMIT 1";
    $there = @query($there) or die("Error checking the database.");
    if (num_rows($there) == 0) {
        $query = "INSERT INTO `pass_recovery` (`email`, `hash`) VALUES ('{$email}', 'string')";
    } else {
        $query = "UPDATE `pass_recovery` SET `hash`='{$string}' WHERE `email`='{$email}' LIMIT 1";
    }
    @query($query) or die("Error updating the database.");
    disconnect_sql();
    $link = server_root . "recoverpass.php?confirm&e={$email}&s={$string}";
    $subject = "Instructions for changing your phpmygrades password.";
    $message = <<<EOT
You have requested the change of the password linked to your phpmygrades account.

If you want to change your password, please click on the following link: {$link}
예제 #9
0
파일: misc.inc.php 프로젝트: skdong/nfs-ovd
function gen_unique_string()
{
    return time() . gen_string(5);
}