/**
 * 
 * Function receive message
 * This function is used to handle how an error message is used
 * @param string $user_name = username the error relates to
 * @param string $type = user / Admin / system
 * @param string $level = how serious the problem is, or whether it is a sucess
 * @param string $subject = The title of the error problem (a preci effectively)
 * @param string $content = The error message in full.
 * @version 1.0
 * @author Patrick Lockley
 */
function receive_message($user_name, $type, $level, $subject, $content)
{
    global $xerte_toolkits_site;
    if ($level != "SUCCESS") {
        $_SESSION['toolkits_most_recent_error'] = $subject . " " . $content;
    }
    /*
     * If error log message turned on, create an error log
     */
    if (isset($xerte_toolkits_site->error_log_message) && $xerte_toolkits_site->error_log_message == "true") {
        write_message($user_name, $type, $level, $subject, $content);
    }
    /*
     * If error email message turned on, send an error email message 
     */
    if (isset($xerte_toolkits_site->error_email_message) && $xerte_toolkits_site->error_email_message == "true") {
        email_message($user_name, $type, $level, $subject, $content);
    }
}
        //echo '<br><br><br>' . $query . '<br>';
        $result = $mysqli->query($query);
        $row = $result->fetch_assoc();
        $query = "SELECT * FROM users WHERE id = " . $row['requesterid'];
        $result = $mysqli->query($query);
        $row2 = $result->fetch_assoc();
        $query = "SELECT * FROM achievementList WHERE id = " . $row['achievementid'];
        $result = $mysqli->query($query);
        $temprow = $result->fetch_assoc();
        $row2['name'] = $temprow['name'];
        $row2['level'] = $level;
        $row2['comment'] = $row['comment'];
        if (trim($row2['comment']) == '') {
            $row2['comment'] = 'No comment entered';
        }
        email_message('Achievement ' . $row2['name'] . ' Denied', $row2['onid'] . '@oregonstate.edu', create_message('./emails/deny.eml', $row2));
        echo '<h3><BR><BR>All Done!</h3><a href="./home.php">Go Back</a>';
        exit;
    } else {
        //Should generate an email someone is poking around
        echo '';
    }
}
if (isset($_REQUEST['reviewhash'])) {
    $hash = mysqli_real_escape_string($mysqli, $_REQUEST['reviewhash']);
    if ($userrow['userlevel'] > 2) {
        echo "<div class='row'><div style='padding-top:5em;' class='col-sm-8 col-sm-offset-2'><h3>About to process hash: {$hash}</h3></div></div>";
        $query = "SELECT * FROM requests WHERE hash = '{$hash}'";
        $result = $mysqli->query($query);
        $row = $result->fetch_assoc();
        $query = "SELECT * FROM users WHERE id = " . $row['requesterid'];
function addachievement($mysqli, $achievement, $level, $id)
{
    $empRes = $mysqli->query("SELECT achievements.*, levels.level FROM achievements INNER JOIN levels ON levels.id = achievements.levelid WHERE userid='{$id}'");
    //echo $query .'<BR>';
    $empAch = array();
    while ($empRow = $empRes->fetch_array(MYSQLI_ASSOC)) {
        $empAch[] = $empRow;
    }
    $done = false;
    foreach ($empAch as $row) {
        if ($row['achievementid'] == $achievement) {
            //Already has at least one level
            if ($level == $row['level']) {
                // Already have this exact level
                echo "<script>alert('Already has this achievement at this level.');</script>";
                $done = true;
            } else {
                if ($level < $row['level']) {
                    echo "<script>alert('Already has this achievement at a higher level. Adding this anyways.');</script>";
                    $done = false;
                } else {
                    $done = false;
                }
            }
        }
    }
    if ($done == false) {
        // We need to add this to
        $query = "SELECT * FROM levels WHERE achievementid = {$achievement} AND level = {$level}";
        $levelRes = $mysqli->query($query);
        //echo $query . '<BR>';
        $levelRow = $levelRes->fetch_array(MYSQLI_ASSOC);
        $query = "INSERT INTO `achievements` (achievementid, levelid, userid) VALUES ({$achievement}, " . $levelRow['id'] . ", {$id})";
        //echo $query . '<BR>';
        $mysqli->query($query);
        //Need to send confirmation email here
        $query = "SELECT * FROM users WHERE id = {$id}";
        $result = $mysqli->query($query);
        $row = $result->fetch_assoc();
        $query = "SELECT * FROM achievementList WHERE id = {$achievement}";
        $result = $mysqli->query($query);
        $temprow = $result->fetch_assoc();
        $row['name'] = $temprow['name'];
        $row['level'] = $level;
        email_message('Achievement ' . $row['name'] . ' Approved', $row['onid'] . '@oregonstate.edu', create_message('./emails/approved.eml', $row));
    }
}
Example #4
0
  <div class="width500">
    <?php 
echo first_time_visitor_message();
?>
 
    <?php 
echo email_message();
?>
 

    <p>
        <!-- Place your own welcome message between the 2 sets of asterisks (*) below -->
        <!-- ************************************************************************ -->
        Welcome to <?php 
echo $site_full_name;
?>
, an online database of genetic
        variations organized by expert curators.
        <!-- ************************************************************************ -->
    </p>

    <p>Variations are organized by gene and categorized as:</p> 
    <ul>
       <li><strong>Pathogenic</strong></li>
       <li><strong>Probable pathogenic</strong></li>
       <li><strong>Possibly pathogenic</strong></li>
       <li><strong>Predicted non-pathogenic</strong></li>
       <li><strong>Probable non-pathogenic</strong></li>
       <li><strong>Non-pathogenic</strong></li>
       <li><strong>Unknown Significance</strong></li>
    </ul>
Example #5
0
            $requestid = $mysqli->insert_id;
            //Email the requester with information
            $query = "SELECT * FROM achievementList WHERE id = {$achievement}";
            $result = $mysqli->query($query);
            $row = $result->fetch_assoc();
            $userrow['name'] = $row['name'];
            $userrow['level'] = $level;
            email_message('Achievement Request', $userrow['onid'] . '@oregonstate.edu', create_message('./emails/request.eml', $userrow));
            //Identify reviewers
            $query = "SELECT DISTINCT users.* FROM users INNER JOIN achievements ON achievements.userid = users.id INNER JOIN levels ON levels.id = achievements.levelid WHERE achievements.achievementid = {$achievement} AND levels.level >= {$level} GROUP BY users.id LIMIT 5";
            //echo $query . '<BR>';
            $result = $mysqli->query($query);
            while ($row = $result->fetch_assoc()) {
                //echo 'Emailing: ' . $row['username'] . '<BR>';
                $userrow['reviewername'] = $row['username'];
                if (email_message('Achievement Review Request', $row['onid'] . '@oregonstate.edu', create_message('./emails/committee.eml', $userrow)) == 0) {
                    // It worked
                    $query = "INSERT INTO reviews (requestid, reviewer, emaileddate) VALUES ({$requestid}, " . $row['id'] . ", NOW())";
                    $mysqli->query($query);
                }
            }
        }
    }
}
if (isset($_REQUEST['btn-give'])) {
    $achievement = mysqli_real_escape_string($mysqli, $_REQUEST['giveachievement']);
    $level = mysqli_real_escape_string($mysqli, $_REQUEST['givelevel']);
    $employeeid = mysqli_real_escape_string($mysqli, $_REQUEST['employee']);
    addachievement($mysqli, $achievement, $level, $employeeid);
}
if (isset($_REQUEST['btn-endorse'])) {
    $body = $mysqli->real_escape_string($_REQUEST['body']);
    $body = stripslashes(stripslashes(htmlspecialchars_decode(str_replace(array('\\r\\n', '\\r', '\\n'), "", $body))));
    $subject = $mysqli->real_escape_string($_REQUEST['subject']);
    $query = "SELECT * FROM users WHERE userlevel >= {$userlevel} ORDER BY onid ASC";
    $result = $mysqli->query($query);
    //echo $query . '<BR>';
    while ($row = $result->fetch_assoc()) {
        //Send the email/message
        email_message($subject, $row['onid'] . '@oregonstate.edu', $body);
    }
}
if (isset($_REQUEST['btn-test'])) {
    $body = $mysqli->real_escape_string($_REQUEST['body']);
    $body = stripslashes(stripslashes(htmlspecialchars_decode(str_replace(array('\\r\\n', '\\r', '\\n'), "", $body))));
    $subject = $mysqli->real_escape_string($_REQUEST['subject']);
    email_message($subject, $userrow['onid'] . '@oregonstate.edu', $body);
}
?>

