Esempio n. 1
0
 function output_onpost_form_contact()
 {
     global $construct, $main, $db, $lang;
     $main->header->hide = TRUE;
     $main->menu->hide = TRUE;
     $main->footer->hide = TRUE;
     $from = $db->get('username, email', 'users', "id = '" . $main->userdata->user . "'");
     $to_db = $db->get('email', 'users INNER JOIN users_nodes ON users_nodes.user_id = users.id', "users_nodes.node_id = " . intval(get('node')) . ($_POST['email_to_type'] == 'owner' ? " AND users_nodes.owner = 'Y'" : ""));
     $node = $db->get('name, id', 'nodes', "id = " . intval(get('node')));
     $to = array();
     for ($i = 0; $i < count($to_db); $i++) {
         array_push($to, $to_db[$i]['email']);
     }
     $to = implode(', ', $to);
     $subject = $lang['email']['node_contact']['subject_prefix'] . stripslashes($_POST['email_subject']) . $lang['email']['node_contact']['subject_suffix'];
     $body = $lang['email']['node_contact']['body_prefix'] . stripslashes($_POST['email_body']) . $lang['email']['node_contact']['body_suffix'];
     $body = str_replace("##username##", $from[0]['username'], $body);
     $body = str_replace("##node_name##", $node[0]['name'], $body);
     $body = str_replace("##node_id##", $node[0]['id'], $body);
     $ret = @sendmail($to, $subject, $body, $from[0]['username'], $from[0]['email'], TRUE);
     if ($ret) {
         $main->message->set_fromlang('info', 'message_sent');
     } else {
         $main->message->set_fromlang('error', 'generic');
     }
 }
Esempio n. 2
0
function addmail($nom, $fnom, $lnom, $tel, $mail, $service)
{
    // $arrayVariable["column name"] = formatted SQL value
    global $db;
    $mdp = ChaineAleatoire(8);
    $values["pseudo"] = MySQL::SQLValue($nom);
    $values["mail"] = MySQL::SQLValue($mail);
    $values["tel"] = MySQL::SQLValue($tel);
    $values["fonction"] = MySQL::SQLValue($service);
    $values["nom"] = MySQL::SQLValue($fnom);
    $values["prenom"] = MySQL::SQLValue($lnom);
    $values["mdp"] = MySQL::SQLValue($mdp);
    // Execute the insert
    $result = $db->InsertRow("mail", $values);
    // If we have an error
    if (createmail($nom, $mdp)) {
        if (!$result) {
            $db->Kill($result);
            return false;
        } else {
            // createmail($nom,$mdp);
            sendmail($fnom, $mail, $nom, $mdp, $lnom);
            return true;
        }
    } else {
        return false;
    }
}
Esempio n. 3
0
 function addAction()
 {
     if (POST) {
         $uTw = array();
         $uid = decode($_REQUEST['id']);
         $this->scrap->Add(array("scrap" => $_REQUEST['scrap'], "privacy" => $_REQUEST['privacy'], "uid" => $uid));
         $uT = $this->scrap->Get(0, 1, $uid);
         $uT = $uT[0];
         $privacy = $_REQUEST['privacy'] == 'Y' ? ' private ' : '';
         if ($uid != $this->session->user['id']) {
             $scrapTo = new UsersModel($uid);
             $scrapTo = $scrapTo->Info();
             $scrapBy = new UsersModel($this->session->user['id']);
             $scrapBy = $scrapBy->Info();
             $msg = "Hello " . $scrapTo['fname'] . " " . $scrapTo['lname'] . ",<br />\r\n\t\t\t\t\t\t<a href='" . WWW_ROOT . "user/" . encode($scrapBy["id"]) . "'>" . $scrapBy["fname"] . " " . $scrapBy["lname"] . "</a> just send a  {$privacy} scrap to you,<br /><br />\r\n\t\t\t\t\t\t<strong style='font-size:16px'>" . $uT['scrap'] . "</strong><br /><br />\r\n\t\t\t\t\t\tto make reply or read more got to <a href='" . WWW_ROOT . "'>Pepool</a>.\r\n\t\t\t\t\t\t<br /><br />Thanks<br /><a href='" . WWW_ROOT . "'>Pepool.com</a>";
             sendmail($scrapBy["fname"] . " " . $scrapBy["lname"] . " just send {$privacy} scrap to you..", $msg, $scrapTo['email'], $scrapTo['fname'] . ' ' . $scrapTo['lname']);
         }
         $uT["timestamps"] = timeDiff(strtotime($uT["timestamps"]));
         $uT["id"] = encode($uT["id"]);
         $uT["uid"] = encode($uT["uid"]);
         $uT["scrap"] = str($uT["scrap"]);
         $uT["privacy"] = $uT["privacy"];
         $uT["d"] = true;
         $uT["r"] = false;
         die(json_encode($uT));
     }
     die;
 }
