示例#1
0
文件: forgot.php 项目: 5haman/Sendy
<?php

//------------------------------------------------------//
//                          INIT                        //
//------------------------------------------------------//
include '../functions.php';
include '../helpers/class.phpmailer.php';
$email = mysqli_real_escape_string($mysqli, $_POST['email']);
$new_pass = ran_string(8, 8, true, false, true);
$pass_encrypted = hash('sha512', $new_pass . 'PectGtma');
//------------------------------------------------------//
//                         EVENTS                       //
//------------------------------------------------------//
$q = 'SELECT id, name, company, s3_key, s3_secret FROM login WHERE username = "******" LIMIT 1';
$r = mysqli_query($mysqli, $q);
if ($r && mysqli_num_rows($r) > 0) {
    while ($row = mysqli_fetch_array($r)) {
        $uid = $row['id'];
        $company = stripslashes($row['company']);
        $name = stripslashes($row['name']);
        $aws_key = stripslashes($row['s3_key']);
        $aws_secret = stripslashes($row['s3_secret']);
    }
    //Change user's password to the new one
    $q = 'UPDATE login SET password = "******" WHERE id = ' . $uid;
    $r = mysqli_query($mysqli, $q);
    if ($r) {
        //send a message to let them know
        $plain_text = $name . ',
' . _('Your password has been reset, here\'s your new one') . ':
示例#2
0
文件: create.php 项目: 5haman/Sendy
    if ($day_today < $reset_on_day) {
        $month_to_reset = $month_today;
    } else {
        $month_to_reset = $month_next;
    }
} else {
    if ($choose_limit == 'unlimited') {
        $monthly_limit = -1;
        $reset_on_day = 1;
        $month_to_reset = '';
    }
}
//------------------------------------------------------//
//                      FUNCTIONS                       //
//------------------------------------------------------//
$q = 'INSERT INTO apps (userID, app_name, from_name, from_email, reply_to, currency, delivery_fee, cost_per_recipient, smtp_host, smtp_port, smtp_ssl, smtp_username, smtp_password, app_key, allocated_quota, day_of_reset, month_of_next_reset) VALUES (' . get_app_info('userID') . ', "' . $app_name . '", "' . $from_name . '", "' . $from_email . '", "' . $reply_to . '", "' . $currency . '", "' . $delivery_fee . '", "' . $cost_per_recipient . '", "' . $smtp_host . '", "' . $smtp_port . '", "' . $smtp_ssl . '", "' . $smtp_username . '", "' . $smtp_password . '", "' . ran_string(30, 30, true, false, true) . '", ' . $monthly_limit . ', ' . $reset_on_day . ', "' . $month_to_reset . '")';
$r = mysqli_query($mysqli, $q);
if ($r) {
    //app id
    $id = mysqli_insert_id($mysqli);
    //insert new record
    $q = 'INSERT INTO login (name, company, username, password, tied_to, app, timezone, language) VALUES ("' . $from_name . '", "' . $app_name . '", "' . $login_email . '", "' . $pass_encrypted . '", ' . get_app_info('userID') . ', ' . $id . ', "' . get_app_info('timezone') . '", "' . $language . '")';
    $r = mysqli_query($mysqli, $q);
    if ($r) {
        //Upload brand logo
        //Create /logos/ directory in /uploads/ if it doesn't exist
        if (!file_exists("../../uploads/logos")) {
            //Create /csvs/ directory
            if (!mkdir("../../uploads/logos", 0777)) {
                //Could not create directory '/logos/'.
                //Please make sure permissions in /uploads/ folder is set to 777.
示例#3
0
<?php

include '../functions.php';
include '../login/auth.php';
//------------------------------------------------------//
//                      VARIABLES                       //
//------------------------------------------------------//
$app = mysqli_real_escape_string($mysqli, $_POST['app']);
$company = mysqli_real_escape_string($mysqli, $_POST['brand_name']);
$name = mysqli_real_escape_string($mysqli, $_POST['from_name']);
$username = mysqli_real_escape_string($mysqli, $_POST['from_email']);
$password = ran_string(8, 8, true, false, true);
$pass_encrypted = hash('sha512', $password . 'PectGtma');
//------------------------------------------------------//
//                      FUNCTIONS                       //
//------------------------------------------------------//
$q = 'SELECT id FROM login WHERE app = ' . $app;
$r = mysqli_query($mysqli, $q);
if ($r && mysqli_num_rows($r) > 0) {
    //update password
    $q = 'UPDATE login SET password = "******" WHERE app = ' . $app;
    $r = mysqli_query($mysqli, $q);
    if ($r) {
        echo $password;
    }
} else {
    //insert new record
    $q = 'INSERT INTO login (name, company, username, password, tied_to, app) VALUES ("' . $name . '", "' . $company . '", "' . $username . '", "' . $pass_encrypted . '", ' . get_app_info('userID') . ', ' . $app . ')';
    $r = mysqli_query($mysqli, $q);
    if ($r) {
        echo $password;
示例#4
0
文件: update.php 项目: 5haman/Sendy
}
//================= Version 1.1.7 =================//
//New column in table: apps
//=================================================//
$q = "SHOW COLUMNS FROM apps WHERE Field = 'app_key'";
$r = mysqli_query($mysqli, $q);
if (mysqli_num_rows($r) == 0) {
    $q3 = 'alter table apps ADD COLUMN app_key VARCHAR (100)';
    $r3 = mysqli_query($mysqli, $q3);
    if ($r3) {
        $q4 = 'SELECT id FROM apps';
        $r4 = mysqli_query($mysqli, $q4);
        if (mysqli_num_rows($r4) > 0) {
            while ($row = mysqli_fetch_array($r4)) {
                $cid = $row['id'];
                $q5 = 'UPDATE apps SET app_key = "' . ran_string(30, 30, true, false, true) . '" WHERE id = ' . $cid;
                mysqli_query($mysqli, $q5);
            }
        }
    }
}
//================= Version 1.1.7.2 ===============//
//New index in table: subscribers (email column)
//=================================================//
//add index to email column in subscribers table
$q = 'SHOW INDEX FROM subscribers WHERE KEY_NAME = "s_email"';
$r = mysqli_query($mysqli, $q);
if (mysqli_num_rows($r) == 0) {
    mysqli_query($mysqli, 'CREATE INDEX s_email ON subscribers (email)');
}
//================= Version 1.1.8 ===============//