[php]
global $current_user;
get_currentuserinfo();
/* echo ‘Hi ‘ . $current_user->user_login . “! ” . “
“; */

if (!$link = mysql_connect(‘skdb.skrafty.com’, ‘chorerewards’, ‘chorerewardsH3l1v35!’)) {
echo ‘Could not connect to mysql’;
exit;
}

if (!mysql_select_db(‘chorerewards’, $link)) {
echo ‘Could not select database’;
exit;
}

$sql = ‘SELECT chorecode FROM subscribers WHERE playername = “superd767″‘;
$result = mysql_query($sql, $link);

if (!$result) {
echo “DB Error, could not query the database\n”;
echo ‘MySQL Error: ‘ . mysql_error();
exit;
}

while ($row = mysql_fetch_assoc($result)) {
/* echo $row[‘chorecode’]; */

echo “

Today’s Chore Code is
” . $row[‘chorecode’] . “.

“;

}

mysql_free_result($result);
[/php]

[php]/*
global $current_user;
get_currentuserinfo();

echo ‘Username: ‘ . $current_user->user_login . “\n”;
echo ‘User email: ‘ . $current_user->user_email . “\n”;
echo ‘User level: ‘ . $current_user->user_level . “\n”;
echo ‘User first name: ‘ . $current_user->user_firstname . “\n”;
echo ‘User last name: ‘ . $current_user->user_lastname . “\n”;
echo ‘User display name: ‘ . $current_user->display_name . “\n”;
echo ‘User ID: ‘ . $current_user->ID . “\n”;
*/
[/php]
[php]
global $current_user;
get_currentuserinfo();
/* echo ‘Hi ‘ . $current_user->user_login . “! ” . “
“;

*/

if (!$link = mysql_connect(‘mc.skrafty.com’, ‘parentalcontrol’, ‘parentalcontrolH3l1v35!’)) {
echo ‘Could not connect to mysql’;
exit;
}

if (!mysql_select_db(‘parentalcontrol’, $link)) {
echo ‘Could not select database’;
exit;
}

$sql = ‘SELECT dailycode FROM parentalcontrol WHERE playername = “donotremove”‘;
$result = mysql_query($sql, $link);

if (!$result) {
echo “DB Error, could not query the database\n”;
echo ‘MySQL Error: ‘ . mysql_error();
exit;
}

while ($row = mysql_fetch_assoc($result)) {
/* echo $row[‘dailycode’]; */

echo “

Today’s Parental Code is
” . $row[‘dailycode’] . “.

“;

}

mysql_free_result($result);
[/php]

Activate Parental Control For A Student

Grades

[php]
global $user_email;
get_currentuserinfo();
/* echo $display_name . “Email address is: ” . $user_email; */
$email = “$user_email”;
/* echo $email; */

if (!$link = mysql_connect(‘mc.skrafty.com’, ‘desktop’, ‘H3l1v35!’)) {
echo ‘Could not connect to mysql’;
exit;
}

if (!mysql_select_db(‘moodle_enrolment’, $link)) {
echo ‘Could not select database’;
exit;
}

$sql = “SELECT username, firstname FROM enrolment WHERE email = ‘”.$email.”‘ AND shortname = ‘narnia'”;
$result = mysql_query($sql, $link);

if (!$result) {
echo “DB Error, could not query the database\n”;
echo ‘MySQL Error: ‘ . mysql_error();
exit;
}