Esempio n. 4
0
 function index()
 {
     $data['title'] = lang('lienhe');
     $data['rs'] = $this->contact->get_contact();
     $data['val'] = $this->contact->get_l_contact($this->lang_id);
     $this->form_validation->set_rules('vdata[fullname]', 'Họ tên', 'required');
     $this->form_validation->set_rules('vdata[email]', 'Email', 'required');
     $this->form_validation->set_rules('vdata[title]', 'Tiêu đề', 'required');
     $this->form_validation->set_rules('vdata[content]', 'Nội dung', 'required');
     if ($this->form_validation->run() === FALSE) {
         $this->pre_message = validation_errors();
     } else {
         $vdata = $this->request->post['vdata'];
         $vdata['datesend'] = time();
         if ($this->db->insert('contact', $vdata)) {
             $send = $data['rs']->send_mail;
             if ($send == 1) {
                 $this->load->helper('mail');
                 $to = $data['rs']->email;
                 $name = $vdata['fullname'];
                 $form = $vdata['email'];
                 $subject = $vdata['title'];
                 $message = "<h3>Nội dung liên hệ:</h3></br>";
                 $message .= $vdata['content'];
                 sendmail($name, $form, $to, $subject, $message);
             }
             $this->session->set_flashdata('message', lang('guithanhcong'));
             redirect(uri_string());
         } else {
             $this->pre_message = lang('guikhongthanhcong');
         }
     }
     $data['message'] = $this->pre_message;
     $this->load->templates('index', $data);
 }
Esempio n. 5
0
 public function set_staff_max()
 {
     if (isset($_GET['max'])) {
         $staff_max_data['max'] = $_GET['max'];
     } else {
         $staff_max_data['max'] = 2;
     }
     $a = M('staff');
     $staff_map['status'] = 0;
     $b = $a->where($staff_map)->select();
     foreach ($b as $k => $v) {
         if ($v['max'] != $staff_max_data['max']) {
             $staff_set['staff_id'] = $v['staff_id'];
             $c = $a->where($staff_set)->save($staff_max_data);
             dump($c);
             if (!$c) {
                 sendmail('staff_max set error.' . date("Y-m-d H:i"), 'error', '*****@*****.**');
                 return false;
                 exit;
             }
         }
     }
     echo 'success';
     return true;
 }
Esempio n. 6
0
 /**
  * Parse request build structure and send to admin
  */
 public function mailRequest($data, $detail)
 {
     // dd($data);
     $client = $detail['clientid'];
     $this->transaction = $detail['transactionid'];
     extract($data);
     if (empty($requestid)) {
         die('empty request');
     }
     $this->appendclient($client);
     $requestid = array_filter($requestid);
     foreach ($requestid as $key => $request) {
         $this->process($key, $request);
     }
     $this->close();
     $this->subject = 'New Request From ANASTAT Platform (' . date('D m Y h:i:s') . ')';
     $this->notice = "<br> <b style='color:red'>NOTE :</b> You can always check your requests on our platform using your submission code";
     //Send client a copy
     if (!empty($this->ClientEmail)) {
         sendmail($this->ClientEmail, 'ANASTAT PLATFORM', $this->subject, $this->table . $this->notice);
     }
     //Send admin a copy
     if (!empty(config('site-email'))) {
         sendmail(config('site-email'), 'ANASTAT PLATFORM', $this->subject, $this->table);
     }
     /*
      * If client is affiliate : send manager an email
      * Hide submission code from affiliate
      */
     $this->table = str_replace($this->transaction, '###########', $this->table);
     if (!empty($this->AffiliateEmail)) {
         sendmail($this->AffiliateEmail, 'ANASTAT PLATFORM', $this->subject, $this->table);
     }
 }