<nav class="navbar navbar-inverse navbar-fixed-top">
		<a class="navbar-brand" href="http://www.oregonstate.edu">Oregon State University</a>
		<div style="padding-right:1%;">
<?php 
if (isset($onid)) {
    echo '<div class="navbar-brand pull-right" style="padding-right:1%;"><span class="glyphicon glyphicon-user"></span> <a href="../profile.php">Account (' . $onid . ')</a> - <a href="' . $_SERVER['PHP_SELF'] . '?logout">Logout</a> - <a href="../home.php">Home</a></div>';
} else {
    echo '<a href="' . $_SERVER['PHP_SELF'] . '?login"><button type="button" class="btn btn-default navbar-btn pull-right">Sign in</button></a>';
}
?>
		</div>
</nav>
Example #7
0
function email_daily_suggestion()
{
    global $lang_code, $email_interfaces, $span_interfaces;
    //$my_email = '*****@*****.**';
    $my_email = '*****@*****.**';
    $emails = array();
    $members = array();
    $path = realpath($_SERVER['DOCUMENT_ROOT']) . '/member/';
    $directories = array_filter(glob($path . '*'), 'is_dir');
    foreach ($directories as $directory) {
        if (str_replace($path, '', $directory) != 'login' && str_replace($path, '', $directory) != 'register') {
            $emails[] = str_replace($path, '', $directory);
        }
    }
    $count = count($emails);
    sort($emails);
    for ($m = 0; $m < $count; ++$m) {
        $members[$m] = load_member_from_email($emails[$m]);
    }
    usort($members, 'sort_date_member_ascend');
    for ($i = 0; $i < $count; ++$i) {
        $member_chart = new Chart($members[$i]['dob'], 0, 0, date('Y-m-d'), $members[$i]['dob'], $members[$i]['lang']);
        $heading = '';
        switch ($members[$i]['lang']) {
            case 'vi':
                $heading = 'Biểu đồ nhịp sinh học | Bieu do nhip sinh hoc';
                break;
            case 'en':
                $heading = 'Biorhythm chart';
                break;
            case 'ru':
                $heading = 'Биоритм диаграммы';
                break;
            case 'es':
                $heading = 'Biorritmo carta';
                break;
            case 'zh':
                $heading = '生理节律图';
                break;
            case 'ja':
                $heading = 'バイオリズムチャート';
                break;
        }
        $content = '';
        $content .= has_birthday($members[$i]['dob'], time()) ? '<style>body {background-image: url("http://nhipsinhhoc.vn/css/images/gifts_mobile.png") !important;}</style>' : '';
        $content .= '<h1>' . (has_birthday($members[$i]['dob'], time()) ? $email_interfaces['happy_birthday'][$members[$i]['lang']] : $email_interfaces['hi'][$members[$i]['lang']]) . ' ' . $members[$i]['fullname'] . '</h1>';
        $content .= '<p class="lead">' . $email_interfaces['daily_suggestion'][$members[$i]['lang']] . $email_interfaces['colon'][$members[$i]['lang']] . '</p>';
        $content .= '<p>' . $member_chart->get_infor() . '</p>';
        $content .= '<p>' . $member_chart->get_birthday_countdown() . '</p>';
        $content .= '<p class="lead">' . $email_interfaces['daily_values'][$members[$i]['lang']] . $email_interfaces['colon'][$members[$i]['lang']] . '</p>';
        $content .= '<p>' . $member_chart->get_infor_values() . '</p>';
        $content .= '<p><a href="http://nhipsinhhoc.vn/member/' . $members[$i]['email'] . '/">' . $email_interfaces['go_to_your_profile'][$members[$i]['lang']] . '</a></p>';
        $content .= '<p><a href="https://www.youtube.com/watch?v=' . $email_interfaces['instruction_video_youtube_id'][$members[$i]['lang']] . '">' . $email_interfaces['instruction_video_text'][$members[$i]['lang']] . '</a></p>';
        $content .= '<p>' . $email_interfaces['regards'][$members[$i]['lang']] . '</p>';
        $content .= '<p>' . $span_interfaces['pham_tung'][$members[$i]['lang']] . '</p>';
        $content .= '<p>' . $email_interfaces['keyboard_shortcuts'][$members[$i]['lang']] . '</p>';
        $content .= '<p><em>' . $email_interfaces['definition'][$members[$i]['lang']] . '</em></p>';
        $content .= '<p>' . $span_interfaces['for_reference_only'][$members[$i]['lang']] . '</p>';
        $content .= '<p>' . $email_interfaces['not_mark_as_spam'][$members[$i]['lang']] . '</p>';
        $content .= '<p><a href="mailto:admin@nhipsinhhoc.vn?subject=' . $email_interfaces['unsubscribe'][$members[$i]['lang']] . '&body=' . $email_interfaces['unsubscribe'][$members[$i]['lang']] . ' ' . $members[$i]['email'] . '&cc=tung.42@gmail.com">' . $email_interfaces['unsubscribe'][$members[$i]['lang']] . '</a></p>';
        $message = email_message($heading, $content);
        //send_mail($my_email,$email_interfaces['hi'][$members[$i]['lang']].' '.$members[$i]['fullname'].', '.$email_interfaces['daily_suggestion'][$members[$i]['lang']].' | '.date('Y-m-d'),$message);
        send_mail($members[$i]['email'], $email_interfaces['hi'][$members[$i]['lang']] . ' ' . $members[$i]['fullname'] . ', ' . $email_interfaces['daily_suggestion'][$members[$i]['lang']] . ' | ' . date('Y-m-d'), $message);
        sleep(2);
    }
}
Example #8
0
<?php

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
include_once '../phpfunctions.php';
include_once '../dbconnect.php';
if (isset($_REQUEST['room'])) {
    if ($_REQUEST['room'] != 0) {
        // For all users, currently in room, send email.
        $query = "SELECT clock.*, users.onid, users.firstname, rooms.name FROM `clock` INNER JOIN `users` ON clock.userid = users.id INNER JOIN `rooms` ON rooms.id = clock.roomid WHERE `timeout` = '0000-00-00 00:00:00'";
        $result = $mysqli->query($query);
        //echo $query . '<BR>';
        while ($row = $result->fetch_assoc()) {
            email_message('Test Message', $row['onid'] . '@oregonstate.edu', create_message('../emails/inroom.eml', $row));
        }
        echo '<h1> SUCCESS </h1>';
    }
}