Example #1
0
 public function forgotPassword()
 {
     $retArray = array('success' => false);
     $email = $this->input->post('email', TRUE);
     $is_valid = email_valid($email);
     if (!$is_valid) {
         $retArray['message'] = 'That is not a valid e-mail address.';
     } else {
         $this->load->helper('genmail');
         $retArray['success'] = true;
         $retArray['message'] = 'Thanks! A temporary password has been e-mailed to you that ';
         $retArray['message'] .= 'will be valid for one hour.';
         $genMail = array();
         $genMail['to'] = $email;
         $genMail['subject'] = 'Reset your Log the Dog password!';
         $rndpw = $this->_randomPassword();
         $this->load->model('account_model');
         $acctinfo = $this->account_model->retrieveId($email);
         $link = base_url() . 'account/user_reset?flirzel=' . $acctinfo['id'] . '&kwerp=' . $rndpw;
         $genMail['message'] = 'We have received your request to reset your password. Please ';
         $genMail['message'] .= 'click on the following link:<br />&nbsp;<br />';
         $genMail['message'] .= '<a href="' . $link . '">' . $link . '</a><br />&nbsp;<br />';
         $genMail['message'] .= "If the link doesn't work, then copy the following line ";
         $genMail['message'] .= "and paste it into your web browser's address bar:<br />&nbsp;<br />";
         $genMail['message'] .= $link;
         gen_mail($genMail);
         $exp = date('Y-m-d H:i:s', time() + 3600);
         $pass = password_hash($rndpw, PASSWORD_BCRYPT);
         $retArray['create_temp'] = $this->account_model->create_temp($acctinfo['id'], $pass, $exp);
     }
     echo json_encode($retArray);
     exit;
 }
Example #2
0
 public function invitation_operator()
 {
     $this->tpl_name = '';
     if ($_REQUEST["ex_email"]) {
         $_email = explode(",", $_REQUEST["ex_email"]);
         if ($_email) {
             $len_email = sizeof($_email);
             for ($i = 0; $i < $len_email; $i++) {
                 $e = rtrim(ltrim($_email[$i]));
                 $_exn = $this->Members->get_by_email($e);
                 $_che = $this->Competitions_examiner->operator_check($_REQUEST["competition_id"], $_exn["id"]);
                 if ($_exn && !$_che) {
                     $arr["competition_id"] = $_REQUEST["competition_id"];
                     $arr["user_id"] = $_exn["id"];
                     $this->Competitions_examiner->operator_add($arr);
                     // mail, activity
                     if (email_valid($e)) {
                         //mailing
                         $res = $this->Competitions->get($_REQUEST["competition_id"]);
                         $m = new TF_mailer($this->settings);
                         $m->mailto = $e;
                         $m->subject = "[D.CAMP] 경진대회 운영진으로 초대되었습니다.";
                         $m->tpl_name = "competition_invite_op";
                         $m->assigns["res"] = $res;
                         $m->assigns["cont"] = $_REQUEST["ex_cont"];
                         $m->assigns["main_service_url"] = $this->globals->my_host;
                         $m->assigns["main_service_domain"] = $_SERVER['SERVER_NAME'];
                         $m->send();
                     }
                 } else {
                     echo "error";
                 }
             }
         }
     }
 }
