Ejemplo n.º 1
0
<?php

include_once './lib.php';
include_once './config.php';
if (!isPostBack()) {
    die('Please send subscribe form via POST method...');
}
$Email = htmlspecialchars($_POST['txtSubscribe']);
$Text = "Subscriber email address recieved : " . $Email;
$Subject = "Subscribe";
if (!checkEmailAddress($Email)) {
    die('Invalid email address...');
}
if (!sendmail::send($Email, $subscribeEmail, $Text, $Subject)) {
    die('Could not send message. failed to connect to mailserver.');
}
echo '1';
Ejemplo n.º 2
0
function requestAccount()
{
    // globals
    global $DB;
    global $MySelf;
    global $TIMEMARK;
    global $MB_EMAIL;
    // Generate random Password
    $PASSWORD = base64_encode(rand(111111111111.0, 999999999999.0));
    $PASSWORD_ENC = encryptPassword($PASSWORD);
    // Sanitize the input.
    $NEW_USER = strtolower(sanitize($_POST[username]));
    // supplied new username.
    // Lets prevent adding multiple users with the same name.
    if (userExists($NEW_USER)) {
        makeNotice("Your account was not created because there is already an account with the same username. Please pick another. " . "If you forgot your password, please use the password recovery link on the login page.", "error", "Account not created");
    }
    // So we have a username?
    if (strlen($_POST[username]) < 3) {
        makeNotice("Your username must be longer than 3 letters.", "error", "Invalid Username");
    }
    // Let me rephrase: Do we have a VALID username?
    if (!ctypeAlnum($_POST[username])) {
        makeNotice("Only characters a-z, A-Z, 0-9 and spaces are allowed as username.", "error", "Invalid Username");
    }
    // So we have an email address?
    if (empty($_POST[email])) {
        // We dont!
        makeNotice("You need to supply an email address!", "error", "Account not created");
    } else {
        // We do. Clean it.
        $NEW_EMAIL = sanitize($_POST[email]);
        // Valid one, too?
        if (!checkEmailAddress($NEW_EMAIL)) {
            makeNotice("You need to supply a valid email address!", "error", "Account not created");
        }
    }
    // Is it the very first account?
    $count = $DB->query("SELECT * FROM users");
    if ($count->numRows() == 0) {
        $temp = $DB->query("INSERT INTO `users` (`username`, `password`, `email`, `addedby`," . " `lastlogin`, `confirmed`, `emailvalid`, `emailcode`, `optIn`, `canLogin`," . " `canJoinRun`, `canCreateRun`, `canCloseRun`, `canDeleteRun`, `canAddHaul`," . " `canChangePwd`, `canChangeEmail`, `canChangeOre`, `canAddUser`, `canSeeUsers`," . " `canDeleteUser`, `canEditRank`, `canManageUser`, `canEditEvents`, `canDeleteEvents`," . " `canSeeEvents`, `isOfficial`, `isLottoOfficial`, `isAccountant`, `preferences`, `isAdmin`, `rank`) " . "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", array(stripcslashes($NEW_USER), $PASSWORD_ENC, $NEW_EMAIL, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1));
        // Check for success, catch database errors.
        if (gettype($temp) != "DB_Error" && $DB->affectedRows() == 1) {
            // Success! New superuser created, send a confirmation email.
            $email = "Superuser information: Username " . stripcslashes($NEW_USER) . ", Password {$PASSWORD} - change this as soon as possible!";
            global $VERSION;
            $headers = "From:" . $MB_EMAIL;
            mail("{$NEW_EMAIL}", "Superuser login information (" . $VERSION . ")", $email, $headers);
            unset($email);
            // Inform the user.
            makeNotice("New Superuser created:<br>Username: "******"<br>Password: {$PASSWORD}");
        } else {
            // Something went wrong!
            makeNotice("Failed creating the superuser!<br><br>" . $temp->getMessage(), "error", "Database Error!");
        }
    } else {
        // Lets avoid multiple accounts per email address!
        $otherAccsDS = $DB->query("SELECT COUNT(email) AS count FROM users WHERE email = '{$NEW_EMAIL}' ");
        $otherAccs = $otherAccsDS->fetchRow();
        if ($otherAccs[count] > 0) {
            makeNotice("There is already an account with your supplied eMail address. If you lost " . "your password please  use the password recovery feature.", "error", "Account not requested", "index.php", "[cancel]");
        }
        // Inser the new user into the database!
        $CODE = rand(111111111111.0, 9999999999999.0);
        $DB->query("insert into users (username, password, email, " . "addedby, emailcode) " . "values (?, ?, ?, ?, ?)", array(stripcslashes($NEW_USER), "{$PASSWORD_ENC}", "{$NEW_EMAIL}", $MySelf->getID(), "{$CODE}"));
        // Were we successful?
        if ($DB->affectedRows() == 0) {
            // No!
            makeNotice("Could not create user!", "error");
        } else {
            // Load more globals
            global $SITENAME;
            global $URL;
            global $VERSION;
            // Assemble the activation url.
            $ACTIVATE = $URL . "/index.php?action=activate&code={$CODE}";
            // Send a confirmation email
            $EMAIL = getTemplate("accountrequest", "email");
            $EMAIL = str_replace("{{IP}}", "{$_SERVER['REMOTE_ADDR']}", $EMAIL);
            $EMAIL = str_replace("{{URL}}", "{$URL}", $EMAIL);
            $EMAIL = str_replace("{{DATE}}", date("r", $TIMEMARK), $EMAIL);
            $EMAIL = str_replace("{{ACTIVATE}}", "{$ACTIVATE}", $EMAIL);
            $EMAIL = str_replace("{{CORP}}", "{$SITENAME}", $EMAIL);
            $to = $NEW_EMAIL;
            $DOMAIN = $_SERVER['HTTP_HOST'];
            $headers = "From:" . $MB_EMAIL;
            mail($to, $VERSION, $EMAIL, $headers);
            makeNotice("A confirmation email has been sent to your supplied email address.<br>Please follow the instructions therein.", "notice", "Account created");
        }
    }
}
Ejemplo n.º 3
0
function net2ftp_module_printBody()
{
    // --------------
    // This function prints the zip screen
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
    if (isset($_POST["list"]) == true) {
        $list = getSelectedEntries($_POST["list"]);
    } else {
        $list = "";
    }
    if (isset($_POST["zipactions"]) == true) {
        $zipactions = $_POST["zipactions"];
    } else {
        $zipactions = "";
    }
    // -------------------------------------------------------------------------
    // Variables for all screens
    // -------------------------------------------------------------------------
    // Title
    $title = __("Zip entries");
    // Form name, back and forward buttons
    $formname = "ZipForm";
    $back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();";
    $forward_onclick = "document.forms['" . $formname . "'].submit();";
    // -------------------------------------------------------------------------
    // Variables for screen 1
    // -------------------------------------------------------------------------
    if ($net2ftp_globals["screen"] == 1) {
        // Next screen
        $nextscreen = 2;
        // Default filename of the zip file
        $zipfilename = get_filename_name($list["files"][1]["dirfilename"]) . ".zip";
    } elseif ($net2ftp_globals["screen"] == 2) {
        // --------------------
        // Check the input data
        // --------------------
        // Filename
        if ($zipactions["save"] == "yes" && $zipactions["save"]["filename"] == "") {
            $errormessage = __("You did not enter a filename for the zipfile. Go back and enter a filename.") . "<br />";
            setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
            return false;
        }
        // Email address
        if ($zipactions["email"] == "yes" && checkEmailAddress($zipactions["email_to"]) == false) {
            $errormessage = __("The email address you have entered (%1\$s) does not seem to be valid.<br />Please enter an address in the format <b>username@domain.com</b>", $zipactions["email_to"]) . "<br />";
            setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
            return false;
        }
        // --------------------
        // Execute the function
        // --------------------
        setStatus(4, 10, __("Processing the entries"));
        $zipactions["download"] == "no";
        ftp_zip("", $net2ftp_globals["directory"], $list, $zipactions, "", 0);
        if ($net2ftp_result["success"] == false) {
            return false;
        }
    }
    // end elseif
    // -------------------------------------------------------------------------
    // Print the output
    // -------------------------------------------------------------------------
    require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php";
}
Ejemplo n.º 4
0
function validateEmailAddress($model, $name, $localizedName)
{
    if ($model->{$name} !== null && !checkEmailAddress($model->{$name})) {
        return "invalid mail address format.";
    }
}