Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $result = mysql_query("SELECT username, due, name, course, emailbefore FROM assignments");
- while ($row = mysql_fetch_array($result)) {
- if ($row['emailbefore'] != "false") {
- if ($row['emailbefore'] == "1d") {
- if (date('F j Y', $row['due']) <= date('F j Y', time()+(60*60*24))) {
- $aresult = mysql_query("SELECT email FROM users WHERE username='$row['username']'");
- $arow = mysql_fetch_array($aresult);
- $to = $arow['email'];
- $subject = "Your Assignment Due Notice";
- $message = "This is a notice for your Johtaja account. You asked us to send you an email about an assignment, so here it is. Information about the assignment:\n" .
- "Name: $row['name']\n" .
- "Due Date: $row['due']\n" .
- "Course: $row['course']\n" .
- "If you feel that this is a mistake, please reply to this email.";
- $headers = "From: Support@Johtaja.co.tv";
- mail($to,$subject,$message,$headers);
- }
- }
- elseif ($row['emailbefore'] == "2d") {
- if (date('F j Y', $row['due']) <= date('F j Y', time()+(60*60*24*2))) {
- $aresult = mysql_query("SELECT email FROM users WHERE username='$row['username']'");
- $arow = mysql_fetch_array($aresult);
- $to = $arow['email'];
- $subject = "Your Assignment Due Notice";
- $message = "This is a notice for your Johtaja account. You asked us to send you an email about an assignment, so here it is. Information about the assignment:\n" .
- "Name: $row['name']\n" .
- "Due Date: $row['due']\n" .
- "Course: $row['course']\n" .
- "If you feel that this is a mistake, please reply to this email.";
- $headers = "From: Support@Johtaja.co.tv";
- mail($to,$subject,$message,$headers);
- }
- }
- elseif ($row['emailbefore'] == "3d") {
- if (date('F j Y', $row['due']) <= date('F j Y', time()+(60*60*24*3))) {
- $aresult = mysql_query("SELECT email FROM users WHERE username='$row['username']'");
- $arow = mysql_fetch_array($aresult);
- $to = $arow['email'];
- $subject = "Your Assignment Due Notice";
- $message = "This is a notice for your Johtaja account. You asked us to send you an email about an assignment, so here it is. Information about the assignment:\n" .
- "Name: $row['name']\n" .
- "Due Date: $row['due']\n" .
- "Course: $row['course']\n" .
- "If you feel that this is a mistake, please reply to this email.";
- $headers = "From: Support@Johtaja.co.tv";
- mail($to,$subject,$message,$headers);
- }
- }
- elseif ($row['emailbefore'] == "4d") {
- if (date('F j Y', $row['due']) <= date('F j Y', time()+(60*60*24*4))) {
- $aresult = mysql_query("SELECT email FROM users WHERE username='$row['username']'");
- $arow = mysql_fetch_array($aresult);
- $to = $arow['email'];
- $subject = "Your Assignment Due Notice";
- $message = "This is a notice for your Johtaja account. You asked us to send you an email about an assignment, so here it is. Information about the assignment:\n" .
- "Name: $row['name']\n" .
- "Due Date: $row['due']\n" .
- "Course: $row['course']\n" .
- "If you feel that this is a mistake, please reply to this email.";
- $headers = "From: Support@Johtaja.co.tv";
- mail($to,$subject,$message,$headers);
- }
- }
- elseif ($row['emailbefore'] == "5d") {
- if (date('F j Y', $row['due']) <= date('F j Y', time()+(60*60*24*5))) {
- $aresult = mysql_query("SELECT email FROM users WHERE username='$row['username']'");
- $arow = mysql_fetch_array($aresult);
- $to = $arow['email'];
- $subject = "Your Assignment Due Notice";
- $message = "This is a notice for your Johtaja account. You asked us to send you an email about an assignment, so here it is. Information about the assignment:\n" .
- "Name: $row['name']\n" .
- "Due Date: $row['due']\n" .
- "Course: $row['course']\n" .
- "If you feel that this is a mistake, please reply to this email.";
- $headers = "From: Support@Johtaja.co.tv";
- mail($to,$subject,$message,$headers);
- }
- }
- elseif ($row['emailbefore'] == "6d") {
- if (date('F j Y', $row['due']) <= date('F j Y', time()+(60*60*24*6))) {
- $aresult = mysql_query("SELECT email FROM users WHERE username='$row['username']'");
- $arow = mysql_fetch_array($aresult);
- $to = $arow['email'];
- $subject = "Your Assignment Due Notice";
- $message = "This is a notice for your Johtaja account. You asked us to send you an email about an assignment, so here it is. Information about the assignment:\n" .
- "Name: $row['name']\n" .
- "Due Date: $row['due']\n" .
- "Course: $row['course']\n" .
- "If you feel that this is a mistake, please reply to this email.";
- $headers = "From: Support@Johtaja.co.tv";
- mail($to,$subject,$message,$headers);
- }
- }
- elseif ($row['emailbefore'] == "1w") {
- if (date('F j Y', $row['due']) <= date('F j Y', time()+(60*60*24*7))) {
- $aresult = mysql_query("SELECT email FROM users WHERE username='$row['username']'");
- $arow = mysql_fetch_array($aresult);
- $to = $arow['email'];
- $subject = "Your Assignment Due Notice";
- $message = "This is a notice for your Johtaja account. You asked us to send you an email about an assignment, so here it is. Information about the assignment:\n" .
- "Name: $row['name']\n" .
- "Due Date: $row['due']\n" .
- "Course: $row['course']\n" .
- "If you feel that this is a mistake, please reply to this email.";
- $headers = "From: Support@Johtaja.co.tv";
- mail($to,$subject,$message,$headers);
- }
- }
- elseif ($row['emailbefore'] == "2w") {
- if (date('F j Y', $row['due']) <= date('F j Y', time()+(60*60*24*14))) {
- $aresult = mysql_query("SELECT email FROM users WHERE username='$row['username']'");
- $arow = mysql_fetch_array($aresult);
- $to = $arow['email'];
- $subject = "Your Assignment Due Notice";
- $message = "This is a notice for your Johtaja account. You asked us to send you an email about an assignment, so here it is. Information about the assignment:\n" .
- "Name: $row['name']\n" .
- "Due Date: $row['due']\n" .
- "Course: $row['course']\n" .
- "If you feel that this is a mistake, please reply to this email.";
- $headers = "From: Support@Johtaja.co.tv";
- mail($to,$subject,$message,$headers);
- }
- }
- elseif ($row['emailbefore'] == "3w") {
- if (date('F j Y', $row['due']) <= date('F j Y', time()+(60*60*24*21))) {
- $aresult = mysql_query("SELECT email FROM users WHERE username='$row['username']'");
- $arow = mysql_fetch_array($aresult);
- $to = $arow['email'];
- $subject = "Your Assignment Due Notice";
- $message = "This is a notice for your Johtaja account. You asked us to send you an email about an assignment, so here it is. Information about the assignment:\n" .
- "Name: $row['name']\n" .
- "Due Date: $row['due']\n" .
- "Course: $row['course']\n" .
- "If you feel that this is a mistake, please reply to this email.";
- $headers = "From: Support@Johtaja.co.tv";
- mail($to,$subject,$message,$headers);
- }
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement