Config.php
<?php
$host = "localhost";
$username = "root";
$password = "";
$databasename = "dbmoodle";
$connection = mysql_connect($host, $username, $password) or die("Kesalahan Koneksi … !!");
mysql_select_db($databasename, $connection) or die("Databasenya Error");
?>
Berita.php
<?php?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>BERITA</title>
<description></description>
<language>id</language>
<managingEditor>Mobile Learning</managingEditor>
<copyright>Copyright 2011 Mobile Learning</copyright>
<?php
include "config.php";
$query = "SELECT subject, message from mdl_forum_posts ";
$run = mysql_query($query);
while($b=mysql_fetch_array($run)){
?>
<item>
<title><?php echo "$b[subject]"; ?></title>
<description><?php echo "$b[message]"; ?></description>
</item>
<?php } ?>
</channel>
</rss>
<?php mysql_close(); ?>
Course.php
<?php ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>COURSE YANG DI AMBIL</title>
<link>http://m-learning.com/</link>
<description></description>
<language>id</language>
<managingEditor>Mobile Learning</managingEditor>
<copyright>Copyright 2011 Mobile Learning</copyright>
<?php
include "config.php";
$query = "SELECT a.course, b.fullname, b.id, c.username, a.userid from mdl_course_display
as a inner join mdl_course as b on b.id=a.course inner join mdl_user as c on c.id=a.userid and c.username='".$_GET['uname']."' ";
$run = mysql_query($query);
while($b=mysql_fetch_array($run)){
?>
<item>
<title><?php echo "$b[fullname]"; ?></title>
<pubDate><?php echo "$b[userid]"; ?></pubDate>
<link><?php echo "$b[id]"; ?></link>
<description><?php echo "$b[username]"; ?></description>
</item>
<?php } ?>
</channel>
</rss>
<?php mysql_close(); ?>
courseDetailTopikJson.php
<?php
include "config.php";
$idc= $_REQUEST['idc'];
$un= $_REQUEST['un'];
if($idc && $un){
$sqlString = "SELECT a.course, b.fullname, b.id, c.username, a.userid, d.id, d.name, d.type, d.alltext, d.reference from mdl_course_display
as a inner join mdl_course as b on b.id=a.course inner join mdl_user as c on c.id=a.userid
inner join mdl_resource as d on d.course=a.course and d.type='text' and b.id='".$_GET['idc']."' and d.id='".$_GET['idr']."' and a.userid='".$_GET['un']."'";
}else{
$sqlString = "SELECT a.course, b.fullname, b.id, c.username, a.userid, d.name, d.type, d.alltext, d.reference from mdl_course_display
as a inner join mdl_course as b on b.id=a.course inner join mdl_user as c on c.id=a.userid
inner join mdl_resource as d on d.course=a.course and d.type='text'";
}
$rs = mysql_query($sqlString);
if($rs){
while($objRs = mysql_fetch_assoc($rs)){
$output[] = $objRs;
}
echo json_encode($output);
}
mysql_close();
?>
courseTopik.php
<?php ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>TOPIK COURSE</title>
<link>http://m-learning.com/</link>
<description>Silahkan Klik Topik yang Ada</description>
<language>id</language>
<managingEditor>Mobile Learning</managingEditor>
<copyright>Copyright 2011 Mobile Learning</copyright>
<?php
include "config.php";
$query = "SELECT a.course, b.fullname, c.username, a.userid, d.id, d.name, d.type, d.alltext, d.reference from mdl_course_display
as a inner join mdl_course as b on b.id=a.course inner join mdl_user as c on c.id=a.userid
inner join mdl_resource as d on d.course=a.course and d.type='text' and b.id='".$_GET['idc']."' and c.id='".$_GET['idu']."' ";
$run = mysql_query($query);
while($b=mysql_fetch_array($run)){
?>
<item>
<title><?php echo "$b[name]"; ?></title>
<pubDate><?php echo "$b[course]"; ?></pubDate>
<link><?php echo "$b[id]"; ?></link>
<category><?php echo "$b[alltex]"; ?></category>
<description><?php echo "$b[userid]"; ?></description>
</item>
<?php } ?>
</channel>
</rss>
<?php mysql_close(); ?>
downloadFile.php
<?php ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>DOWNLOAD FILE</title>
<link>http://m-learning.com/</link>
<description>Silahkan Klik Untuk Menuju Lnk Download</description>
<language>id</language>
<managingEditor>Mobile Learning</managingEditor>
<copyright>Copyright 2011 Mobile Learning</copyright>
<?php
include "config.php";
$query = "SELECT a.course, b.fullname, b.id, c.username, a.userid, d.name, d.type, d.alltext, d.reference from mdl_course_display
as a inner join mdl_course as b on b.id=a.course inner join mdl_user as c on c.id=a.userid
inner join mdl_resource as d on d.course=a.course and d.type='file' and b.id='".$_GET['idc']."' and c.id='".$_GET['idu']."' ";
$run = mysql_query($query);
while($b=mysql_fetch_array($run)){
?>
<item>
<title><?php echo "$b[name]"; ?></title>
<link><?php echo "$b[id]"; ?></link>
<description><?php echo "$b[reference]"; ?></description>
</item>
<?php } ?>
</channel>
</rss>
<?php mysql_close(); ?>
Login.php
<?php
include "config.php";
$username = $_REQUEST['username'];
$password = $_REQUEST['password'];
$passwordhash = md5($password);
// query untuk mendapatkan record dari username
$query = "SELECT * from mdl_user where username = '$username' and password = '$passwordhash' ";
$numRow = mysql_num_rows(mysql_query($query));
// cek kesesuaian password
if ($numRow >= 1)
echo 1;
else
echo 0;
?>
Nilai.php
<?php ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>NILAI TUGAS</title>
<link>http://m-learning.com/</link>
<description>Silahkan Klik Untuk Melihat Nilai Tugas yang Ada</description>
<language>id</language>
<managingEditor>Mobile Learning</managingEditor>
<copyright>Copyright 2011 Mobile Learning</copyright>
<?php
include "config.php";
$query = "select c.id, c.fullname,a.userid, d.username, b.name, a.id, a.assignment,a.grade from mdl_assignment_submissions as a
inner join mdl_assignment as b on b.id=a.assignment inner join mdl_course as c on c.id=b.course
inner join mdl_user as d on d.id=a.userid and c.id='".$_GET['idc']."' and a.userid='".$_GET['idu']."'";
$run = mysql_query($query);
while($b=mysql_fetch_array($run)){
?>
<item>
<title><?php echo "$b[name]"; ?></title>
<pubDate><?php echo "$b[id]"; ?></pubDate>
<link><?php echo "$b[userid]"; ?></link>
<description><?php echo "$b[assignment]"; ?></description>
</item>
<?php } ?>
</channel>
</rss>
<?php mysql_close(); ?>
nilaiDetailJson.php
<?php
include "config.php";
$idu= $_REQUEST['idu'];
$ida= $_REQUEST['ida'];
if($idu && $ida){
$sqlString = "SELECT a.course,b.fullname, c.username, a.userid, d.id, d.name, e.id, e.assignment, e.grade FROM `mdl_course_display` as a inner
join mdl_course as b on b.id=a.course inner join mdl_user as c on c.id=a.userid inner join mdl_assignment as d on
d.course=a.course inner join mdl_assignment_submissions as e on e.assignment=d.id
and a.userid='".$_GET['idu']."'
and e.assignment='".$_GET['ida']."'
and e.id='".$_GET['idsub']."'";
}else{
$sqlString = "SELECT a.course,b.fullname, c.username, a.userid, d.id, d.name, e.id, e.assignment, e.grade FROM `mdl_course_display` as a inner
join mdl_course as b on b.id=a.course inner join mdl_user as c on c.id=a.userid inner join mdl_assignment as d on
d.course=a.course inner join mdl_assignment_submissions as e on e.assignment=d.id";
}
$rs = mysql_query($sqlString);
if($rs){
while($objRs = mysql_fetch_assoc($rs)){
$output[] = $objRs;
}
echo json_encode($output);
}
mysql_close();
?>
Tugas.php
<?php?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>TUGAS</title>
<link>http://m-learning/</link>
<description>Silahkan Klik Tugas yang Ada</description>
<language>id</language>
<managingEditor>Mobile Learning</managingEditor>
<copyright>Copyright 2011 Mobile Learning</copyright>
<?php
include "config.php";
$query = "SELECT a.course,b.fullname, c.username, a.userid, d.id, d.name, d.description FROM `mdl_course_display` as a inner
join mdl_course as b on b.id=a.course inner join mdl_user as c on c.id=a.userid inner join mdl_assignment as d on
d.course=a.course and b.id='".$_GET['idc']."' and c.id='".$_GET['idu']."'";
$run = mysql_query($query);
while($b=mysql_fetch_array($run)){
?>
<item>
<title><?php echo "$b[name]"; ?></title>
<pubDate><?php echo "$b[course]"; ?></pubDate>
<link><?php echo "$b[id]"; ?></link>
<description><?php echo "$b[userid]"; ?></description>
</item>
<?php } ?>
</channel>
</rss>
<?php mysql_close(); ?>
tugasDetailJson.php
<?php
include "config.php";
$idc= $_REQUEST['idc'];
$idu= $_REQUEST['idu'];
if($idc && $idu){
$sqlString = "SELECT a.course, b.fullname, b.id, c.username, a.userid, d.id, d.name, d.description from mdl_course_display
as a inner join mdl_course as b on b.id=a.course inner join mdl_user as c on c.id=a.userid
inner join mdl_assignment d on d.course=a.course and b.id='".$_GET['idc']."' and d.id='".$_GET['ida']."' and a.userid='".$_GET['idu']."'";
}else{
$sqlString = "SELECT a.course, b.fullname, b.id, c.username, a.userid, d.id, d.name, d.type, d.description from mdl_course_display
as a inner join mdl_course as b on b.id=a.course inner join mdl_user as c on c.id=a.userid
inner join mdl_assignment d on d.course=a.course";
}
$rs = mysql_query($sqlString);
if($rs){
while($objRs = mysql_fetch_assoc($rs)){
$output[] = $objRs;
}
echo json_encode($output);
}
mysql_close();
?>
tugasKirimTeks.php
<?php

Tidak ada komentar:
Posting Komentar