Example #1
0
/**
 * ADD registration request (set action=1) and wait user confirm
 * 
 * @author Alberto Basso
 */
function sumo_request_pwdlost()
{
    global $SUMO, $sumo_lang_login, $sumo_reg_data;
    $new_pwd = sumo_get_rand_string(8);
    $reg_code = sumo_get_simple_rand_string(40);
    $user = sumo_get_user_info($sumo_reg_data['reg_email'], 'email');
    sumo_delete_user_temp();
    // Delete old temp users
    sumo_delete_user_temp($sumo_reg_data['reg_email'], 9);
    // delete all previous requests
    $query = "INSERT INTO " . SUMO_TABLE_USERS_TEMP . " \r\n\t\t\t  (username, action, email, language, password, reg_group, reg_code, time)\r\n\t\t\t  VALUES (\r\n\t\t\t\t  '" . $user['user'] . "', 2, \r\n\t\t\t\t  '" . $sumo_reg_data['reg_email'] . "', \r\n\t\t\t\t  '" . $user['language'] . "', \r\n\t\t\t\t  '" . sha1($new_pwd) . "', \r\n\t              '" . $SUMO['page']['reg_group'] . "', \r\n\t              '" . $sumo_reg_data['reg_email'] . "', \r\n\t\t\t\t  '" . $reg_code . "',\r\n\t\t\t\t   " . $SUMO['server']['time'] . "\r\n\t\t\t\t   )";
    $SUMO['DB']->Execute($query);
    $link = $_SERVER['HTTPS'] ? 'https://' : 'http://';
    $link .= $_SERVER["HTTP_HOST"] . $_SERVER["PHP_SELF"] . '?sumo_action=changepwd&reg_code=' . $reg_code;
    $name = sumo_get_accesspoint_name($SUMO['page']['name'], $_COOKIE['language']);
    $message = sumo_get_message('I00104M', array($user['user'], $sumo_reg_data['reg_email'], date($SUMO['config']['server']['date_format'] . " " . $SUMO['config']['server']['time_format'], $SUMO['server']['time']), "\"" . $name . "\"", intval($SUMO['config']['accounts']['registration']['life']), $link, $new_pwd));
    // Send e-mail to confirm
    if (!$SUMO['config']['server']['admin']['email']) {
        sumo_write_log('E06000X', '', '0,1', 2, 'system', FALSE);
    } else {
        $m = new Mail();
        $m->From($SUMO['config']['server']['admin']['email']);
        $m->To($sumo_reg_data['reg_email']);
        $m->Subject($sumo_lang_login['PasswordLost']);
        $m->Body($message, SUMO_CHARSET);
        $m->Priority(3);
        $m->Send();
    }
}
Example #2
0
 */
$tab = sumo_get_accesspoint_info($_GET['id'], 'id', false);
// If id not exist
if (!$tab['id']) {
    $tpl['MESSAGE:H'] = $language['AccessPointNotExist'];
    unset($tab);
}
$checked['http_auth'] = $tab['http_auth'] ? " checked='checked'" : "";
$checked['filtering'] = $tab['filtering'] ? " checked='checked'" : "";
$checked['pwd_encrypt'] = $tab['pwd_encrypt'] ? " checked='checked'" : "";
$checked['change_pwd'] = $tab['change_pwd'] ? " checked='checked'" : "";
$checked['registration'] = $tab['registration'] ? " checked='checked'" : "";
$checked['reg_group'] = $tab['registration'] ? true : false;
$form_name = 'ModifyAccesspoints';
$is_console = sumo_verify_is_console($tab['path']) ? true : false;
$path_console = $is_console ? $tab['path'] : sumo_get_rand_string(8);
// bad solution
// Delete
if ($SUMO['user']['group_level']['sumo'] > 4 && (!sumo_verify_is_console($tab['path']) || $tab['id'] != 1)) {
    $msg = sumo_get_simple_rand_string(4, "123456789");
    $delete = "<div class='sub-module-icon' " . "onmouseover='this.style.outline=\"1px solid #999999\";this.style.background=\"#FFFFFF\"' " . "onmouseout='this.style.outline=\"\";this.style.background=\"\"'>" . "<a href=\"javascript:" . "sumo_show_message('msg{$msg}', '" . htmlspecialchars(sumo_get_message('AreYouSureDelete', array($tab['path'], htmlspecialchars(sumo_get_accesspoint_name($tab['name'], $_COOKIE['language']), ENT_QUOTES)))) . "', \n\t\t\t\t\t\t'h', 0, \n\t\t\t\t\t\t'" . base64_encode(sumo_get_form_req('', 'delete', 'id=' . $tab['id'])) . "',\n\t\t\t\t\t\t'" . base64_encode('') . "',\n\t\t\t\t\t\t'" . base64_encode("<input type='button' value='" . $language['Cancel'] . "' onclick='javascript:sumo_remove_window(\"msg{$msg}\");' class='button'>") . "',\n\t\t\t\t\t\t'" . base64_encode("<input type='submit' value='" . $language['Ok'] . "' onclick='javascript:sumo_remove_window(\"msg{$msg}\");' class='button'>") . "'\n\t\t\t\t);\">" . "<img src='themes/" . $SUMO['page']['theme'] . "/images/modules/accesspoints/remove.png' vspace='4'><br>" . $language['Remove'] . "</a>" . "</div>";
} else {
    $delete = sumo_get_action_icon("", "remove");
}
$tpl['GET:ID'] = $tab['id'];
$tpl['GET:RegGroup'] = $tab['reg_group'];
$tpl['GET:Updated'] = sumo_get_human_date($tab['updated']);
$tpl['GET:Created'] = sumo_get_human_date($tab['created']);
$tpl['GET:UpdateForm'] = sumo_get_form_req('', 'modify', 'id=' . $tab['id']);
$tpl['GET:Created'] = sumo_get_human_date($tab['created']);
$tpl['PUT:Node'] = $tab['id'] > 1 ? sumo_put_node($tab['node']) : sumo_put_node($tab['node'], true);
Example #3
0
/**
 * Update security string when refresh a connection
 *
 * @global resource $SUMO
 * @author Alberto Basso <*****@*****.**>
 */
function sumo_update_security_string()
{
    global $SUMO;
    $query = "UPDATE " . SUMO_TABLE_CONNECTIONS . "\n\t\t\t  SET\n\t\t\t  \tsecurity_string='" . sumo_get_rand_string() . "',\n\t\t\t  \ttime=" . $SUMO['server']['time'] . "\n\t\t\t  WHERE node='" . $SUMO['server']['name'] . "'\n\t\t\t  \tAND ip='" . $SUMO['client']['ip'] . "'\n\t\t\t  \tAND session_id='" . $SUMO['client']['session_id'] . "'";
    $SUMO['DB']->Execute($query);
}