Esempio n. 7
0
function parse_group($gid)
{
    global $conn;
    global $mailobj;
    $sql = "SELECT id,active,sendday FROM `blog_article` where `active`=1 and `gid`={$gid}";
    $rs =& $conn->Execute($sql);
    $article_list = $rs->getArray();
    //print_r($article_list);
    $sql = "SELECT * FROM `subscription_user` where `active`=1 and `user_disable`=0 and `gid`={$gid}";
    $rs =& $conn->Execute($sql);
    $user_list = $rs->getArray();
    //print_r($user_list);
    $current = time();
    for ($i = 0; $i < count($article_list); $i++) {
        $afterday = $article_list[$i]["sendday"];
        for ($j = 0; $j < count($user_list); $j++) {
            $activetime = $user_list[$j]["activedate"];
            $activetime = strtotime($activetime);
            //轉成unix 時間
            //echo strtotime($activetime); echo "<br>";
            //echo ($current - $activetime) ;
            //echo ("<br>");
            //echo ($afterday *24*60*60);
            //echo ("<br>");
            if ($current - $activetime >= $afterday * 24 * 60 * 60 && alreaySent($user_list[$j]["Email"], $article_list[$i]["id"]) == false) {
                sendmail($user_list[$j]["Email"], $article_list[$i]["id"], $user_list[$j]["name"], $user_list[$j]["md5"], $gid);
                break;
            }
        }
    }
}
Esempio n. 8
0
function sms_board_handle($c_uid, $sms_datetime, $sms_sender, $sms_receiver, $board_keyword, $board_param = '')
{
    global $web_title, $email_service, $email_footer, $gateway_module, $datetime_now;
    $ok = false;
    if ($sms_sender && $board_keyword && $board_param) {
        // masked sender sets here
        $masked_sender = substr_replace($sms_sender, 'xxxx', -4);
        $db_query = "\n\t    INSERT INTO " . _DB_PREF_ . "_featureBoard_log \n\t    (in_gateway,in_sender,in_masked,in_keyword,in_msg,in_datetime) \n\t    VALUES ('{$gateway_module}','{$sms_sender}','{$masked_sender}','{$board_keyword}','{$board_param}','{$datetime_now}')\n\t";
        if ($cek_ok = @dba_insert_id($db_query)) {
            $db_query1 = "SELECT board_forward_email FROM " . _DB_PREF_ . "_featureBoard WHERE board_keyword='{$board_keyword}'";
            $db_result1 = dba_query($db_query1);
            $db_row1 = dba_fetch_array($db_result1);
            $email = $db_row1['board_forward_email'];
            if ($email) {
                // get name from c_uid's phonebook
                $c_username = uid2username($c_uid);
                $c_name = phonebook_number2name($sms_sender, $c_username);
                $sms_sender = $c_name ? $c_name . ' <' . $sms_sender . '>' : $sms_sender;
                $subject = "[SMSGW-" . $board_keyword . "] " . _('from') . " {$sms_sender}";
                $body = _('Forward WebSMS') . " ({$web_title})\n\n";
                $body .= _('Date and time') . ": {$sms_datetime}\n";
                $body .= _('Sender') . ": {$sms_sender}\n";
                $body .= _('Receiver') . ": {$sms_receiver}\n";
                $body .= _('Keyword') . ": {$board_keyword}\n\n";
                $body .= _('Message') . ":\n{$board_param}\n\n";
                $body .= $email_footer . "\n\n";
                sendmail($email_service, $email, $subject, $body);
            }
            $ok = true;
        }
    }
    return $ok;
}
Esempio n. 9
0
 function output_onpost_form_restore()
 {
     global $main, $db, $vars, $lang;
     $t = $db->get('id, account_code', 'users', "username = '******'users__username'] . "' AND email = '" . $_POST['users__email'] . "'");
     if ($t[0]['id'] != '') {
         if ($t[0]['account_code'] == '') {
             $t[0]['account_code'] = generate_account_code();
             $data['account_code'] = $t[0]['account_code'];
             $db->set('users', $data, "id = '" . $t[0]['id'] . "'");
         }
         $subject = $lang['email']['user_restore']['subject'];
         $subject = str_replace('##username##', $_POST['users__username'], $subject);
         $body = $lang['email']['user_restore']['body'];
         $body = str_replace('##username##', $_POST['users__username'], $body);
         $body = str_replace('##act_link##', $vars['site']['url'] . "?page=users&user="******"&action=restore&account_code=" . $t[0]['account_code'], $body);
         $ret = sendmail($_POST['users__email'], $subject, $body);
         if ($ret) {
             $main->message->set_fromlang('info', 'restore_success');
         } else {
             $main->message->set_fromlang('error', 'generic');
         }
     } else {
         $main->message->set_fromlang('error', 'login_failed');
     }
 }
Esempio n. 10
0
function registerUser($post)
{
    $name = $post['firstName'] . ' ' . $post['lastName'];
    $query = "insert into user set fullName='" . $name . "',\n                email='" . $post['email'] . "', password='******'password'] . "' ,\n                gender='" . $post['gender'] . "',\n                contactNumber='" . $post['contactNumber'] . "',\n                address='" . $post['address'] . "',status= '0'";
    $token = sha1(uniqid($_POST['email'], true));
    $connection = connect();
    $execute = $connection->query($query);
    $tokenAccess = "insert into accessToken set\n                token='" . $token . "', linkStatus= '0', tStamp=NOW() ,role= '0'";
    $accessToken = $connection->query($tokenAccess);
    sendmail($post['email'], $token);
}
Esempio n. 11
0
 public function public_test_mail()
 {
     pc_base::load_sys_func('mail');
     $subject = 'phpcms test mail';
     $message = 'this is a test mail from phpcms team';
     $mail = array('mailsend' => 2, 'maildelimiter' => 1, 'mailusername' => 1, 'server' => $_POST['mail_server'], 'port' => intval($_POST['mail_port']), 'mail_type' => intval($_POST['mail_type']), 'auth' => intval($_POST['mail_auth']), 'from' => $_POST['mail_from'], 'auth_username' => $_POST['mail_user'], 'auth_password' => $_POST['mail_password']);
     if (sendmail($_GET['mail_to'], $subject, $message, $_POST['mail_from'], $mail)) {
         echo L('test_email_succ') . $_GET['mail_to'];
     } else {
         echo L('test_email_faild');
     }
 }
Esempio n. 12
0
 /**
  * 更新账户有效状态
  * @param string $type	第三方平台类型
  */
 public function fail($third, $error_msg = NULL)
 {
     $pid = $third['pid'];
     $type = $third['type'];
     ob_start();
     debug_print_backtrace();
     $trace = ob_get_contents();
     ob_clean();
     Log::customLog('token_expires_error.txt', $this->rep_platform("Token 过期,平台:{pid}|{type}, {platform},{weibo},原因:{$error_msg}\r\n调用堆栈:\r\n{$trace}", $pid, $type));
     $mail = Config::get_mail('token_expire');
     sendmail($mail['to'], $this->rep_platform($mail['subject'], $pid, $type), $this->rep_platform($mail['content'], $pid, $type) . "<br>原因:{$error_msg}");
     return $this->update(array('valid' => 0), array('pid' => $pid, 'type' => $type));
 }
function upload($user_name, $email, $message, $file)
{
    global $dbstamian;
    if (empty($user_name)) {
        echo 'Sorry Username empty';
    } elseif (empty($email)) {
        echo 'Sorry Email empty';
    } elseif (empty($message)) {
        echo 'Sorry Message empty';
    } elseif (empty($file)) {
        echo 'Sorry File Empty';
    } elseif ($file['file_attach']['size'] > 41943040) {
        echo 'Sorry File limit 40 MB';
    } else {
        $file_dir = 'file/';
        $file_name = rand(00, 9999) . "_" . ereg_replace('[[:space:]]+', '_', trim(addslashes(strip_tags($file['file_attach']['name']))));
        $file_size = $file['file_attach']['size'];
        $file_tmp = $file['file_attach']['tmp_name'];
        $file_type = $file['file_attach']['type'];
        $file_ext = strtolower(end(explode('.', $file_name)));
        $regex = "/^([0-9])+_?([0-9a-zA-Z\\_\\-]+).{1}(jpeg|jpg|png|pdf|doc|docx)+/";
        $match = preg_match($regex, $file_name);
        $file_allow = array("jpeg", "jpg", "png", "pdf", "doc", "docx");
        $mim_type = array("image/jpeg", "image/jpg", "image/png", "application/pdf", "application/doc", "application/docx");
        if (in_array($file_ext, $file_allow) === true and in_array($file_type, $mim_type) === true and !file_exists($file_dir, $file_name) and checkemail($email) == true and $match == true) {
            $sql = "INSERT INTO contact(contact.contact_name,contact.contact_email,contact.contact_file,contact.contact_date,contact.contact_message) VALUES('" . $user_name . "','" . $email . "','" . $file_name . "',NOW(),'" . $message . "')";
            $result = mysql_query($sql, $dbstamian);
            mysql_insert_id();
            $send = sendmail($user_name, $email, $message, $file_name, $file_tmp, $file_size, $file_type);
            if (!$result and !$send) {
                echo 'Echec de telechargement, Meri de renvoyer votre fichier';
            } else {
                if ($file['file_attach']['error'] == 1) {
                    echo 'file upload max file size over limit php.ini';
                } elseif ($file['file_attach']['error'] == 2) {
                    echo 'File Max_file_SIZE for form';
                } elseif ($file['file_attach']['error'] == 3) {
                    echo 'upload file not a connect server';
                } elseif ($file['file_attach']['error'] == 4) {
                    echo 'Not a file';
                } elseif ($file['file_attach']['error'] == 0) {
                    @move_uploaded_file($file_tmp, $file_dir . $file_name);
                    echo "Merci votre fichier a été envoyé";
                }
            }
        } else {
            echo 'Echec, votre fichier doit etre au format pdf';
        }
    }
}
Esempio n. 14
0
 public function loadBackOfficeUser()
 {
     $error = '';
     $succes = '';
     if (!empty($_POST)) {
         if (isset($_POST['modifieruser'])) {
             $verificationPhoto = new Verification($_FILES);
             if (!empty($_FILES['photo']['name'])) {
                 $verificationPhoto->PhotoOk('photo', $_POST['pseudouser'] . '.jpg', 'Users/Profil', false);
             }
             if (!empty($_FILES['couverture']['name'])) {
                 $verificationPhoto->PhotoOk('couverture', $_POST['pseudouser'] . '.jpg', 'Users/Bannière', false);
             }
             $error .= $verificationPhoto->error;
             if (!empty($_FILES['photo']['name'])) {
                 $error .= deletePhoto($_POST['pseudouser'] . '.jpg', 'Users/Profil', 'Erreur de suppression du champ photo.');
             }
             if (!empty($_FILES['couverture']['name'])) {
                 $error .= deletePhoto($_POST['pseudouser'] . '.jpg', 'Users/Bannière', 'Erreur de suppression du champ photo.');
             }
             $error .= uploadPhoto($_POST['pseudouser'] . '.jpg', 'Users/Profil', 'photo');
             $error .= uploadPhoto($_POST['pseudouser'] . '.jpg', 'Users/Bannière', 'couverture');
             if (empty($error)) {
                 $this->admin->updateUser($_POST['id_user']);
                 $succes = "Modification effectuée!";
             }
         }
         if (isset($_POST['SupprUser'])) {
             $this->admin->deleteUser($_POST['id_user']);
             $succes = "Utilisateur supprimé avec succès!";
         }
         if (isset($_POST['Ban'])) {
             $this->admin->BanUser($_POST['id_user']);
             $succes = "Utilisateur banni avec succès!";
             $user = $this->user->getDataUserById($_POST['id_user'])->fetchAll();
             sendmail($user[0], 'Bannissement du compte.', 'banned.php');
         }
         if (isset($_POST['unBan'])) {
             $this->admin->UnBanUser($_POST['id_user']);
             $succes = "Utilisateur unban avec succès!";
             $user = $this->user->getDataUserById($_POST['id_user'])->fetchAll();
             sendmail($user[0], 'Unban du compte.', 'unbanned.php');
         }
     }
     $users = $this->user->getDataUsers()->fetchAll();
     $nbGroupeUsers = $this->user->getNbGroupeUsers($users);
     $nbPostUsers = $this->user->getNbPostUsers($users);
     $vue = new Vue("BackOfficeUtilisateur", "Admin", ['font-awesome.css', 'admin.css'], ['Admin/admin.js']);
     $vue->loadbackoffice(['users' => $users, 'nbGroupeUsers' => $nbGroupeUsers, 'nbPostUsers' => $nbPostUsers, 'error' => $error, 'succes' => $succes]);
 }
Esempio n. 15
0
 function addAction()
 {
     if ($this->tweet->Add($_REQUEST['tweet'])) {
         $uT = $this->tweet->Current();
         $user = $this->view->user;
         $Friends = $this->user->GetFriends();
         foreach ($Friends["friends"] as $friend) {
             $msg = "Hello " . $friend['username'] . ",<br />\r\n\t\t <a href='" . WWW_ROOT . "user/" . encode($user["id"]) . "'>" . $user["fname"] . " " . $user["lname"] . "</a> tweets:<br /><br />\r\n\t\t\r\n\t\t<strong style='font-size:16px'>" . $uT["tweet"] . "</strong><br /><br />\r\n\t\tto view more more what " . ($user["gender"] == 'M' ? 'he' : 'she') . " says <a href='" . WWW_ROOT . "user/" . encode($user["id"]) . "'>click here</a>.\r\n\t\t<br /><br />Thanks<br /><a href='" . WWW_ROOT . "'>Pepool.com</a>";
             sendmail($user["fname"] . " " . $user["lname"] . " tweets..", $msg, $friend['email'], $friend['username']);
         }
         $uT["timestamps"] = timeDiff(strtotime($uT["timestamps"]));
         $uT["id"] = encode($uT["id"]);
         $uT["uid"] = encode($uT["uid"]);
         jencode($uT);
     }
 }
 public function ForgotPWD()
 {
     if (isset($_POST['email'])) {
         $dao = D("Members");
         $list = $dao->where("email ='" . $_POST['email'] . "'")->find();
         if (!$list) {
             $this->error("email error, do not have this account!");
         }
         $this->account = $list;
         $sendto = array($_POST['email']);
         $body = $this->fetch("MailTpl:forgotpwd");
         sendmail($sendto, GetValue('sitename') . "- New Password", $body);
         $this->jumpUrl = U('Index/index');
         $this->success("Your password has been sent,Please check your email!");
     }
     $this->display();
 }
Esempio n. 17
0
	function run()
	{
				require("./setting/product.php");
		$set = $config['product'];
				$num = (int)$set['default_mail_maxonce'];
		$sql='select * from '.TABLE_PREFIX.'tttuangou_cron order by addtime ASC Limit 0,'.$num;
		$query = $this->DatabaseHandler->Query($sql);
		$mail=$query->GetAll();
		if(empty($mail))return false;
		foreach($mail as $i => $value)
		{
			sendmail($value['username'], $value['address'], $value['title'], $value['content'], $set);
						$sql='delete from '.TABLE_PREFIX.'tttuangou_cron where id = '.$value['id'];
			$this->DatabaseHandler->Query($sql);
		}
				$this->log("成功发送 {$num} 封邮件!");
		return $num;
	}
Esempio n. 18
0
  function extmail() {
   $req = new stdClass;
   $req->Get  = $_GET;
   $req->Post = $_POST;
   
//   ajax_echo_r ($req);
   
   $subject       = getvariablereq('subject');
   $mail_template = getvariablereq('mail_template');
   $email         = getvariablereq('email');
   $from_name     = getvariablereq('from_name');
   $from_mail     = getvariablereq('from_mail');
   
   $ret = sendmail ($subject, $mail_template, $email, $from_name, $from_mail);
   $req->Result = $ret;
   setCache('request-'.date('Y-m-d-H-i-s'), $req);
   echo json_encode($req);
  }
Esempio n. 19
0
 public function email()
 {
     $uid = cookie('cache_id');
     $email = cookie('em');
     $mail_verify = $uid . '_' . substr(md5($email), 0, 5);
     $mail_verify_url = $_SERVER['HTTP_HOST'] . U('Login/email_verify', 'mail_verify=' . $mail_verify);
     $this->assign('email', $email);
     $this->assign('emailurl', $emailurl);
     $this->assign('mail_verify_url', $mail_verify_url);
     $mail_con = $this->fetch('Login/emailverifycon');
     //发送邮件
     load('@.function_mail');
     $mail_res = sendmail($email, '[途经网]邮箱验证', $mail_con);
     if ($mail_res) {
         echo json_encode(1);
     } else {
         echo 2;
     }
 }
Esempio n. 20
0
/**
* Object constructor
*
* @access public
* @param string $description error description
* @param int $stop 0 - stop script execution, 1 - show warning and continue script execution
*/
  function error($description, $stop=0, $short=0) {
   $script='http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
   $dat=date("M d, Y H:i:s");
   $description=$dat." ".$script."\nError:\n".$description;
   DebMes($description);
   if (Defined("DEBUG_MODE")) {
    if (!$short) {
     $this->alert(nl2br($description));
    } else {
     echo (nl2br($description));
    }
   } else {
    if (!$short) {
     $this->alert("");
    } else {
     echo "Warning...<br>";
    }
   }
   sendmail("errors@".PROJECT_DOMAIN, PROJECT_BUGTRACK, "Error reporting: $script", $description);
   if ($stop) exit;
  }
Esempio n. 21
0
function sms_board_handle($c_uid, $sms_datetime, $sms_sender, $sms_receiver, $board_keyword, $board_param = '', $smsc = '', $raw_message = '')
{
    global $core_config;
    $ok = false;
    $board_keyword = strtoupper(trim($board_keyword));
    $board_param = trim($board_param);
    if ($sms_sender && $board_keyword && $board_param) {
        // masked sender sets here
        $masked_sender = substr_replace($sms_sender, 'xxxx', -4);
        $db_query = "\n\t\t\tINSERT INTO " . _DB_PREF_ . "_featureBoard_log\n\t\t\t(in_gateway,in_sender,in_masked,in_keyword,in_msg,in_datetime)\n\t\t\tVALUES ('{$smsc}','{$sms_sender}','{$masked_sender}','{$board_keyword}','{$board_param}','" . core_get_datetime() . "')";
        if ($cek_ok = @dba_insert_id($db_query)) {
            $db_query1 = "SELECT board_forward_email FROM " . _DB_PREF_ . "_featureBoard WHERE board_keyword='{$board_keyword}'";
            $db_result1 = dba_query($db_query1);
            $db_row1 = dba_fetch_array($db_result1);
            $email = $db_row1['board_forward_email'];
            if ($email) {
                // get name from c_uid's phonebook
                $c_name = phonebook_number2name($c_uid, $sms_sender);
                $sms_sender = $c_name ? $c_name . ' <' . $sms_sender . '>' : $sms_sender;
                $sms_datetime = core_display_datetime($sms_datetime);
                $subject = "[" . $board_keyword . "] " . _('SMS board from') . " {$sms_sender}";
                $body = $core_config['main']['web_title'] . "\n";
                // fixme anton - ran by playsmsd, no http address, disabled for now looking for solution
                // $body.= $core_config['http_path']['base'] . "\n\n";
                $body .= _('Date and time') . ": {$sms_datetime}\n";
                $body .= _('Sender') . ": {$sms_sender}\n";
                $body .= _('Receiver') . ": {$sms_receiver}\n";
                $body .= _('SMS board keyword') . ": {$board_keyword}\n\n";
                $body .= _('Message') . ":\n{$board_param}\n\n";
                $body .= $core_config['main']['email_footer'] . "\n\n";
                $body = stripslashes($body);
                $email_data = array('mail_from_name' => $core_config['main']['web_title'], 'mail_from' => $core_config['main']['email_service'], 'mail_to' => $email, 'mail_subject' => $subject, 'mail_body' => $body);
                sendmail($email_data);
            }
            $ok = true;
        }
    }
    return $ok;
}
 public function forgetpwd()
 {
     if ($this->memberID > 0) {
         $this->redirect($this->referer ? $this->referer : 'Member/index');
     }
     if (IS_POST) {
         $email = I('post.email', '', 'htmlentities');
         $msg = '';
         $sendmail_status = 0;
         //默认发送失败 0-失败 1-成功
         if (!preg_match('/^[\\w\\-\\.]+@[\\w\\-\\.]+(\\.\\w+)+$/', $email)) {
             $msg = 'Please Enter a valid e-mail address.';
         } else {
             if (!D('Members')->where("email='{$email}'")->count()) {
                 $msg = 'Email error, do not have this account';
             } else {
                 $sendto = $email;
                 $body = $this->fetch('Public:forgetpwd');
                 $title = GetValue('sitename') . '- Forgot Password';
                 if ($sendmail_status = sendmail($sendto, $title, $body)) {
                     $msg = 'Your password has been sent,Please check your email.';
                 } else {
                     $msg = 'Please try again or contact your administrator.';
                 }
             }
         }
         $this->assign('msg', $msg);
         $this->assign('sendmail_status', $sendmail_status);
         if ($sendmail_status) {
             $this->display('Admin:sendmail_success');
         } else {
             $this->display('Admin:sendmail_failure');
         }
     } else {
         $this->display();
     }
 }
Esempio n. 23
0
function misc_comments_report()
{
    global $apx, $db, $set, $user;
    $_REQUEST['id'] = (int) $_REQUEST['id'];
    if (!$_REQUEST['id']) {
        die('missing ContentID!');
    }
    $apx->lang->drop('report', 'comments');
    $apx->tmpl->loaddesign('blank');
    headline($apx->lang->get('HEADLINE_REPORT'), str_replace('&', '&amp;', $_SERVER['REQUEST_URI']));
    titlebar($apx->lang->get('HEADLINE_REPORT'));
    //Absenden
    if ($_POST['send']) {
        //Kommentar auslesen
        list($commenttext) = $db->first("SELECT text FROM " . PRE . "_comments WHERE id='" . $_REQUEST['id'] . "' LIMIT 1");
        if (!$_POST['text']) {
            message('back');
        } elseif (!$commenttext) {
            message('invalid comment-ID!');
        } else {
            //eMail senden
            if ($set['comments']['reportmail']) {
                $input['URL'] = $_POST['url'];
                $input['REASON'] = $_POST['text'];
                $input['TEXT'] = $commenttext;
                sendmail($set['comments']['reportmail'], 'REPORT', $input);
            }
            message($apx->lang->get('MSG_OK'));
        }
    } else {
        $apx->tmpl->assign('POSTTO', HTTPDIR . 'misc.php?action=comments_report');
        $apx->tmpl->assign('URL', compatible_hsc($_REQUEST['url']));
        $apx->tmpl->assign('ID', $_REQUEST['id']);
        $apx->tmpl->parse('report', 'comments');
    }
}
Esempio n. 24
0
 /**
  * Object constructor
  *
  * @access public
  *
  * @param string $description Error description
  * @param int    $stop        Stop (0 - stop script execution, 1 - show warning and continue script execution)
  * @param int    $short       Short (default 0)
  * @return void
  */
 public function __construct($description, $stop = 0, $short = 0)
 {
     $script = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     $description = $script . "\nError:\n" . $description;
     $log = getLogger();
     $log->error($description);
     if (defined("DEBUG_MODE")) {
         if (!$short) {
             $this->alert(nl2br($description));
         } else {
             echo nl2br($description);
         }
     } else {
         if (!$short) {
             $this->alert("");
         } else {
             echo "Warning...<br>";
         }
     }
     sendmail("errors@" . PROJECT_DOMAIN, PROJECT_BUGTRACK, "Error reporting: {$script}", $description);
     if ($stop) {
         exit;
     }
 }
Esempio n. 25
0
        list($tmp['uid'], , $tmp['email']) = uc_get_user($username);
        if ($email != $tmp['email']) {
            showmessage('getpasswd_account_notmatch');
        }
        $member = $db->fetch_first("SELECT uid, username, adminid, email FROM {$tablepre}members WHERE uid='{$tmp['uid']}'");
        if (!$member) {
            showmessage('getpasswd_account_notmatch');
        } elseif ($member['adminid'] == 1 || $member['adminid'] == 2) {
            showmessage('getpasswd_account_invalid');
        }
        if ($member['email'] != $tmp['email']) {
            $db->query("UPDATE {$tablepre}members SET email='" . addslashes($tmp['email']) . "' WHERE uid='" . addslashes($tmp['uid']) . "'");
        }
        $idstring = random(6);
        $db->query("UPDATE {$tablepre}memberfields SET authstr='{$timestamp}\t1\t{$idstring}' WHERE uid='{$member['uid']}'");
        sendmail("{$username} <{$tmp['email']}>", 'get_passwd_subject', 'get_passwd_message');
        showmessage('getpasswd_send_succeed', '', 141);
    }
} elseif ($action == 'getpasswd' && $uid && $id) {
    $discuz_action = 141;
    $member = $db->fetch_first("SELECT m.username, m.email, mf.authstr FROM {$tablepre}members m, {$tablepre}memberfields mf\r\n\t\tWHERE m.uid='{$uid}' AND mf.uid=m.uid");
    list($dateline, $operation, $idstring) = explode("\t", $member['authstr']);
    if ($dateline < $timestamp - 86400 * 3 || $operation != 1 || $idstring != $id) {
        showmessage('getpasswd_illegal', NULL, 'HALTED');
    }
    if (!submitcheck('getpwsubmit') || $newpasswd1 != $newpasswd2) {
        $hashid = $id;
        include template('getpasswd');
    } else {
        if ($newpasswd1 != addslashes($newpasswd1)) {
            showmessage('profile_passwd_illegal');
Esempio n. 26
0
            if (file_exists($temp)) {
                $kill .= sprintf(i18n_r('REMOVE_TEMPCONFIG_ERROR'), 'temp.gsconfig.php') . '<br />';
            }
        } else {
            rename($temp, $init);
            if (!file_exists($init)) {
                $kill .= sprintf(i18n_r('MOVE_TEMPCONFIG_ERROR'), 'temp.gsconfig.php', 'gsconfig.php') . '<br />';
            }
        }
        # send email to new administrator
        $subject = $site_full_name . ' ' . i18n_r('EMAIL_COMPLETE');
        $message .= '<p>' . i18n_r('EMAIL_USERNAME') . ': <strong>' . stripslashes($_POST['user']) . '</strong>';
        $message .= '<br>' . i18n_r('EMAIL_PASSWORD') . ': <strong>' . $random . '</strong>';
        $message .= '<br>' . i18n_r('EMAIL_LOGIN') . ': <a href="' . $SITEURL . $GSADMIN . '/">' . $SITEURL . $GSADMIN . '/</a></p>';
        $message .= '<p><em>' . i18n_r('EMAIL_THANKYOU') . ' ' . $site_full_name . '!</em></p>';
        $status = sendmail($EMAIL, $subject, $message);
        # set the login cookie, then redirect user to secure panel
        setcookie('GS_ADMIN_USERNAME', _id($USR));
        create_cookie();
        # check for fatal errors, if none, redirect to
        if ($kill == '') {
            redirect("support.php");
        }
    }
}
get_template('header', $site_full_name . ' &raquo; ' . i18n_r('INSTALLATION'));
?>
	
		<h1><?php 
echo $site_full_name;
?>
Esempio n. 27
0
     $name = $last_name . ' ' . $middle_name . $first_name;
     require $GO_LANGUAGE->get_language_file('email');
     if (!($account_id = $email_client->add_account($new_user_id, $GO_CONFIG->inmail_type, $GO_CONFIG->local_email_host, $GO_CONFIG->inmail_port, $GO_CONFIG->inmail_root, $username, $pass1, $name, $username . "@" . $GO_CONFIG->inmail_host, "", $ml_sent_items, $ml_spam, $ml_trash))) {
         echo "<p class=\"Error\">" . $registration_email_error . "</p>";
         echo "<p class=\"Error\">" . $email_client->last_error . "</p>";
     }
 }
 //send email to the user with password
 $registration_mail_body = str_replace("%sex%", $sir_madam[$_POST['sex']], $registration_mail_body);
 $registration_mail_body = str_replace("%last_name%", $_POST['last_name'], $registration_mail_body);
 $registration_mail_body = str_replace("%middle_name%", $middle_name, $registration_mail_body);
 $registration_mail_body = str_replace("%first_name%", $_POST['first_name'], $registration_mail_body);
 $registration_mail_body = str_replace("%username%", $_POST['username'], $registration_mail_body);
 $registration_mail_body = str_replace("%password%", $_POST['pass1'], $registration_mail_body);
 $registration_mail_body .= "\n\n" . $GO_CONFIG->full_url;
 sendmail($email, $GO_CONFIG->webmaster_email, $GO_CONFIG->title, $registration_mail_subject, $registration_mail_body);
 //used for professional version
 //$user_count = $GO_USERS->get_users();
 //sendmail('*****@*****.**',  $GO_CONFIG->webmaster_email, $GO_CONFIG->title, 'User count for '.$GO_CONFIG->full_url.': '.$user_count, '');
 if (isset($_POST['user_groups'])) {
     while ($group_id = array_shift($_POST['user_groups'])) {
         $GO_GROUPS->add_user_to_group($new_user_id, $group_id);
     }
 }
 //set module permissions
 for ($i = 0; $i < count($module_acl); $i++) {
     $GO_SECURITY->add_user_to_acl($new_user_id, $_POST['module_acl'][$i]);
 }
 //create Group-Office home directory
 $old_umask = umask(00);
 mkdir($GO_CONFIG->file_storage_path . $username, $GO_CONFIG->create_mode);