/* echo “Students Enrolled:”; */
/* echo nl2br (“\n”); */
while ($row = mysql_fetch_assoc($result)) {
$playername = $row[‘username’];
$capsplayername = strtoupper($playername);
/* echo $row[‘username’] . ‘ – ‘ . $row[‘firstname’]; */
/* echo nl2br (“\n”); */
echo ‘[TABLE]’;

/* echo ‘[U]’ . ‘*’ . $playername . ‘[/U]’ . ‘
‘; */

echo ‘[TR]’;
echo ‘[TH]’ . ‘*’ . $capsplayername . ‘[/TH]’ . ‘[TD] [/TD]’ . ‘[TD] [/TD]’;
/* echo ‘[TD]’ . ‘*’ . $capsplayername . ‘[/TD]’ . ‘[TD] [/TD]’ . ‘[TD] [/TD]’;
*/
echo ‘[/TR]’;

echo ‘[TR]’;
echo ‘[TD](Course Short Name)[/TD]’ . ‘[TD](Module)[/TD]’ . ‘[TD](Grade)[/TD]’;
echo ‘[/TR]’;

if (!$mylink = mysql_connect(‘mc.skrafty.com’, ‘desktop’, ‘H3l1v35!’)) {
echo ‘Could not connect to mysql’;
exit;
}
if (!mysql_select_db(‘moodle’, $mylink)) {
echo ‘Could not select database’;
exit;
}

$mysql = “SELECT
u.id AS userid,
u.username AS studentid,
gi.id AS itemid,
c.shortname AS courseshortname,
gi.itemname AS itemname,
gi.grademax AS itemgrademax,
gi.aggregationcoef AS itemaggregation,
g.finalgrade AS finalgrade
FROM mdl_user u
JOIN mdl_grade_grades g ON g.userid = u.id
JOIN mdl_grade_items gi ON g.itemid = gi.id
JOIN mdl_course c ON c.id = gi.courseid
WHERE u.username = ‘”.$playername.”‘ AND g.finalgrade IS NOT NULL”;

$myresult = mysql_query($mysql, $mylink);
/* for all player grade info including blank WHERE u.username = ‘”.$playername.”‘;” */
/* for specific course — WHERE gi.courseid = ‘2’ AND u.username = ‘”.$playername.”‘;”; */

if (!$myresult) {
echo “DB Error, could not query the database\n”;
echo ‘MySQL Error: ‘ . mysql_error();
exit;
}

while ($myrow = mysql_fetch_assoc($myresult)) {
/* echo $myrow[‘playername’] . ‘
‘; */
/* echo $myrow[‘courseshortname’] . ‘-‘ . $myrow[‘itemname’] . ‘–‘ . $myrow[‘finalgrade’] . ‘
‘; */
echo ‘[TR]’;
echo ‘[TD]’ . $myrow[‘courseshortname’] . ‘[/TD]’ . ‘[TD]’ . $myrow[‘itemname’] . ‘[/TD]’ . ‘[TD]’ . $myrow[‘finalgrade’] . ‘[/TD]’;
echo ‘[/TR]’;

/* print_r($myrow); */

}
mysql_result($myresult);

}

mysql_free_result($result);
echo ‘[/TABLE]’;
[/php]

Enrolled Students

[php]
global $user_email;
get_currentuserinfo();
/* echo $display_name . “Email address is: ” . $user_email; */
$email = “$user_email”;
/* echo $email; */
if (!$link = mysql_connect(‘mc.skrafty.com’, ‘desktop’, ‘H3l1v35!’)) {
echo ‘Could not connect to mysql’;
exit;
}
if (!mysql_select_db(‘moodle_enrolment’, $link)) {
echo ‘Could not select database’;
exit;
}
$sql = “SELECT username, firstname FROM enrolment WHERE email = ‘”.$email.”‘ AND shortname = ‘narnia'”;
$result = mysql_query($sql, $link);
if (!$result) {
echo “DB Error, could not query the database\n”;
echo ‘MySQL Error: ‘ . mysql_error();
exit;
}
/*echo “Enrolled Students”;*/
echo ‘[TABLE]’;

while ($row = mysql_fetch_assoc($result)) {
/* echo $row[‘username’] . ‘ – ‘ . $row[‘firstname’];*/
echo ‘[TR]’;
echo ‘[TD]’ . ‘*’ . $row[‘username’] . ‘[/TD]’ . ‘[TD]’ . $row[‘firstname’] . ‘[/TD]’;
echo ‘[/TR]’;
}
mysql_free_result($result);
echo ‘[/TABLE]’;
[/php]

Student Badge Report

[php]
global $user_email;
get_currentuserinfo();
/* echo $display_name . “Email address is: ” . $user_email; */
$email = “$user_email”;
/* echo $email; */

if (!$link = mysql_connect(‘mc.skrafty.com’, ‘desktop’, ‘H3l1v35!’)) {
echo ‘Could not connect to mysql’;
exit;
}

if (!mysql_select_db(‘moodle_enrolment’, $link)) {
echo ‘Could not select database’;
exit;
}

$sql = “SELECT username, firstname FROM enrolment WHERE email = ‘”.$email.”‘ AND shortname = ‘narnia'”;
$result = mysql_query($sql, $link);

if (!$result) {
echo “DB Error, could not query the database\n”;
echo ‘MySQL Error: ‘ . mysql_error();
exit;
}

