From 4de2151306cee8ad7983f201a74d15a44d2b06b7 Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Wed, 9 Jan 2013 16:54:12 -0800 Subject: Challenges, massEmail functions started --- pages/challengelist.php | 66 ++++++++++++--- pages/massemail.php | 209 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 263 insertions(+), 12 deletions(-) create mode 100644 pages/massemail.php (limited to 'pages') diff --git a/pages/challengelist.php b/pages/challengelist.php index eb9993d..556c190 100644 --- a/pages/challengelist.php +++ b/pages/challengelist.php @@ -14,8 +14,8 @@ topbar($Links); ?> -
- +
+t @@ -53,6 +54,45 @@ htmlFooter(); ?> $map) { + echo "TIER $tier"; + foreach ($map as $mapid => $challenge) { + echo "MAP $mapid"; + + $mapCode = getMapCode($mapid); + $map = new map($mapCode); + $thumbnail = DisplayMapThumbnail($map); + + echo "
"; + echo "$map->name"; + echo $thumbnail; + + foreach ($challenge as $challengeID => $content) { + //Each challenge gets its own star + if($content["dateSolved"] !== NULL) + $cssClass = "challengelist_complete"; + else + $cssClass = "challengelist_incomplete"; + echo "
"; + } + echo "
"; + echo "END MAP"; + } + echo "END TIER"; + } +} + +// TODO: !! Depreciate /** * Outputs the list of all challenges to the page */ @@ -72,11 +112,11 @@ function displayChallengeList($challengeListResultset) { if($currentTier >= 0) { - echo 'EndTier'; + echo '
'; } $currentTier = $challenge["challengeTier"]; echo "
Tier $currentTier
"; - echo "\n"; + echo "
\n"; } //Each map gets it own row @@ -84,7 +124,7 @@ function displayChallengeList($challengeListResultset) { if($currentMap >= 0) { - echo ''; + echo '
'; } $currentMap = $challenge["mapID"]; @@ -96,12 +136,14 @@ function displayChallengeList($challengeListResultset) if($mapName == NULL || $mapName == "") $mapName = "(unknown)"; - echo " - "; - echo "
"; + $thumbnail + + "; + echo "
"; } //Each challenge gets its own star @@ -111,7 +153,7 @@ function displayChallengeList($challengeListResultset) $cssClass = "challengelist_incomplete"; echo "
"; } - echo "
"; + echo "
"; echo ""; } ?> \ No newline at end of file diff --git a/pages/massemail.php b/pages/massemail.php new file mode 100644 index 0000000..a861500 --- /dev/null +++ b/pages/massemail.php @@ -0,0 +1,209 @@ + + +Thank you for your feedback!
+ I'm Reading this right now.
+ Well, obviously I'm not reading it right NOW.
+ I guess what I meant to say is that I'll be reading it soon.
+ Wow this redirect is taking a while.. Sorry
+ Are you still here?
+ Something must be wrong, you should really have been redirected by now", $mydomain, 5); + exit; +} + + +include('./includes/sqli.php'); + +$res = mysqli_query($mysqli, "SELECT count(*) as _msg FROM `users`"); +$row = mysqli_fetch_assoc($res); +echo $row['_msg']; + +exit; + +function QueueEmail($unsanitizeduserID, $unsanitizedto, $unsanitizedSubject, $unsanitizedBody) { + + //Check if there's something in the queue already: + $sql = "SELECT `userID` FROM emailQueue WHERE '$userID' = "; + +} + +//new table +// emailQueue ID, userID, sent, to, subject, body, dateSubmited, dateSent + +$sql = "SELECT `ID`, `displayName`, `dateJoined`, `dateLogin`, `email`, `isAdmin` FROM `users`"; +$result = mysql_query($sql); + +echo " +
+
+

MASS EMAIL

+
+"; + + +?> + +
+ +

+ +Title:
+
+ Please email me back +

+ +
+ + +

EXAMPLE SET

+ + + +IDDisplay name:Joined On:Last LogonEmailAdministrator + +"; + +while (list($CUID, $CUsername, $Joined, $LastLogon, $email, $isAdmin) = mysql_fetch_row($result)) { + + //$Joined = Date("d/m/y - g:ia", $Joined); + $Joined = strtotime($Joined); + //$Joined = relative_date($Joined); + $Joined = date("Y-m-d", $Joined); + + $LastLogon = strtotime($LastLogon); + //$LastLogon = relative_date($LastLogon); + $LastLogon = date("Y-m-d", $LastLogon); + + if ($isAdmin == 1) + $isAdmin = "Yes"; + else + $isAdmin = "No"; + + + Echo " +$CUID +$CUsername +$Joined +$LastLogon +$email +$isAdmin +"; + +} + +Echo " + +
+
+ + + + +
+"; + + +function SendEmail($body, $subject = "Pathery Newsletter", $to = 'snapwilliam@gmail.com') { + // !! TODO + $to = 'snapwilliam@gmail.com'; + $mycompany = "Pathery"; + + $fromemail = "snap@pathery.com"; + $replyemail = "snap@pathery.com"; + + # -=-=-=- MIME BOUNDARY + $mime_boundary = "----$mycompany----".md5(time()); + # -=-=-=- MAIL HEADERS + $headers = "From: $mycompany <$fromemail>\n"; + $headers .= "Reply-To: $mycompany <$replyemail>\n"; + $headers .= "MIME-Version: 1.0\n"; + $headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n"; + + # -=-=-=- TEXT EMAIL PART + $message = "--$mime_boundary\n"; + $message .= "Content-Type: text/plain; charset=UTF-8\n"; + $message .= "Content-Transfer-Encoding: 8bit\n\n"; + + $message .= $body; + + # -=-=-=- HTML EMAIL PART + //None + # -=-=-=- FINAL BOUNDARY + $message .= "--$mime_boundary--\n\n"; + # -=-=-=- SEND MAIL + $mail_sent = @mail( $to, $subject, $message, $headers ); + Return $mail_sent; +} + + + +//Thank you: +//http://snippets.dzone.com/posts/show/196 +function relative_date($time) { + $today = strtotime(date('M j, Y')); + $reldays = ($time - $today)/86400; + if ($reldays >= 0 && $reldays < 1) { + return 'Today'; + } else if ($reldays >= 1 && $reldays < 2) { + return 'Tomorrow'; + } else if ($reldays >= -1 && $reldays < 0) { + return 'Yesterday'; + } + if (abs($reldays) < 7) { + if ($reldays > 0) { + $reldays = floor($reldays); + return 'in ' . $reldays . ' day' . ($reldays != 1 ? 's' : ''); + } else { + $reldays = abs(floor($reldays)); + return $reldays . ' day' . ($reldays != 1 ? 's' : '') . ' ago'; + } + } + if (abs($reldays) < 182) { + return date('l, F j',$time ? $time : time()); + } else { + return date('l, F j, Y',$time ? $time : time()); + } +} + +htmlFooter(); +?> \ No newline at end of file -- cgit v1.2.3