Esempio n. 28
0
/**
 * Process register an account
 *
 */
function auth_register()
{
    global $core_config;
    $ok = false;
    if ($core_config['main']['cfg_enable_register']) {
        $username = trim($_REQUEST['username']);
        $email = trim($_REQUEST['email']);
        $name = trim($_REQUEST['name']);
        $mobile = trim($_REQUEST['mobile']);
        $error_string = _('Fail to register an account');
        if ($username && $email && $name && $mobile) {
            $db_query = "SELECT * FROM " . _DB_PREF_ . "_tblUser WHERE username='******'";
            $db_result = dba_query($db_query);
            if ($db_row = dba_fetch_array($db_result)) {
                $error_string = _('User is already exists') . " (" . _('username') . ": `" . $username . "`)";
            } else {
                $password = substr(md5(time()), 0, 6);
                $sender = ' - ' . $username;
                if (ereg("^(.+)(.+)\\.(.+)\$", $email, $arr)) {
                    // by default the status is 3 (normal user)
                    $db_query = "\n\t\t\tINSERT INTO " . _DB_PREF_ . "_tblUser (status,username,password,name,mobile,email,sender,credit)\n\t\t\tVALUES ('3','{$username}','{$password}','{$name}','{$mobile}','{$email}','{$sender}','" . $core_config['main']['cfg_default_credit'] . "')\n\t\t    ";
                    if ($new_uid = @dba_insert_id($db_query)) {
                        $ok = true;
                    }
                }
            }
            if ($ok) {
                logger_print("u:" . $username . " email:" . $email . " ip:" . $_SERVER['REMOTE_ADDR'], 3, "register");
                $subject = "[SMSGW] " . _('New account registration');
                $body = $core_config['main']['cfg_web_title'] . "\n";
                $body .= $core_config['http_path']['base'] . "\n\n";
                $body .= _('Username') . "\t: {$username}\n";
                $body .= _('Password') . "\t: {$password}\n\n";
                $body .= $core_config['main']['cfg_email_footer'] . "\n\n";
                $error_string = _('User has been added') . " (" . _('username') . ": `" . $username . "`)";
                $error_string .= "<br />";
                if (sendmail($core_config['main']['cfg_email_service'], $email, $subject, $body)) {
                    $error_string .= _('Password has been sent to your email');
                } else {
                    $error_string .= _('Fail to send email');
                }
            }
        }
    } else {
        $error_string = _('Public registration disabled');
    }
    $errid = logger_set_error_string($error_string);
    header("Location: " . $core_config['http_path']['base'] . "?errid=" . $errid);
    exit;
}
Esempio n. 29
0
if (!$comment) {
    $errors[count($errors)] = 'Please enter your comment.';
}
//if the errors array is empty, send the mail
if (!$errors) {
    //recipient - replace your email here
    $to = '*****@*****.**';
    //sender - from the form
    $from = $name . ' <' . $email . '>';
    //subject and the html message
    $subject = 'Message from ' . $name;
    $message = 'Name: ' . $name . '<br/><br/>
		       Email: ' . $email . '<br/><br/>		
		       Message: ' . nl2br($comment) . '<br/>';
    //send the mail
    $result = sendmail($to, $subject, $message, $from);
    //if POST was used, display the message straight away
    if ($_POST) {
        if ($result) {
            echo 'Thank you! We have received your message.';
        } else {
            echo 'Sorry, unexpected error. Please try again later';
        }
        //else if GET was used, return the boolean value so that
        //ajax script can react accordingly
        //1 means success, 0 means failed
    } else {
        echo $result;
    }
    //if the errors array has values
} else {
        if (@($fp = fopen(DISCUZ_ROOT . './forumdata/dberror.log', 'r'))) {
            while (!feof($fp) && count($errlog) < 20) {
                $log = explode("\t", fgets($fp, 50));
                if ($timestamp - $log[0] < 86400) {
                    $errlog[$log[0]] = $log[1];
                }
            }
            fclose($fp);
        }
        if (!in_array($dberrno, $errlog)) {
            $errlog[$timestamp] = $dberrno;
            @($fp = fopen(DISCUZ_ROOT . './forumdata/dberror.log', 'w'));
            @flock($fp, 2);
            foreach (array_unique($errlog) as $dateline => $errno) {
                @fwrite($fp, "{$dateline}\t{$errno}");
            }
            @fclose($fp);
            if (function_exists('errorlog')) {
                errorlog('MySQL', basename($GLOBALS['_SERVER']['PHP_SELF']) . " : {$dberror} - " . cutstr($sql, 120), 0);
            }
            if ($GLOBALS['dbreport']) {
                echo "<br /><br />An error report has been dispatched to our administrator.";
                @sendmail($GLOBALS['adminemail'], '[Discuz!] MySQL Error Report', "There seems to have been a problem with the database of your Discuz! Board\n\n" . strip_tags($errmsg) . "\n\n" . "Please check-up your MySQL server and forum scripts, similar errors will not be reported again in recent 24 hours\n" . "If you have troubles in solving this problem, please visit Discuz! Community http://www.Discuz.net.");
            }
        } else {
            echo '<br /><br />Similar error report has beed dispatched to administrator before.';
        }
    }
    echo '</p>';
    exit;
}