Example #3
0
        $hata = true;
        $_SESSION["ccode"] = "";
    } else {
        $_SESSION["ccode"] = "";
        $subject = temizle($_POST["konu"]);
        $address = temizle($_POST["address"]);
        $address = getMailAddress($address);
        $bodisi = temizle($_POST["icerik"]);
        $gonderenMail = getMailAddress(getUserID2($_SESSION["usern"]));
        if ($gonderenMail == "") {
            $gonderenMail = ayarGetir("ayar4char");
        }
        $headers = 'MIME-Version: 1.0' . "\r\n";
        $headers .= 'Content-type: text/html; charset=iso-8859-9' . "\r\n";
        $headers .= "From:" . $gonderenMail . "\r\nReply-To:" . $gonderenMail . "\r\n" . 'X-Mailer: PHP/' . phpversion();
        if (email_valid($address)) {
            if (@mail("{$address}", "eOgr - {$subject}", "{$bodisi}", $headers)) {
                echo "<font id='tamam'>Epostanýz G&ouml;nderildi!</font>";
                $hata = true;
            } else {
                echo "<font id='hata'>&Ouml;z&uuml;r dileriz, þu anda mesajýnýz g&ouml;nderilemiyor!</font>";
                $hata = true;
            }
        } else {
            echo "<font id='hata'>&Ouml;z&uuml;r dileriz, kullanýcýnýn eposta adresi bilgisinde sorun var!</font>";
        }
        $hata = true;
    }
}
$address = isset($_GET["to"]) ? $_GET["to"] : "";
if (empty($address) && isset($_POST["address"])) {
Example #4
0
 $sql = sprintf("SELECT email FROM users WHERE domainid='%s'  AND enew!='0' ORDER BY email", $db->escapeSimple($_GET['did']));
 $result =& $db->query($sql);
 if ($result->numRows() > 0) {
     $table_email = array();
     while ($data = $result->fetchrow(DB_FETCHMODE_ASSOC)) {
         array_push($table_email, array('mail' => $data['email']));
     }
 } else {
     $table_email = false;
 }
 $smarty->assign('table_email', $table_email);
 $smarty->assign('from', false);
 if (isset($_POST['submit'])) {
     if (!empty($_POST['from']) && !empty($_POST['to'])) {
         $full_email = $_POST['from'] . "@" . $dnsname;
         if (!email_valid($_POST['from'])) {
             $smarty->assign('error_msg', 'y');
             $smarty->assign('if_email_valid', 'y');
             $smarty->assign('from', $_POST['from']);
             $smarty->assign('to', $_POST['to']);
         } else {
             if (get_forem_domain($domain_id, 'forwardings', $db) >= $max_forward && $max_forward != 0) {
                 $smarty->assign('error_msg', 'y');
                 $smarty->assign('if_error_forwds_max_reached', 'y');
             } else {
                 if (email_exist($full_email, $db, 0, 0)) {
                     $smarty->assign('error_msg', 'y');
                     $smarty->assign('if_error_email_exits', 'y');
                     $smarty->assign('full_email', 'y');
                     $smarty->assign('from', $_POST['from']);
                     $smarty->assign('to', $_POST['to']);
Example #5
0
 $smarty->assign('domain', $data['dnsname']);
 $smarty->assign('dnsname', $data['dnsname']);
 $smarty->assign('full_name', false);
 $smarty->assign('eMail', false);
 if (get_forem_domain($domain_id, 'users', $db) >= $max_email && $max_email != 0) {
     $smarty->assign('error_msg', 'y');
     $smarty->assign('if_error_email_max_reached', 'y');
 }
 if (isset($_POST['submit'])) {
     if (!empty($_POST['emailaddr']) && !empty($_POST['npassword'])) {
         $full_email = $_POST['emailaddr'] . "@" . $data['dnsname'];
         if (get_forem_domain($domain_id, 'users', $db) >= $max_email && $max_email != 0) {
             $smarty->assign('error_msg', 'y');
             $smarty->assign('if_error_email_max_reached', 'y');
         } else {
             if (!email_valid($_POST['emailaddr'])) {
                 $smarty->assign('error_msg', 'y');
                 $smarty->assign('if_email_valid', 'y');
                 $smarty->assign('if_valid', 'n');
                 $smarty->assign('eMail', $_POST['emailaddr']);
                 $smarty->assign('full_name', $_POST['full_name']);
             } else {
                 if (email_exist($full_email, $db, 0, 0)) {
                     $smarty->assign('error_msg', 'y');
                     $smarty->assign('if_error_email_exits', 'y');
                     $smarty->assign('full_email', 'y');
                     $smarty->assign('eMail', $_POST['emailaddr']);
                     $smarty->assign('full_name', $_POST['full_name']);
                 } else {
                     if (check_passwd_length($_POST['npassword']) == false) {
                         $smarty->assign('error_msg', 'y');
Example #6
0
 public function invitation_email()
 {
     $this->tpl_name = '';
     if ($_REQUEST["ex_email"]) {
         $_email = explode(",", $_REQUEST["ex_email"]);
         if ($_email) {
             $len_email = sizeof($_email);
             for ($i = 0; $i < $len_email; $i++) {
                 $e = rtrim(ltrim($_email[$i]));
                 $_exn = $this->Members->get_by_email($e);
                 $arr["competition_id"] = $_REQUEST["competition_id"];
                 $arr["user_id"] = $_exn["id"];
                 if (!$_exn) {
                     $arr["email"] = $e;
                 }
                 $this->Competitions_examiner->add($arr);
                 // mail, activity
                 if (email_valid($e)) {
                     //mailing
                     $res = $this->Competitions->get($_REQUEST["competition_id"]);
                     $us = $this->Members->get($res["user_id"]);
                     $m = new TF_mailer($this->settings);
                     $m->mailto = $e;
                     $m->subject = "[D.CAMP] " . $us["name"] . "님이 경진대회 심사위원으로 초대하였습니다.";
                     $m->tpl_name = "competition_invite";
                     $m->assigns["res"] = $res;
                     $m->assigns["user"] = $us;
                     $m->assigns["main_service_url"] = $this->globals->my_host;
                     $m->assigns["main_service_domain"] = $_SERVER['SERVER_NAME'];
                     $m->send();
                 }
             }
         }
     }
 }
    }
    return $rtn_value;
}
if (!password_valid($password)) {
    $error .= "- Password is invalid.  Can only be letters, numbers and underscores.\r\n";
}
// ------------------------------------------------------------------
// Check Email Address Is Present
// ------------------------------------------------------------------
// if (!$email) { $error .= "- Missing email address.\r\n"; }
// ------------------------------------------------------------------
// Check Email Is Valid
// ------------------------------------------------------------------
function email_valid($credential)
{
    $rtn_value = false;
    if (get_magic_quotes_gpc()) {
        $credential = stripslashes($credential);
    }
    if (preg_match("/^([a-zA-Z0-9_]|\\-|\\.)+@(([a-zA-Z0-9_]|\\-)+\\.)+[a-z]{2,4}\$/i", $credential)) {
        $rtn_value = true;
    }
    return $rtn_value;
}
if (!email_valid($email)) {
    $error .= "- Email address is missing or invalid.\r\n";
}
// ------------------------------------------------------------------
// ALL OTHER VALUES ARE SANITIZED BUT NOT CHECKED AGAINST RULES.
// You can do that below if you want.
// ------------------------------------------------------------------
Example #8
0
 public function sendContact()
 {
     $name = $this->input->post('name', TRUE);
     $email = $this->input->post('email', TRUE);
     $comment = $this->input->post('comment', TRUE);
     $errors = '';
     $success = true;
     // server-side validation
     if (strlen($name) < 2) {
         $success = false;
         $errors .= 'Please provide a valid name.<br />&nbsp;<br />';
     }
     if (!email_valid($email)) {
         $success = false;
         $errors .= 'Please provide a valid e-mail address.<br />&nbsp;<br />';
     }
     if (strlen($comment) < 10) {
         $success = false;
         $errors .= 'We need helpful comments -- at least ten characters!';
     }
     // send mail
     $this->load->library('email');
     $e_fig['charset'] = 'iso-8859-1';
     $e_fig['mailtype'] = 'text';
     $e_fig['crlf'] = '\\r\\n';
     $e_fig['newline'] = '\\r\\n';
     $this->email->initialize($e_fig);
     $this->email->from('*****@*****.**');
     $this->email->to('*****@*****.**');
     $this->email->subject('Log The Dog contact');
     $message = 'Message from ' . $name . ' (' . $email . ')' . PHP_EOL;
     $message .= $comment . PHP_EOL . ' ' . PHP_EOL;
     $message .= 'Browser (user agent): ' . $_SERVER['HTTP_USER_AGENT'] . PHP_EOL;
     $message .= 'User\'s IP address: ' . $_SERVER['REMOTE_ADDR'];
     $this->email->message($message);
     $result = $this->email->send();
     if (!$result) {
         // LOG THIS
         $success = false;
         $errors .= 'There was a problem with the submission. Not your fault, ';
         $errors .= 'but ours. We apologize. We may not have gotten your information.';
     }
     $retArray = array('success' => $success, 'errors' => $errors, 'result' => $result);
     echo json_encode($retArray);
     exit;
 }
Example #9
0
 $sql = sprintf("SELECT id,dnsname FROM domains WHERE id = %d", $db->escapeSimple($_GET['did']));
 $result =& $db->query($sql);
 $data = $result->fetchrow(DB_FETCHMODE_ASSOC);
 $smarty->assign('did', $_GET['did']);
 $smarty->assign('domain', $data['dnsname']);
 $dnsname = $data['dnsname'];
 $domain_id = $_GET['did'];
 if (isset($_POST['submit'])) {
     if (!empty($_POST['address'])) {
         $full_list = $_POST['address'] . "@" . $data['dnsname'];
         if (isset($_POST['public'])) {
             $public = $_POST['public'];
         } else {
             $public = 'n';
         }
         if (!email_valid($_POST['address'])) {
             $smarty->assign('error_msg', 'y');
             $smarty->assign('if_email_valid', 'y');
             $smarty->assign('address', $_POST['address']);
         } else {
             if (email_exist($full_list, $db, 0, 0)) {
                 $smarty->assign('error_msg', 'y');
                 $smarty->assign('if_error_email_exits', 'y');
                 $smarty->assign('full_email', 'y');
                 $smarty->assign('address', $_POST['address']);
             } else {
                 $sql = sprintf("INSERT INTO lists SET address = '%s', domainid = '%s', public = '%s',access=1", $db->escapeSimple(strtolower($full_list)), $db->escapeSimple($_GET['did']), $db->escapeSimple($public));
                 $result =& $db->query($sql);
                 $smarty->assign('success_msg', 'y');
                 $smarty->assign('if_list_created', 'y');
             }
Example #10
0
 public function examiner_add()
 {
     $this->assigns_layout["gnb_left"] = "competition_pool";
     if ($_REQUEST["ex_email"]) {
         $_email = explode(",", $_REQUEST["ex_email"]);
         if ($_email) {
             $len_email = sizeof($_email);
             for ($i = 0; $i < $len_email; $i++) {
                 $_exn = $this->Members->get_by_email($_email[$i]);
                 $arr["user_id"] = $_exn["id"];
                 if (!$_exn) {
                     $arr["email"] = $_email[$i];
                 }
                 $arr["public"] = 1;
                 $check = $this->Competitions_examiner->check($arr);
                 if (!$check) {
                     $_id = $this->Competitions_examiner->add($arr);
                     // mail, activity
                     if (email_valid($_email[$i])) {
                         $m = new TF_mailer($this->settings);
                         $m->mailto = $_email[$i];
                         $m->subject = "[D.CAMP] DCAMP에서 경진대회 심사위원단으로 초대하였습니다.";
                         $m->tpl_name = "competition_pool";
                         $m->assigns["id"] = $_id;
                         $m->assigns["e"] = $_email[$i];
                         $m->assigns["con"] = $_REQUEST["ex_con"];
                         $m->assigns["main_service_url"] = $this->globals->my_host;
                         $m->assigns["main_service_domain"] = $_SERVER['SERVER_NAME'];
                         $m->send();
                     }
                 } else {
                     $_SESSION["msg"] = "이미 초대된 회원이 있습니다.";
                 }
             }
         }
         header("Location: /admin_competition/examiner_list");
     }
 }
Example #11
0
 public function create_account()
 {
     //TODO: verify created account
     $sp = '<br />&nbsp;<br />';
     $this->load->model('login_model');
     $user_email = $this->input->post('user_email', TRUE);
     $user_remail = $this->input->post('user_remail', TRUE);
     $user_password = $this->input->post('user_password', TRUE);
     $user_name = $this->input->post('user_name', TRUE);
     $user_repass = $this->input->post('user_repass', TRUE);
     $user_language = $this->input->post('language', TRUE);
     $gmail = '';
     $g_exists = false;
     $account = array();
     $retArray = array();
     $success = true;
     $invalid = false;
     // flag to reduce redundant error messaging
     $error = '';
     // Do we have a name?
     if (strlen($user_name) < 2) {
         $success = false;
         $error .= 'Please provide your name.';
         if (strlen($user_name) === 1) {
             $error .= ' (Seriously? Just one character?!)';
         }
         $error .= $sp;
     }
     // Is this a plausible e-mail address?
     if (!email_valid($user_email)) {
         $success = false;
         $invalid = true;
         $error .= 'Please provide a valid e-mail address.' . $sp;
     }
     // Does the e-mail address match the confirmation?
     if (!$invalid && $user_email !== $user_remail) {
         $success = false;
         $error .= 'Please ensure your e-mail address is the same in both e-mail fields.' . $sp;
     }
     // Does the password meet the criteria?
     $valid_password = valid_password($user_password, $user_email, $user_name);
     if (!$valid_password['valid']) {
         $success = false;
         $invalid = true;
         $error .= $valid_password['error'];
     } else {
         $invalid = false;
     }
     // Does the password match the confirmation?
     if (!$invalid && $user_password !== $user_repass) {
         $success = false;
         $error .= 'Please ensure your password is the same in both password fields.' . $sp;
     }
     // Is this e-mail address already tied to an account?
     if ($this->login_model->doesUserExist($user_email) && $success) {
         // user was found; do NOT create account
         $success = false;
         $error .= 'We already have that e-mail in our user base.';
     } else {
         // user was not found; create account
         // Is it a Gmail user? If so, check for alias
         if (stristr($user_email, 'gmail.com')) {
             $gmail_parts = explode('@', $user_email);
             $g_user = str_replace('.', '', $gmail_parts[0]);
             $g_user = str_replace('+', '', $g_user);
             $gmail = $g_user . '@gmail.com';
             $g_exists = $this->login_model->checkForGmail($gmail);
         }
         // Return messsage saying it's an existing Gmail alias
         if ($g_exists) {
             $error = 'It appears that your e-mail address is ';
             $error .= 'an alias of a Gmail address that is already ';
             $error .= 'registered. Should we create an accont with ';
             $error .= 'this e-mail address anyway?';
             $success = false;
         }
         if ($success) {
             // no Gmail alias found; continue to create acct
             $password = password_hash($user_password, PASSWORD_BCRYPT);
             $account['username'] = $user_name;
             $account['email'] = $user_email;
             $account['password'] = $password;
             $account['gmail'] = $gmail;
             $account['language'] = $user_language;
             $go_create = $this->login_model->addAccount($account);
             if (!$go_create) {
                 $success = false;
                 $error .= 'There was a problem creating your account. ';
                 $error .= 'We don\'t know what happened, but it was ';
                 $error .= 'most likely our fault. We\'re terribly ';
                 $error .= 'sorry, and we\'ll look into the problem as ';
                 $error .= 'soon as possible.';
             }
         }
     }
     // Return stuff
     $retArray['success'] = $success;
     if ($success) {
         // notify the webmaster that a new user has registered
         $this->load->helper('genmail');
         $mail_info['to'] = '*****@*****.**';
         $mail_info['subject'] = ' *** NEW LTD USER ***';
         $message = 'The following user has registered for an account:<br />';
         foreach ($account as $k => $v) {
             $message .= $k . ': ' . $v . '<br />';
         }
         $message .= '<br />Server info:<br />';
         foreach ($_SERVER as $kk => $vv) {
             $message .= $kk . ': ' . json_encode($vv) . '<br />';
         }
         $mail_info['message'] = $message;
         gen_mail($mail_info);
         // see if the user has any dogs already registered
         $dogs = $this->login_model->retrieveDogs($this->session->userdata('insert_id'), true);
         if ($dogs) {
             $retArray['dogs'] = $dogs;
         }
         $retArray['creds'] = array('email' => $user_email, 'password' => $user_password);
     }
     if (strlen($error) > 0) {
         $retArray['error'] = $error;
     }
     echo json_encode($retArray);
 }
Example #12
0
function newParola($userName, $email)
{
    global $yol1;
    $result1 = "";
    $userName = trim(substr(temizle($userName), 0, 15));
    $email = trim(substr(temizle($email), 0, 50));
    if (!email_valid($email)) {
        return "notValid";
    }
    if ($userName == "" || $email == "") {
        return "emptyData";
    }
    $yeni = newPassw();
    $sql2 = "select * from eo_users where userName='******' and userEmail='{$email}' limit 0,1";
    $result2 = @mysql_query($sql2, $yol1);
    $headers = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-9' . "\r\n";
    $headers .= "From:" . ayarGetir("ayar4char") . "\r\nReply-To:" . ayarGetir("ayar4char") . "\r\n" . 'X-Mailer: PHP/' . phpversion();
    if ($result2 && @mysql_num_rows($result2) == 1) {
        if (@mail($email, "eOgr Parola", "Merhaba, eOgr projesindeki:\nKullanici Adiniz = {$userName} \nYeni Parolaniz= {$yeni} \n Iyi gunler dileriz.", $headers)) {
            $sql1 = "Update eo_users SET userPassword='******' where userName='******' and userEmail='{$email}'";
            $result1 = @mysql_query($sql1, $yol1);
            if ($result1) {
                $result1 = "allOK";
            } else {
                $result1 = "noChange";
            }
        } else {
            $result1 = "mailErr";
        }
    } else {
        $result1 = "noUser";
    }
    @mysql_free_result($result2);
    return $result1;
}