/* echo “Students Enrolled:”; */
/* echo nl2br (“\n”); */
while ($row = mysql_fetch_assoc($result)) {
$playername = $row[‘username’];
/* echo $row[‘username’] . ‘ – ‘ . $row[‘firstname’]; */
/* echo nl2br (“\n”); */
/* echo “” . $playername . “” . ‘
‘; */
echo ‘[TABLE]’;
echo ‘[TR]’;
echo ‘[TH]’ . ‘*’ . $playername . ‘[/TH]’ . ‘[TD] [/TD]’ . ‘[TD] [/TD]’;
echo ‘[/TR]’;

if (!$mylink = mysql_connect(‘mc.skrafty.com’, ‘desktop’, ‘H3l1v35!’)) {
echo ‘Could not connect to mysql’;
exit;
}
if (!mysql_select_db(‘badgerewards’, $mylink)) {
echo ‘Could not select database’;
exit;
}

$mysql = “SELECT playername,badge,class,badgelink FROM badgerewards WHERE playername = ‘”.$playername.”‘”;
$myresult = mysql_query($mysql, $mylink);

if (!$myresult) {
echo “DB Error, could not query the database\n”;
echo ‘MySQL Error: ‘ . mysql_error();
exit;
}

while ($myrow = mysql_fetch_assoc($myresult)) {
/* echo $myrow[‘playername’] . ‘
‘; */
/* echo $myrow[‘badge’] . ‘—–‘ . $myrow[‘class’] . ‘
‘; */
echo ‘[TR]’;
echo ‘[TD]’ . $myrow[‘badge’] . ‘[/TD]’ . ‘[TD]’ . $myrow[‘class’] . ‘[/TD]’. ‘[TD]’ . $myrow[‘badgelink’] . ‘[/TD]’;
echo ‘[/TR]’;

}
mysql_result($myresult);

}

mysql_free_result($result);
echo ‘[/TABLE]’;
[/php]

CHAT LOG FOR 2 DAYS

[php]
$mydate = strtotime(“-2 days”);

global $user_email;
get_currentuserinfo();
/* echo $display_name . “Email address is: ” . $user_email; */
$email = “$user_email”;
/* echo $email; */

if (!$link = mysql_connect(‘mc.skrafty.com’, ‘desktop’, ‘H3l1v35!’)) {
echo ‘Could not connect to mysql’;
exit;
}

if (!mysql_select_db(‘moodle_enrolment’, $link)) {
echo ‘Could not select database’;
exit;
}

$sql = “SELECT username, firstname FROM enrolment WHERE email = ‘”.$email.”‘ AND shortname = ‘narnia'”;
$result = mysql_query($sql, $link);

if (!$result) {
echo “DB Error, could not query the database\n”;
echo ‘MySQL Error: ‘ . mysql_error();
exit;
}

/* echo “Students Enrolled:”; */
/* echo nl2br (“\n”); */
while ($row = mysql_fetch_assoc($result)) {
$playername = $row[‘username’];
/* echo $row[‘username’] . ‘ – ‘ . $row[‘firstname’]; */
/* echo nl2br (“\n”); */
/* echo “” . $playername . “” . ‘
‘; */
echo ‘[TABLE]’;
echo ‘[TR]’;
echo ‘[TH]’ . ‘*’ . $playername . ‘[/TH]’ . ‘[TD] [/TD]’ . ‘[TD] [/TD]’;
echo ‘[/TR]’;

if (!$mylink = mysql_connect(‘mc.skrafty.com’, ‘desktop’, ‘H3l1v35!’)) {
echo ‘Could not connect to mysql’;
exit;
}
if (!mysql_select_db(‘bungeeweb’, $mylink)) {
echo ‘Could not select database’;
exit;
}

$mysql = “SELECT username,content,time FROM bungeeweb_log WHERE username = ‘”.$playername.”‘ AND bungeeweb_log.time > ‘”.$mydate.”‘ AND bungeeweb_log.type != ‘3’ AND bungeeweb_log.type != ‘6’ LIMIT 100″;
$myresult = mysql_query($mysql, $mylink);

if (!$myresult) {
echo “DB Error, could not query the database\n”;
echo ‘MySQL Error: ‘ . mysql_error();
exit;
}

while ($myrow = mysql_fetch_assoc($myresult)) {
/* echo $myrow[‘playername’] . ‘
‘; */
/* echo $myrow[‘badge’] . ‘—–‘ . $myrow[‘class’] . ‘
‘; */
echo ‘[TR]’;
echo ‘[TD]’ . $myrow[‘username’] . ‘[/TD]’ . ‘[TD]’ . $myrow[‘content’] . ‘[/TD]’. ‘[TD]’ . ‘ ‘ . ‘[/TD]’;
echo ‘[/TR]’;

}
mysql_result($myresult);

}

mysql_free_result($result);
echo ‘[/TABLE]’;
[/php]