Example #1
0
File: gae.php Project: hdp/brass
function DoTask()
{
    global $GAME, $unexpectederrormessage;
    if ($GAME['GameStatus'] != 'In Progress' and $GAME['GameStatus'] != 'Recruiting Replacement') {
        $mypage = page::standard();
        $mypage->title_body('Cannot abort this game');
        $mypage->leaf('p', 'This game cannot be aborted just now, perhaps because it has finished. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game, so you cannot vote to abort it. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['AbortVoteActive']) {
        myerror($unexpectederrormessage, 'Unexpected vote page "gae.php" reached');
    }
    if ($GAME['CurrentPlayers'] - $GAME['PlayersMissing'] == 1) {
        abortgame(0);
        dbformatgamedata();
        page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted and aborted game.');
    }
    $GAME['AbortVote'][$GAME['MyColour']] = 1;
    dbformatgamedata();
    for ($i = 0; $i < MAX_PLAYERS; $i++) {
        if ($GAME['PlayerExists'][$i] == 1 and !$GAME['PlayerMissing'][$i] and $i != $GAME['MyColour'] and $GAME['EmailPrompt'][$i] and $GAME['Email'][$i] != '') {
            $subject = 'There is a vote to abort game number ' . $GAME['GameID'];
            $body = '<p>This is an automated message. One of your fellow players in game number ' . $GAME['GameID'] . ' has initiated a vote to abort the game. In order for the game to be aborted, all of the players must agree; this means that a unanimous vote is required. Please visit the game\'s page and either vote in favour of aborting it, or shut the vote down by voting not to abort. Here is the URL of the game page:</p><p><a href="' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '">' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '</a></p>' . EMAIL_FOOTER;
            send_email($subject, $body, $GAME['Email'][$i], null);
        }
    }
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted.');
}
Example #2
0
function register_email($account)
{
    global $_url, $MMORPG_Name, $MMORPG_Description;
    //-----------------------------------------------
    //DECLARE LES VARIABLES
    //-----------------------------------------------
    $sujet = "{$MMORPG_Name} - Validation inscription";
    $destinataire = $account['Account_Email'];
    //'*****@*****.**';
    $url_valid = get_link('Register', 'User', array('Valid' => 'Activer', 'Account_Key' => $account['Account_Key'], 'Account_Email' => $account['Account_Email']));
    $message_texte = 'Bonjour,' . "\n\n" . 'utilisier ce lien dans votre navigateur pour valider votre inscription' . "\n\n" . $url_valid;
    $message_html = '<html> 
     <head> 
     <title>' . $MMORPG_Name . ' - valider votre inscription</title> 
     </head> 
     <body>
		' . $MMORPG_Description . '<hr/>
		Vous venez d\'effectuer l\'inscription sur le site <a href="' . $_url . '">' . $MMORPG_Name . '</a> .<br/><br/>
        Pour valider votre inscription, cliquez sur ce bouton :
        <form method="post" action="' . get_link('Register', 'User') . '">
            <input type="hidden" name="Account_Key" value="' . $account['Account_Key'] . '"/>
            <input type="hidden" name="Account_Email" value="' . $account['Account_Email'] . '"/>
            <input type="submit" name="Valid" value="Activer"/>
        </form>
        
        Ou sur <a href="' . $url_valid . '">ce lien</a>
     </body> 
     </html>';
    debug_log($message_html, false);
    send_email($account['Account_Email'], $sujet, $message_texte, $message_html);
}
Example #3
0
function broadcast_email_notice(&$model, &$rec)
{
    if (!isset($rec->title)) {
        return;
    }
    global $request, $db;
    $i = owner_of($rec);
    $sent_to = array();
    $Subscription = $db->model('Subscription');
    $Subscription->has_one('subscriber:identity');
    $where = array('subscriptions.subscribed' => $i->id);
    $Subscription->set_param('find_by', $where);
    $Subscription->find();
    while ($sub = $Subscription->MoveNext()) {
        $sid = $sub->FirstChild('identities');
        if (!in_array($sid->id, $sent_to) && $sub->email) {
            $html = false;
            // this is the body of the e-mail if ($html == false)
            $text = $rec->title;
            $subject = $i->nickname . " posted a notice";
            send_email($sid->email_value, $subject, $text, environment('email_from'), environment('email_name'), $html);
            $sent_to[] = $sid->id;
        }
    }
}
Example #4
0
 /** Attempts to register a new user and send an email
  * Method: POST 
  */
 public function register_processAction(Request $req)
 {
     $result = array("result" => "", "error" => "");
     $user_register_details = array("user" => array("first_name" => filter_var($req->request->get("uFirstName"), FILTER_SANITIZE_SPECIAL_CHARS), "last_name" => filter_var($req->request->get("uLastName"), FILTER_SANITIZE_SPECIAL_CHARS), "email" => filter_var($req->request->get("uEmail"), FILTER_SANITIZE_EMAIL), "password_dec" => filter_var($req->request->get("uPassword"), FILTER_SANITIZE_SPECIAL_CHARS), "group_name" => "regular", "active" => 1, "created_date" => date("Y-m-d"), "updated_date" => "", "facebook_id" => "", "twitter_id" => ""));
     $false_check_arr = array("first_name", "last_name", "email", "password_dec");
     $user_check = $user_register_details["user"];
     foreach ($false_check_arr as $false_check) {
         if (!$user_check[$false_check]) {
             $result["error"] .= "Please enter a valid value for " . $false_check . ". ";
         }
     }
     if (strlen($result["error"]) == 0) {
         $db_params = get_db_params_from_config();
         $db_conn = new DBConnection($db_params);
         $db_conn->connect();
         $r_user = new RegularUser($db_conn);
         $reg_results = $r_user->register_new(json_encode($user_register_details));
         $result["result"] .= $reg_results["result"];
         $result["error"] .= $reg_results["error"];
     }
     if (strlen($result["error"]) == 0) {
         // Send confirmation email
         $em_result = send_email("*****@*****.**", "*****@*****.**", $user_register_details["email"]);
         // Deal with email errors ...
         return $this->render("TestCMSCMSBundle:Default:create_content.html.twig", array("result" => $result));
     }
     return $this->render("TestCMSCMSBundle:User:register.html.twig", array("result" => $result));
 }
Example #5
0
function friend_add($username)
{
    if (isset($_SESSION["user_id"])) {
        $mysqli = db_connect();
        // fetch the ID of the friend
        $sql = "SELECT * FROM Users WHERE Username='******'";
        $result = $mysqli->query($sql);
        if ($result->num_rows > 0) {
            $user_row = $result->fetch_assoc();
            $user_id = $user_row["Id"];
            // delete the friendship if it exists
            $sql = "DELETE FROM Friends WHERE UserId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " AND FriendId=" . $mysqli->real_escape_string($user_id);
            $result = $mysqli->query($sql);
            // insert a new record
            $sql = "INSERT INTO Friends (UserId,FriendId,Created,IPCreated) VALUES (" . $mysqli->real_escape_string($_SESSION["user_id"]) . "," . $mysqli->real_escape_string($user_id) . ",NOW(),'" . $mysqli->real_escape_string($_SERVER["REMOTE_ADDR"]) . "')";
            $result = $mysqli->query($sql);
            // next find out if the user we are adding as a friend wishes to be informed
            if ($user_row["NotifyNewFriends"] == 1 and $user_row["Status"] == USER_STATUS_VALIDATED) {
                $mail_to = $user_row["Email"];
                $mail_subject = SITE_NAME . " - " . $_SESSION["user_name"] . " added you as a friend!";
                $mail_message = $_SESSION["user_name"] . " added you as a friend!\n\n" . "http://wetheusers.net/" . $_SESSION["user_name"] . "\n\n";
                send_email($mail_to, $mail_subject, $mail_message);
            }
            SendSystemMessage($mysqli, $user_id, $_SESSION["user_name"] . " added you as a friend!", "[" . $_SESSION["user_name"] . "](http://wetheusers.net/" . $_SESSION["user_name"] . ") has added you as a friend", 4);
            return true;
        } else {
            return false;
        }
    } else {
        header("Location: /401");
    }
}
Example #6
0
 public function forget_pass()
 {
     $this->load->helper('email');
     $this->load->helper('string');
     $this->load->model('Users_Model');
     $email = $this->input->post('email');
     if (!valid_email($email)) {
         $this->session->set_flashdata('log_error', 'Please Enter a Valid Email id.');
     } else {
         if ($this->Users_Model->mailexist($email)) {
             $userdetails = $this->Users_Model->getDetailByMailId($email);
             $username = $userdetails->fld_username;
             $fld_id = $userdetails->fld_id;
             $random_Pass = strtolower(random_string());
             $md_pass = md5($random_Pass);
             $data = array('fld_password' => $md_pass);
             $chang_pass = $this->Users_Model->updateUser($fld_id, $data);
             if ($chang_pass) {
                 $url = site_url('administrator');
                 $msg = "<b>New login details</b> <br /> Username : "******" <br /> Password : "******" <br /> Url : <a href='" . $url . "' title='Click Here'>" . $url . "</a>";
                 $sendmail = send_email($email, $subject = 'Password Change', $message = $msg);
                 if ($sendmail) {
                     $this->session->set_flashdata('log_succ', 'Please check your email id, We have sent your login details on your mail Id.');
                 } else {
                     $this->session->set_flashdata('log_error', 'There is some error accoured, Please try again');
                 }
             }
         } else {
             $this->session->set_flashdata('log_error', 'Your email Id is not registered.');
         }
     }
     redirect('administrator/?forget=true');
 }
Example #7
0
 public function contact()
 {
     $this->form_validation->set_rules('name', 'Name', 'required|trim');
     $this->form_validation->set_rules('email', 'Email', 'required|trim|valid_email');
     $this->form_validation->set_rules('message', 'Message', 'required|trim');
     $this->form_validation->set_rules('phone', 'phone', '');
     $this->form_validation->set_rules('subject', 'subject', '');
     $this->form_validation->set_error_delimiters('<div class="error">', '</div>');
     if ($this->form_validation->run() == FALSE) {
         $article = $this->mArticle->get(194195);
         $data = array('main_content' => 'pages/contact');
         $data = array_merge($data, (array) $article);
         $data['form_errors'] = $this->form_validation->error_array();
         $subjects = $this->mUtil->getCodes('Contact Us Subject');
         foreach ($subjects as $s) {
             $data['subjects'][$s] = $s;
         }
         $this->load->view('template', $data);
     } else {
         /*$body = "Name: " . set_value('name') . "<br>";
         		$body .= "Email: " . set_value('email') . "<br>";
         		$body .= "Phone: " . set_value('phone') . "<br>";
         		$body .= "Subject: " . set_value('subject') . "<br>";
         		$body .= "Message: <br><br>" . set_value('message') . "<br>";*/
         $message = $this->load->view('emails/contact', $data, TRUE);
         send_email('*****@*****.**', 'Soundbooka - Contact Us', $message);
         $message = $this->load->view('emails/contact-thank-you', $data, TRUE);
         send_email(set_value('email'), 'Soundbooka - Contact Us', $message);
         $this->session->set_flashdata('message', 'Your message was sent.');
         redirect('/contact');
     }
 }
Example #8
0
    public function support()
    {
        $data = $this->input->post();
        if (count($data)) {
            echo '<script language="javascript" type="text/javascript">
						alert(\'Empty inputs.\');
						window.location = "/";
    				</script>';
            exit;
        }
        // Enter the email where you want to receive the notification when someone submit form
        $recipient = "chi.lieu@cloudberrysoft.com, quan.luu@cloudberrysoft.com, binlieu777@yahoo.com";
        $subject = "Support Form";
        $formcontent = print_r($data, true);
        $this->load->helper('email');
        $success = send_email($recipient, $subject, $formcontent);
        if ($success == true) {
            echo '<script language="javascript" type="text/javascript">
						alert(\'Thank you for you e-mail. We will contact you shortly.\');
						window.location = "/";
					</script>';
        } else {
            echo '<script language="javascript" type="text/javascript">
						alert(\'Email cannot send.\');
						window.location = "/";
    				</script>';
        }
        exit;
    }
Example #9
0
 function recover()
 {
     $return = array("rpta" => false, "message" => "Ingrese correo electronico.");
     $dataPost = $this->input->post();
     $notfind = false;
     if (isset($dataPost['data'])) {
         $rptaTmp = $this->recoverpass->checkmail($dataPost['data']);
         //var_dump("<pre>",$rptaTmp);exit;
         if ($rptaTmp['rpta'] == true) {
             while ($notfind == false) {
                 $string = generateRandomString();
                 $tmp = $this->recoverpass->Find($string);
                 // se comprueba que este codigo no exista en la bd
                 $notfind = $tmp['rpta'];
             }
             $arr = array("email" => $dataPost['data'], "generatecode" => $string);
             $message = "<p>Hemos recibido la solicitud de restaurar su contraseña.</p>" . "<p>Si usted ha solicitado este cambio de contraseña por favor de click <a href='" . site_url('Recoverpass/changePassMail') . "/" . $string . "'>AQUI</a> </p>" . "<p>Caso contrario, por favor ingrese a <a href='http://www.lifeleg.com/'>www.lifeleg.com</a>, y cambie su contraseña.</p>" . "<p>GRACIAS, por pertenecer a nuestra familia, seguiremos trabajando para ofrecerle lo mejor.</p>";
             $rptamail = send_email("Restaurar contraseña", $message, $dataPost['data'], false);
             if ($rptamail == true) {
                 $arr = array("email" => $dataPost['data'], "generatecode" => $string);
                 $this->recoverpass->insertRecover($arr);
                 $return['rpta'] = true;
                 $return['message'] = "Correo enviado correctamente, por favor ingresa a tu bandeja y sigue las instrucciones, Gracias!";
             }
         } else {
             $return['message'] = "E-mail no registrado, verifique y vuelva a intentarlo por favor.";
         }
     }
     echo json_encode($return);
 }
Example #10
0
function form_ajaxed()
{
    $data = $_REQUEST['data'];
    parse_str($data);
    $info = array();
    if (wp_verify_nonce($_wpnonce)) {
        if (empty($fname)) {
            echo 'Please enter your first name';
            die;
        } elseif (empty($sname)) {
            echo 'Please enter your last name';
            die;
        } elseif (empty($email)) {
            echo 'Please enter your email address';
            die;
        } elseif (empty($message)) {
            echo 'Please enter a brief description of your query';
            die;
        } else {
            $info = array("fname" => $fname, "sname" => $sname, "email" => $email);
            if (send_email('*****@*****.**', 'Website Enquiry', $message, $info)) {
                echo 'Email Sent';
            } else {
                echo 'Email Failed';
            }
        }
    } else {
        echo 'There seems to be an issue, please refresh the page and try again.';
        die;
    }
    die;
}
Example #11
0
function send_problem_email($user, $host)
{
    global $master_url;
    $body = "";
    $host_content = "ID: " . $host->id . "\n    Created: " . time_str($host->create_time) . "\n    Venue: " . $host->venue . "\n    Total credit: " . $host->total_credit . "\n    Average credit: " . $host->expavg_credit . "\n    Average update time: " . time_str($host->expavg_time) . "\n    IP address: {$host->last_ip_addr} (same the last {$host->nsame_ip_addr} times)\n    Domain name: " . $host->domain_name;
    $x = $host->timezone / 3600;
    if ($x >= 0) {
        $x = "+{$x}";
    }
    $host_content .= "\n    Local Time = UTC {$x} hours\n    Number of CPUs: " . $host->p_ncpus . "\n    CPU: {$host->p_vendor} {$host->p_model}\n    FP ops/sec: " . $host->p_fpops . "\n    Int ops/sec: " . $host->p_iops . "\n    memory bandwidth: " . $host->p_membw . "\n    Operating System: {$host->os_name} {$host->os_version}";
    $x = $host->m_nbytes / (1024 * 1024);
    $y = round($x, 2);
    $host_content .= "\n    Memory: {$y} MB";
    $x = $host->m_cache / 1024;
    $y = round($x, 2);
    $host_content .= "\n    Cache: {$y} KB";
    $x = $host->m_swap / (1024 * 1024);
    $y = round($x, 2);
    $host_content .= "\n    Swap Space: {$y} MB";
    $x = $host->d_total / (1024 * 1024 * 1024);
    $y = round($x, 2);
    $host_content .= "\n    Total Disk Space: {$y} GB";
    $x = $host->d_free / (1024 * 1024 * 1024);
    $y = round($x, 2);
    $host_content .= "\n    Free Disk Space: {$y} GB\n    Avg network bandwidth (upstream): {$host->n_bwup} bytes/sec\n    Avg network bandwidth (downstream): {$host->n_bwdown} bytes/sec";
    $x = $host->avg_turnaround / 86400;
    $host_content .= "\n    Average turnaround: " . round($x, 2) . " days\n    Number of RPCs: {$host->rpc_seqno}\n    Last RPC: " . time_str($host->rpc_time) . "\n    % of time client on: " . 100 * $host->on_frac . " %\n    % of time host connected: " . 100 * $host->connected_frac . " %\n    % of time user active: " . 100 * $host->active_frac . " %\n    # of results today: " . $host->nresults_today;
    $subject = PROJECT . " notice for {$user->name}";
    $body = PROJECT . " notification:\n\nDear {$user->name}\nYour machine (host # {$host->id}) described below appears to have a misconfigured BOINC\ninstallation.  Could you please have a look at it?\n\nSincerely,\n        The " . PROJECT . " team\n";
    $body .= "\n\nThis is the content of our database:\n" . $host_content . "\n\nFor further information and assistance with " . PROJECT . " go to {$master_url}";
    echo nl2br($body) . "<br><br>";
    return send_email($user, $subject, $body);
}
Example #12
0
 public function add_user()
 {
     $this->form_validation->set_rules('name', 'Name', 'trim|required');
     $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
     $this->form_validation->set_rules('phone', 'Phone', 'trim|required|numeric');
     $this->form_validation->set_rules('password', 'Password', 'trim|required');
     $this->form_validation->set_rules('repassword', 'Confirm Password', 'trim|required');
     $this->form_validation->set_rules('terms', 'Terms', 'trim|required');
     $this->form_validation->set_rules('user', 'User Type', 'trim|required');
     if ($this->form_validation->run() == FALSE) {
         $this->index();
     } else {
         $email = $this->input->post('email');
         $name = $this->input->post('name');
         if ($this->Registermodel->add_user() == true) {
             $sub = "GiveRooms Verification Mail";
             $msg = "<html><p>Dear " . $name . ",</p><p>Thank you for registration on GiveRooms.com,<br/>You need to activate by clicking link below.</p><p>Active Link:<br/><a href='http://www.giverooms.com/register.php?passkey='>http://www.giverooms.com/register.php?passkey=</a></p></html>";
             $this->session->set_flashdata('register', array('messages' => 'successfully !We send verification link to you email.See in your email', 'class' => 'alert-success'));
             send_email('', $email, '', $sub, $msg);
             redirect(site_url('register.html'));
         } else {
             //redirect(site_url('login.html'));
         }
     }
 }
 private function send_reminder($questionnaire)
 {
     $client_name = $questionnaire->client_name;
     $client_email = $questionnaire->client_email;
     $personalized_slug = $questionnaire->personalized_slug;
     $issued_date = $questionnaire->issued_date;
     $progress = $questionnaire->progress;
     // Generate the personalized url
     $personalized_url = site_url("go/{$personalized_slug}");
     $to = $client_email;
     $subject = 'Questionnaire Reminder - ' . $this->config->item('site_name');
     $message = '';
     // Compose the message
     $message .= "Dear {$client_name}," . PHP_EOL;
     $message .= PHP_EOL;
     $message .= "This is a reminder e-mail." . PHP_EOL;
     $message .= "Your questionnaire was issued on {$issued_date} and is {$progress}% complete." . PHP_EOL;
     $message .= PHP_EOL;
     $message .= "Please follow the link below and fill out the Website Design Questionnaire." . PHP_EOL;
     $message .= "{$personalized_url}" . PHP_EOL;
     $message .= PHP_EOL;
     $message .= "Thanks," . PHP_EOL;
     $message .= $this->config->item('site_name');
     // Send the email
     $this->load->helper('email');
     $result = send_email($to, $subject, $message);
     return $result;
 }
Example #14
0
function test_email(){
	$mail_to = "*****@*****.**";
	$mail_subject = "Test Email";
	$mail_message = "This is a test";
	
	send_email($mail_to, $mail_subject, $mail_message, true);
}
Example #15
0
function comment_add()
{
    if (isset($_SESSION["user_id"])) {
        $post_id = isset($_POST["post_id"]) ? $_POST["post_id"] : "";
        $body = isset($_POST["body"]) ? $_POST["body"] : "";
        if ($post_id != "" && $body != "") {
            $mysqli = db_connect();
            $sql = "SELECT Posts.Id,Posts.Title,Users.NotifyComments,Users.Username,Users.Email,Posts.UserId FROM Posts" . " INNER JOIN Users ON Users.Id=Posts.UserId" . " WHERE Posts.Id=" . $mysqli->real_escape_string($post_id);
            $post_result = $mysqli->query($sql);
            if ($post_result->num_rows > 0) {
                $post_row = $post_result->fetch_assoc();
                $link_title = $post_row["Title"] != "" ? $post_row["Title"] : "Untitled";
                // Add the comment to the comments table
                $sql = "INSERT INTO Comments (" . "PostId,UserId,Body,Created,IPCreated" . ") VALUES (" . $mysqli->real_escape_string($post_id) . "," . $mysqli->real_escape_string($_SESSION["user_id"]) . ",'" . $mysqli->real_escape_string($body) . "'" . ",Now()" . ",'" . $mysqli->real_escape_string($_SERVER["REMOTE_ADDR"]) . "'" . ")";
                $mysqli->query($sql);
                $new_comment_id = $mysqli->insert_id;
                // Update the number of comments on the post
                $count_sql = "SELECT COUNT(*) AS NumComments FROM Comments WHERE PostId=" . $mysqli->real_escape_string($post_id);
                $count_result = $mysqli->query($count_sql);
                $count_row = $count_result->fetch_assoc();
                $update_sql = "UPDATE Posts SET Comments=" . $mysqli->real_escape_string($count_row["NumComments"]) . " WHERE Id=" . $mysqli->real_escape_string($post_id);
                $update_result = $mysqli->query($update_sql);
                // do an email notification if required
                if ($post_row["UserId"] != $_SESSION["user_id"]) {
                    if ($post_row["NotifyComments"] == 1) {
                        $mail_to = $post_row["Email"];
                        $mail_subject = SITE_NAME . " - " . $_SESSION["user_name"] . " commented on '" . $post_row["Title"] . "'";
                        $mail_message = "You have received a new comment on your post '" . $link_title . "' by " . $_SESSION["user_name"] . "...\n---\n" . $body . "\n - " . $_SESSION["user_name"] . " (http://wetheusers.net/" . $_SESSION["user_name"] . ")\n---\n" . "http://wetheusers.net/post/" . $post_row["Id"] . "/" . toAscii($link_title) . "\n\n";
                        send_email($mail_to, $mail_subject, $mail_message);
                    }
                    SendSystemMessage($mysqli, $post_row["UserId"], $_SESSION["user_name"] . " commented on your post '" . $link_title . "'", "[" . $_SESSION["user_name"] . "](http://wetheusers.net/" . $_SESSION["user_name"] . ") commented on your post [" . $link_title . "](http://wetheusers.net/post/" . $post_row["Id"] . "/" . toAscii($link_title) . ")\n\n" . $body, 1);
                }
                // find out people who have commented previously that have NotifyOtherComments switched on
                $sql = "SELECT DISTINCT Users.Id AS UserId, Users.Email AS Email,Users.NotifyOtherComments" . " FROM Users" . " INNER JOIN Comments ON Comments.UserId=Users.Id AND Comments.PostId=" . $post_row["Id"] . " INNER JOIN Posts ON Posts.Id=" . $post_row["Id"] . " WHERE Comments.UserId<>" . $mysqli->real_escape_string($_SESSION["user_id"]) . " AND Posts.UserId<>Comments.UserId";
                // not if you wrote the comment
                // not if you wrote the post
                $result = $mysqli->query($sql);
                if ($result->num_rows > 0) {
                    while ($comment_row = @$result->fetch_assoc()) {
                        if ($comment_row["NotifyOtherComments"] == 1 && $post_row["UserId"] != $_SESSION["user_id"]) {
                            $mail_to = $comment_row["Email"];
                            $mail_subject = $_SESSION["user_name"] . " commented on '" . $post_row["Title"] . "' too";
                            $mail_message = "A new comment has been posted by " . $_SESSION["user_name"] . " on '" . $link_title . "' by " . $post_row["Username"] . ".\n---\n" . $body . "\n - " . $_SESSION["user_name"] . " (http://wetheusers.net/" . $_SESSION["user_name"] . ")\n---\n" . "http://wetheusers.net/post/" . $post_row["Id"] . "/" . toAscii($post_row["Title"]) . "\n\n";
                            send_email($mail_to, $mail_subject, $mail_message);
                        }
                        SendSystemMessage($mysqli, $comment_row["UserId"], "'" . $_SESSION["user_name"] . "' posted a new comment on '" . $link_title . "' by " . $post_row["Username"], "A new comment has been posted by [" . $_SESSION["user_name"] . "](http://wetheusers.net/" . $_SESSION["user_name"] . ") on [" . $link_title . "](http://wetheusers.net/post/" . $post_row["Id"] . "/" . toAscii($link_title) . ") by [" . $post_row["Username"] . "](http://wetheusers.net/" . $post_row["Username"] . ") (you have also commented on this post)\n\n" . $body, 2);
                    }
                }
                return "success";
            } else {
                header("Location: /404");
            }
        } else {
            header("Location: " . $_SERVER["HTTP_REFERER"] . "/failure");
        }
    } else {
        header("Location: /401");
    }
}
Example #16
0
function _send_email($name, $email, $feedback)
{
    $from = mb_encode_mimeheader($name, 'UTF-8') . '<' . $email . '>';
    $to = FEEDBACK_RECIPIENT;
    $subject = mb_encode_mimeheader(FEEDBACK_SUBJECT, 'UTF-8');
    $body = addslashes($feedback);
    return send_email($from, $to, $subject, $body);
}
Example #17
0
function error($message)
{
    global $error_message;
    $error_message = $message;
    global $administrator_email;
    send_email($administrator_email, 'System Error!', $message);
    goto_url("error.php?e={$error_message}");
}
Example #18
0
function send_notify_email($userid, $message)
{
    $user = BoincUser::lookup_id($userid);
    $subject = "Daily notification summary from " . PROJECT;
    $body = "The following events occurred in the past day at " . PROJECT . ".\nFor details, visit your Account page at\n" . secure_url_base() . "home.php\n\n{$message}\n---------------\nTo change your email preferences for " . PROJECT . ", visit:\n" . secure_url_base() . "edit_forum_preferences_form.php\n\nDo not reply to this email.\n";
    send_email($user, $subject, $body);
    echo "sending to {$user->email_addr}\n";
}
Example #19
0
File: gal.php Project: hdp/brass
function DoTask()
{
    global $Administrator, $GAME, $unexpectederrormessage;
    if ($GAME['GameStatus'] != 'Recruiting Replacement') {
        $mypage = page::standard();
        $mypage->title_body('Current player is not missing');
        $mypage->leaf('p', 'The current player is not missing. (Perhaps somebody accepted a replacement player after you had loaded the board page.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game, so you cannot choose replacement players. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    $ReplacementValid = false;
    for ($i = 0; $i < count($GAME['ReplacementOffers']); $i++) {
        if ($GAME['ReplacementOffers'][$i][2] == $GAME['PlayerToMove'] and $GAME['ReplacementOffers'][$i][0] == @$_POST['whotoaccept']) {
            $ReplacementValid = $i;
        }
    }
    if ($ReplacementValid === false) {
        $mypage = page::standard();
        $mypage->title_body('User ID not found among replacements');
        $mypage->leaf('p', 'The submitted user ID was not found among the candidate replacements. (Perhaps the user withdrew his request after you had loaded the board page.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    $QR = dbquery(DBQUERY_READ_SINGLEROW, 'SELECT "Name", "Pronoun", "Email", "EmailPrompt" FROM "User" WHERE "UserID" = :user:'******'user', $GAME['ReplacementOffers'][$ReplacementValid][0]);
    if ($QR === 'NONE') {
        myerror($unexpectederrormessage, 'Candidate replacements list contains invalid user');
    }
    switch ($QR['Pronoun']) {
        case 'He':
            $RepPronoun = 'A';
            break;
        case 'She':
            $RepPronoun = 'B';
            break;
        default:
            $RepPronoun = 'C';
            break;
    }
    $GAME['AltGameTicker'] .= '8E' . callmovetimediff() . letter_end_number($GAME['ReplacementOffers'][$ReplacementValid][0]) . $RepPronoun . letter_end_number($GAME['MyColour']);
    $GAME['GameTickerNames'] .= '|' . $GAME['ReplacementOffers'][$ReplacementValid][1];
    $GAME['PlayerName'][$GAME['PlayerToMove']] = $QR['Name'];
    $GAME['KickVote'] = '00000';
    $GAME['GameStatus'] = 'In Progress';
    $GAME['MoveMade'] = 1;
    dbquery(DBQUERY_WRITE, 'DELETE FROM "ReplacementOffer" WHERE "Game" = :game: AND "Colour" = :colour:', 'game', $GAME['GameID'], 'colour', $GAME['PlayerToMove']);
    dbquery(DBQUERY_WRITE, 'INSERT INTO "PlayerGameRcd" ("User", "Game", "GameResult", "Inherited", "GameCounts", "Colour", "NumLongTurns", "CurrentOccupant") VALUES (:user:, :game:, \'Playing\', 1, :counts:, :colour:, 0, 0)', 'user', $GAME['ReplacementOffers'][$ReplacementValid][0], 'game', $GAME['GameID'], 'counts', $GAME['ReplacementOffers'][$ReplacementValid][3], 'colour', $GAME['PlayerToMove']);
    dbformatgamedata();
    if ($QR['EmailPrompt'] and $QR['Email'] != '') {
        $subject = 'Your request to join game number ' . $GAME['GameID'] . ' has been accepted';
        $body = '<p>This is an automated message. One of the players in game number ' . $GAME['GameID'] . ' has accepted your request to join the game as a replacement player. This means that it is now your turn to move; please visit the game\'s page and take your turn. Here is the URL of the game page:</p><p><a href="' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '">' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '</a></p>' . EMAIL_FOOTER;
        send_email($subject, $body, $QR['Email'], null);
    }
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully accepted replacement.');
}
Example #20
0
/**
 * Wraps sending e-mails for a particular e-mail, so we can
 * - keep track of emails sent
 * - set locales eventually
 */
function send_user_email(array $user, $template_id, $args = array())
{
    $args["name"] = $user["name"] ? $user["name"] : $user["email"];
    send_email($user, $template_id, $args);
    if (isset($user['id'])) {
        $q = db()->prepare("UPDATE user_properties SET emails_sent=emails_sent+1 WHERE id=?");
        $q->execute(array($user['id']));
    }
}
Example #21
0
function register_user($database_handler, $user_details)
{
    $field = '`' . implode('` , `', array_keys($user_details)) . '`';
    $data = '\'' . implode('\' , \'', $user_details) . '\'';
    $sql_query = "INSERT INTO `users` ({$field}) VALUES({$data})";
    mysqli_query($database_handler, $sql_query);
    $subject = 'Activate your account';
    $body = "Hello " . $user_details['user_first_name'] . " " . $user_details['user_last_name'] . "\n\nYou need to activate your account by clicking the link below:\n\nhttp://localhost/Mini_Project/Pages/activate.php?email=" . $user_details['user_email'] . "&email_code=" . $user_details['user_email_code'] . "\n\n- Social";
    send_email($user_details['user_email'], $subject, $body);
}
function validate_and_send()
{
    $validation = validate_informations();
    if ($validation && $validation['validate'] === true) {
        send_email($validation);
        return array('status' => 'positive', 'message' => 'Message delivered.');
    } else {
        return array('status' => 'error', 'message' => 'The message has not been delivered, please try again or contact the website admin.');
    }
}
Example #23
0
function do_invite_email($addr, $token, &$group)
{
    global $request;
    $link = $request->url_for(array('ident' => $token));
    $subject = 'You were added to a group on ' . $request->base;
    $email = "Hi, you have been invited to join the " . $group->name . " group on " . $request->base . ".\n\n";
    $email .= "Click here to check it out --> {$link} \n\n";
    $html = false;
    send_email($addr, $subject, $email, environment('email_from'), environment('email_name'), $html);
}
Example #24
0
 function getAlerts()
 {
     $this->load->model('heartbeat_model');
     $this->load->helper('email');
     $errors = $this->heartbeat_model->emailStatus();
     if ($errors > 0) {
         $message = "You have {$errors} error(s) with your network.";
         send_email('*****@*****.**', 'Network Trouble', $message);
     }
 }
Example #25
0
function register_email($account)
{
    global $MMORPG_Name;
    debug_log("register-member-end => send mail init");
    $sujet = "{$MMORPG_Name} - Validation inscription";
    $destinataire = $account['Account_Email'];
    //'*****@*****.**';
    list($message_texte, $message_html) = content_valid_mail($account);
    send_email($account['Account_Email'], $sujet, $message_texte, $message_html);
}
Example #26
0
function handle_success($file)
{
    if (lock_exists($file)) {
        if (remove_lock($file)) {
            send_email("Uptime Detected for {$file}");
        } else {
            // could not remove lock
        }
    }
}
Example #27
0
File: gai.php Project: hdp/brass
function DoTask()
{
    global $GAME, $PlayersVotingToKick;
    if ($GAME['GameStatus'] != 'Recruiting Replacement') {
        $mypage = page::standard();
        $mypage->title_body('Cannot vote to downsize this game');
        $mypage->leaf('p', 'This game is not currently seeking a replacement player, so you cannot vote to downsize it. (Perhaps something happened after you loaded the board page.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['CurrentPlayers'] == 3) {
        $mypage = page::standard();
        $mypage->title_body('Cannot downsize a 3-player game');
        $mypage->leaf('p', 'At present, it is not permitted for a 3-player game to be downsized. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['CurrentPlayers'] == $GAME['MinimumPlayersAllowed'] and $GAME['MinimumPlayersAllowed'] > 2) {
        $mypage = page::standard();
        $mypage->title_body('Cannot downsize from this number of players');
        $mypage->leaf('p', 'This game cannot be downsized, as the game board in use does not support fewer than ' . $GAME['MinimumPlayersAllowed'] . ' players. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game, so you cannot vote to downsize it. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (@$_POST['DSVote'] == 'Yes') {
        if ($GAME['PlayersVotingToKick'] - $GAME['IHaveKickVoted'] + 1 >= $GAME['CurrentPlayers']) {
            require HIDDEN_FILES_PATH . 'downsizeresource.php';
            downsizegame(false);
            $didsomething = 1;
            while ($didsomething) {
                $didsomething = gamecheck();
            }
            dbformatgamedata();
            page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted and downsized game.');
        }
        $GAME['KickVote'][$GAME['MyColour']] = 1;
        dbformatgamedata();
        if (!$GAME['KickVoteActive']) {
            for ($i = 0; $i < MAX_PLAYERS; $i++) {
                if ($GAME['PlayerExists'][$i] == 1 and !$GAME['PlayerMissing'][$i] and !$GAME['PlayersVotingToKick'] and $i != $GAME['MyColour'] and $GAME['EmailPrompt'][$i] and $GAME['Email'][$i] != '') {
                    $subject = 'There is a vote to downsize game number ' . $GAME['GameID'];
                    $body = '<p>This is an automated message. One of your fellow players in game number ' . $GAME['GameID'] . ' has initiated a vote to downsize the game instead of recruiting a replacement player. In order for the game to be downsized, all of the players must agree; this means that a unanimous vote is required. If you would like the game to be downsized, then please visit the game\'s page and vote in favour of downsizing. If you do not want the game to be downsized, then no action is required other than to accept a replacement if one asks to join. (You will be emailed if this happens. Bear in mind that if a replacement is not found before the Time Limit B for this game is exceeded, then the game will be downsized anyway.) Here is the URL of the game page:</p><p><a href="' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '">' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '</a></p>' . EMAIL_FOOTER;
                    send_email($subject, $body, $GAME['Email'][$i], null);
                }
            }
        }
        page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted.');
    }
    $GAME['KickVote'][$GAME['MyColour']] = 0;
    dbformatgamedata();
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted.');
}
Example #28
0
File: gah.php Project: hdp/brass
function DoTask()
{
    global $GAME;
    if ($GAME['GameStatus'] != 'In Progress') {
        $mypage = page::standard();
        $mypage->title_body('Cannot vote to remove players from this game');
        $mypage->leaf('p', 'At the moment you cannot vote to remove players from this game. This might be because the game has finished, or it might be because the game is seeking a replacement player. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game, so you cannot vote to remove players. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == $GAME['PlayerToMove']) {
        $mypage = page::standard();
        $mypage->title_body('Cannot vote to kick yourself');
        $mypage->leaf('p', 'You cannot vote to kick yourself. If you want to leave the game, please select the option to "Quit" instead. Click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (!$GAME['CanKickVote']) {
        $mypage = page::standard();
        $mypage->title_body('Kick vote not currently available');
        $mypage->leaf('p', 'The option to vote to kick the current player is not presently available. (Perhaps the player you were waiting for took his turn in the meantime.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (!$GAME['KickVoteActive']) {
        $mypage = page::standard();
        $mypage->title_body('No vote is taking place');
        $mypage->leaf('p', 'At present, no vote on kicking the current player is taking place. (Perhaps the player you were waiting for took his turn in the meantime, or perhaps another player voted against.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (@$_POST['votevalueA']) {
        if ($GAME['PlayersVotingToKick'] - $GAME['IHaveKickVoted'] + 2 >= $GAME['CurrentPlayers']) {
            $NameOfKickedPlayer = $GAME['PlayerFullName'][$GAME['PlayerToMove']];
            KickPlayer($GAME['PlayerToMove'], 2);
            dbformatgamedata();
            page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted and kicked player.');
        }
        $GAME['KickVote'][$GAME['MyColour']] = 1;
        dbformatgamedata();
        page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted.');
    }
    $GAME['KickVote'] = '00000';
    dbformatgamedata();
    for ($i = 0; $i < MAX_PLAYERS; $i++) {
        if ($GAME['PlayerExists'][$i] == 1 and !$GAME['PlayerMissing'][$i] and $i != $GAME['MyColour'] and $GAME['EmailPrompt'][$i] and $GAME['Email'][$i] != '' and $i != $GAME['PlayerToMove']) {
            $subject = 'The vote to kick ' . $GAME['PlayerFullName'][$GAME['PlayerToMove']] . 'from game number ' . $GAME['GameID'] . ' has failed';
            $body = '<p>This is an automated message. One of your fellow players in game number ' . $GAME['GameID'] . ' has voted against kicking ' . $GAME['PlayerFullName'][$GAME['PlayerToMove']] . ' from the game. In order for ' . $GAME['OtherPronounLC'][$GAME['PlayerToMove']] . ' to be kicked, all of the players must agree; this means that a unanimous vote is required. So, ' . $GAME['PronounLC'][$GAME['PlayerToMove']] . ' will not be kicked at this time. Here is the URL of the game page:</p><p><a href="' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '">' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '</a></p>' . EMAIL_FOOTER;
            send_email($subject, $body, $GAME['Email'][$i], null);
        }
    }
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted.');
}
Example #29
0
/**
 * Send an email to the email addresses listed in the alerts config
 *
 * @param String $msg
 * @param String $subject
 * @param String $from
 * @param array $to { default : NULL }
 * @return boolean
 */
function send_alert($msg, $subject = 'TrackStreet Alert', $from = 'TrackStreet', $to = NULL)
{
    $ci =& get_instance();
    if (empty($to)) {
        $to = $ci->config->item('alerts');
    }
    if (!is_array($to)) {
        $to = array((string) $to);
    }
    return send_email($to, $from, $subject, $msg);
}
function send_validate_email()
{
    global $master_url;
    $user = get_logged_in_user();
    $x2 = uniqid(rand(), true);
    $user->update("signature='{$x2}'");
    send_email($user, tra("Validate BOINC email address"), tra("Please visit the following link to validate the email address of your %1 account:", PROJECT) . "\n" . $master_url . "validate_email_addr.php?validate=1&u={$user->id}&x={$x2}");
    page_head(tra("Validate email sent"));
    echo tra("An email has been sent to %1. Visit the link it contains to validate your email address.", $user->email_addr);
    page_tail();
}