function getUserIDcomment($usernam, $passwor) { global $yol1; $usernam = substr(temizle2($usernam), 0, 15); $sql1 = "SELECT id, userName, userPassword FROM eo_users where userName='******' AND userPassword='******' limit 0,1"; $result1 = mysql_query($sql1, $yol1); if ($result1 && mysql_numrows($result1) == 1) { return mysql_result($result1, 0, "id"); } else { return ""; } }
$metin = str_replace("<", "‹", $metin); $metin = str_replace(">", "›", $metin); $metin = trim(htmlentities($metin)); return $metin; } /* cevapKontrol: sayfanýn cevabýnýn kontrol edilmesi */ function cevapKontrol($cevap, $id) { global $yol1; global $metin; $cevap = iconv("UTF-8", "ISO-8859-9", $cevap); $sql1 = "SELECT id FROM eo_5sayfa where UPPER(cevap)=UPPER('{$cevap}') and id='{$id}' limit 0,1"; $result1 = mysql_query($sql1, $yol1); if ($result1 && mysql_numrows($result1) == 1) { $sonuc = "<span><img src='img/tick_circle.png' border='0' style=\"vertical-align: middle;\" alt=\"ok\" /> {$metin['348']}</span>"; $_SESSION["cevaplar"][$id] = "D"; return $sonuc; } else { return "<p><img src='img/error.png' border='0' style=\"vertical-align: middle;\" alt=\"error\" /> {$metin['349']}</p>"; } } /*main*/ if (isset($_POST['cevap']) && isset($_POST['id'])) { echo iconv("ISO-8859-9", "UTF-8", cevapKontrol(temizle2($_POST['cevap']), temizle2($_POST['id']))); die; } else { echo ""; }
function oyOrtalama($konuID) { global $yol1; $sql1 = "SELECT avg(value) as Ort FROM eo_rating where konuID='" . temizle2($konuID) . "'"; $result1 = mysql_query($sql1, $yol1); if ($result1 && mysql_numrows($result1) == 1) { return mysql_result($result1, 0, "Ort"); } return 0; }
function dersCalismaOrtRank($id, $grafikli, $sadeYuzde = false) { global $yol1; $id = substr(temizle2($id), 0, 15); $sql1 = "SELECT userID , avg(lastPage) as say \r\n\t\tFROM eo_userworks\r\n\t\twhere userID>0 \r\n\t\tgroup by userID\r\n\t\torder by say DESC, userID"; $result1 = mysql_query($sql1, $yol1); if ($result1) { $rank = 0; for ($i = 0; $i < @mysql_numrows($result1); $i++) { $rank = $i + 1; if (mysql_result($result1, $i, "userID") == $id) { break; } } if ($grafikli) { rankGrafik(@mysql_numrows($result1) - $rank, @mysql_numrows($result1)); } if ($sadeYuzde and @mysql_numrows($result1) > 0) { return 100 - round($rank * 100 / @mysql_numrows($result1)); } return $rank . "/" . @mysql_numrows($result1); } else { return 0; } return 0; }
function konuKisitlamalari($id) { global $yol1; global $metin; $id = substr(temizle2($id), 0, 15); $sql1 = "SELECT DATE_FORMAT(bitisTarihi,'%d-%m-%Y') as bitisTarihi , oncekiKonuID, konuyuKilitle, calismaSuresiDakika, \r\n\t\t\tcalismaHakSayisi, sadeceKayitlilarGorebilir, sinifaDahilKullaniciGorebilir \r\n\t\t\tfrom eo_4konu \r\n\t where id={$id} "; $result1 = mysql_query($sql1, $yol1); if ($result1 && mysql_numrows($result1) == 1) { $sonuc = ""; if (mysql_result($result1, 0, "konuyuKilitle") > 0) { $sonuc .= "<br/> <img src='img/lock.png' border=\"0\" style=\"vertical-align: middle;\" alt='" . $metin[179] . "' title='" . $metin[179] . "' /> {$metin['179']} "; } if (mysql_result($result1, 0, "sadeceKayitlilarGorebilir") > 0) { $sonuc .= "<br/> <img src='img/user_manager.gif' border=\"0\" style=\"vertical-align: middle;\" alt='" . $metin[181] . "' title='" . $metin[181] . "' /> {$metin['181']} "; } if (mysql_result($result1, 0, "calismaSuresiDakika") > 0) { $sonuc .= "<br/> <img src='img/history.png' border=\"0\" style=\"vertical-align: middle;\" alt=\"" . $metin[169] . "\" title=\"" . $metin[169] . "\" /> {$metin['169']} : " . mysql_result($result1, 0, "calismaSuresiDakika") . " {$metin['171']}"; } if (mysql_result($result1, 0, "bitisTarihi") != "00-00-0000") { $sonuc .= "<br/> {$metin['330']} : " . mysql_result($result1, 0, "bitisTarihi"); } if (mysql_result($result1, 0, "oncekiKonuID") > 0) { $sqlici = "SELECT eo_4konu.konuAdi FROM eo_4konu\r\n\t\t\t\t\t\t\tWHERE eo_4konu.id = " . mysql_result($result1, 0, "oncekiKonuID"); $resultici = mysql_query($sqlici, $yol1); if ($resultici) { if (@mysql_numrows($resultici) == 1) { $sonuc .= "<br/> {$metin['166']} : <a href='lessons.php?konu=" . mysql_result($result1, 0, "oncekiKonuID") . "'>" . mysql_result($resultici, 0, "konuAdi") . "</a> "; } } } if (mysql_result($result1, 0, "calismaHakSayisi") > 0) { $sonuc .= "<br/> {$metin['325']} : " . mysql_result($result1, 0, "calismaHakSayisi"); } if (mysql_result($result1, 0, "sinifaDahilKullaniciGorebilir") > 0) { $sonuc .= "<br/> {$metin['326']}"; } return $sonuc; } else { return ""; } }
function secenekleriGetir($id) { global $yol1; global $metin; if (@array_key_exists($id, $_SESSION["cevaplar"])) { if ($_SESSION["cevaplar"][$id] == "D") { return "Zaten Cevap Verdiniz."; } } $sql1 = "SELECT id, secenek1, secenek2, secenek3, secenek4, secenek5, secenek6, cevap FROM eo_5sayfa where id='{$id}' limit 0,1"; $result1 = mysql_query($sql1, $yol1); if ($result1 && mysql_numrows($result1) == 1) { $cevap = temizle2(mysql_result($result1, 0, "cevap")); $secenek1 = temizle2(mysql_result($result1, 0, "secenek1")); $secenek2 = temizle2(mysql_result($result1, 0, "secenek2")); $secenek3 = temizle2(mysql_result($result1, 0, "secenek3")); $secenek4 = temizle2(mysql_result($result1, 0, "secenek4")); $secenek5 = temizle2(mysql_result($result1, 0, "secenek5")); $secenek6 = temizle2(mysql_result($result1, 0, "secenek6")); $sonuc = ""; if ($cevap != "" && $secenek1 == "" && $secenek2 == "" && $secenek3 == "" && $secenek4 == "" && $secenek5 == "" && $secenek6 == "") { //KLASÝK soru türü $sonuc = "<input type='text' size='20' maxlength='20' id='tekCevap' name='tekCevap' value='' onkeypress=' \r\n\t\t var evt = (evt) ? evt : ((event) ? event : null); \r\n\t\t var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);\r\n\t\t \tif (evt.keyCode == 13) cevapDegerlendir(document.getElementById(\"tekCevap\").value,{$id}); '/><br/><br/>"; $sonuc .= "<input type='button' value='{$metin['351']}' onclick='cevapDegerlendir(document.getElementById(\"tekCevap\").value,{$id});' />"; } else { if (strlen($cevap) == 1) { //TEK SEÇENEK doðru - TEST $toplamCevapAdedi = !empty($secenek1) + !empty($secenek2) + !empty($secenek3) + !empty($secenek4) + !empty($secenek5) + !empty($secenek6); $araCevDizi = preg_split('$[/]$', rasgeleCevapHazirla($toplamCevapAdedi)); if (isset($araCevDizi[0])) { switch ($araCevDizi[0]) { case 1: $sor_a = "a"; $sor_a_met = $secenek1; break; case 2: $sor_a = "b"; $sor_a_met = $secenek2; break; case 3: $sor_a = "c"; $sor_a_met = $secenek3; break; case 4: $sor_a = "d"; $sor_a_met = $secenek4; break; case 5: $sor_a = "e"; $sor_a_met = $secenek5; break; case 6: $sor_a = "f"; $sor_a_met = $secenek6; break; default: $sor_a = "a"; $sor_a_met = $secenek1; } } if (isset($araCevDizi[1])) { switch ($araCevDizi[1]) { case 1: $sor_b = "a"; $sor_b_met = $secenek1; break; case 2: $sor_b = "b"; $sor_b_met = $secenek2; break; case 3: $sor_b = "c"; $sor_b_met = $secenek3; break; case 4: $sor_b = "d"; $sor_b_met = $secenek4; break; case 5: $sor_b = "e"; $sor_b_met = $secenek5; break; case 6: $sor_b = "f"; $sor_b_met = $secenek6; break; default: $sor_b = "b"; $sor_b_met = $secenek2; } } if (isset($araCevDizi[2])) { switch ($araCevDizi[2]) { case 1: $sor_c = "a"; $sor_c_met = $secenek1; break; case 2: $sor_c = "b"; $sor_c_met = $secenek2; break; case 3: $sor_c = "c"; $sor_c_met = $secenek3; break; case 4: $sor_c = "d"; $sor_c_met = $secenek4; break; case 5: $sor_c = "e"; $sor_c_met = $secenek5; break; case 6: $sor_c = "f"; $sor_c_met = $secenek6; break; default: $sor_c = "c"; $sor_c_met = $secenek3; } } if (isset($araCevDizi[3])) { switch ($araCevDizi[3]) { case 1: $sor_d = "a"; $sor_d_met = $secenek1; break; case 2: $sor_d = "b"; $sor_d_met = $secenek2; break; case 3: $sor_d = "c"; $sor_d_met = $secenek3; break; case 4: $sor_d = "d"; $sor_d_met = $secenek4; break; case 5: $sor_d = "e"; $sor_d_met = $secenek5; break; case 6: $sor_d = "f"; $sor_d_met = $secenek6; break; default: $sor_d = "d"; $sor_d_met = $secenek4; } } if (isset($araCevDizi[4])) { switch ($araCevDizi[4]) { case 1: $sor_e = "a"; $sor_e_met = $secenek1; break; case 2: $sor_e = "b"; $sor_e_met = $secenek2; break; case 3: $sor_e = "c"; $sor_e_met = $secenek3; break; case 4: $sor_e = "d"; $sor_e_met = $secenek4; break; case 5: $sor_e = "e"; $sor_e_met = $secenek5; break; case 6: $sor_e = "f"; $sor_e_met = $secenek6; break; default: $sor_e = "e"; $sor_e_met = $secenek5; } } if (isset($araCevDizi[5])) { switch ($araCevDizi[5]) { case 1: $sor_f = "a"; $sor_f_met = $secenek1; break; case 2: $sor_f = "b"; $sor_f_met = $secenek2; break; case 3: $sor_f = "c"; $sor_f_met = $secenek3; break; case 4: $sor_f = "d"; $sor_f_met = $secenek4; break; case 5: $sor_f = "e"; $sor_f_met = $secenek5; break; case 6: $sor_f = "f"; $sor_f_met = $secenek6; break; default: $sor_f = "e"; $sor_f_met = $secenek6; } } if ($secenek1 != "") { $sonuc .= "<input type='radio' value='A' name='cevap' class='cevap' style='width:35px;' onclick='cevapDegerlendir(\"{$sor_a}\",{$id});' onkeypress='' /> {$sor_a_met}<br/><br/>"; } if ($secenek2 != "") { $sonuc .= "<input type='radio' value='B' name='cevap' class='cevap' style='width:35px;' onclick='cevapDegerlendir(\"{$sor_b}\",{$id});' /> {$sor_b_met}<br/><br/>"; } if ($secenek3 != "") { $sonuc .= "<input type='radio' value='C' name='cevap' class='cevap' style='width:35px;' onclick='cevapDegerlendir(\"{$sor_c}\",{$id});' /> {$sor_c_met}<br/><br/>"; } if ($secenek4 != "") { $sonuc .= "<input type='radio' value='D' name='cevap' class='cevap' style='width:35px;' onclick='cevapDegerlendir(\"{$sor_d}\",{$id});' /> {$sor_d_met}<br/><br/>"; } if ($secenek5 != "") { $sonuc .= "<input type='radio' value='E' name='cevap' class='cevap' style='width:35px;' onclick='cevapDegerlendir(\"{$sor_e}\",{$id});' /> {$sor_e_met}<br/><br/>"; } if ($secenek6 != "") { $sonuc .= "<input type='radio' value='F' name='cevap' class='cevap' style='width:35px;' onclick='cevapDegerlendir(\"{$sor_f}\",{$id});' /> {$sor_f_met}"; } } else { //ÇOK SEÇÝMLÝ soru $_SESSION["cevaplar"][$id] = ""; $_SESSION["hataSay"][$id] = ""; $toplamCevapAdedi = !empty($secenek1) + !empty($secenek2) + !empty($secenek3) + !empty($secenek4) + !empty($secenek5) + !empty($secenek6); $araCevDizi = preg_split('$[/]$', rasgeleCevapHazirla($toplamCevapAdedi)); switch ($araCevDizi[0]) { case 1: $sor_a = "a"; $sor_a_met = $secenek1; break; case 2: $sor_a = "b"; $sor_a_met = $secenek2; break; case 3: $sor_a = "c"; $sor_a_met = $secenek3; break; case 4: $sor_a = "d"; $sor_a_met = $secenek4; break; case 5: $sor_a = "e"; $sor_a_met = $secenek5; break; case 6: $sor_a = "f"; $sor_a_met = $secenek6; break; default: $sor_a = "a"; $sor_a_met = $secenek1; } switch ($araCevDizi[1]) { case 1: $sor_b = "a"; $sor_b_met = $secenek1; break; case 2: $sor_b = "b"; $sor_b_met = $secenek2; break; case 3: $sor_b = "c"; $sor_b_met = $secenek3; break; case 4: $sor_b = "d"; $sor_b_met = $secenek4; break; case 5: $sor_b = "e"; $sor_b_met = $secenek5; break; case 6: $sor_b = "f"; $sor_b_met = $secenek6; break; default: $sor_b = "b"; $sor_b_met = $secenek2; } switch ($araCevDizi[2]) { case 1: $sor_c = "a"; $sor_c_met = $secenek1; break; case 2: $sor_c = "b"; $sor_c_met = $secenek2; break; case 3: $sor_c = "c"; $sor_c_met = $secenek3; break; case 4: $sor_c = "d"; $sor_c_met = $secenek4; break; case 5: $sor_c = "e"; $sor_c_met = $secenek5; break; case 6: $sor_c = "f"; $sor_c_met = $secenek6; break; default: $sor_c = "c"; $sor_c_met = $secenek3; } switch ($araCevDizi[3]) { case 1: $sor_d = "a"; $sor_d_met = $secenek1; break; case 2: $sor_d = "b"; $sor_d_met = $secenek2; break; case 3: $sor_d = "c"; $sor_d_met = $secenek3; break; case 4: $sor_d = "d"; $sor_d_met = $secenek4; break; case 5: $sor_d = "e"; $sor_d_met = $secenek5; break; case 6: $sor_d = "f"; $sor_d_met = $secenek6; break; default: $sor_d = "d"; $sor_d_met = $secenek4; } switch ($araCevDizi[4]) { case 1: $sor_e = "a"; $sor_e_met = $secenek1; break; case 2: $sor_e = "b"; $sor_e_met = $secenek2; break; case 3: $sor_e = "c"; $sor_e_met = $secenek3; break; case 4: $sor_e = "d"; $sor_e_met = $secenek4; break; case 5: $sor_e = "e"; $sor_e_met = $secenek5; break; case 6: $sor_e = "f"; $sor_e_met = $secenek6; break; default: $sor_e = "e"; $sor_e_met = $secenek5; } switch ($araCevDizi[5]) { case 1: $sor_f = "a"; $sor_f_met = $secenek1; break; case 2: $sor_f = "b"; $sor_f_met = $secenek2; break; case 3: $sor_f = "c"; $sor_f_met = $secenek3; break; case 4: $sor_f = "d"; $sor_f_met = $secenek4; break; case 5: $sor_f = "e"; $sor_f_met = $secenek5; break; case 6: $sor_f = "f"; $sor_f_met = $secenek6; break; default: $sor_f = "e"; $sor_f_met = $secenek6; } $sonuc .= "<p>{$metin['455']}" . getCevapSay($id) . "</p>"; if ($secenek1 != "") { $sonuc .= "<input type='checkbox' value='A' name='cevap' id='cevap1' class='cevap' style='width:35px;' onclick='document.getElementById(\"cevap1\").style.visibility = \"hidden\";\r\n\t\t\t cevapDegerlendir2(\"{$sor_a}\",{$id});' /> {$sor_a_met}<br/><br/>"; } if ($secenek2 != "") { $sonuc .= "<input type='checkbox' value='B' name='cevap' id='cevap2' class='cevap' style='width:35px;' onclick='document.getElementById(\"cevap2\").style.visibility = \"hidden\";\r\n\t\t\t cevapDegerlendir2(\"{$sor_b}\",{$id});' /> {$sor_b_met}<br/><br/>"; } if ($secenek3 != "") { $sonuc .= "<input type='checkbox' value='C' name='cevap' id='cevap3' class='cevap' style='width:35px;' onclick='document.getElementById(\"cevap3\").style.visibility = \"hidden\";\r\n\t\t\t cevapDegerlendir2(\"{$sor_c}\",{$id});' /> {$sor_c_met}<br/><br/>"; } if ($secenek4 != "") { $sonuc .= "<input type='checkbox' value='D' name='cevap' id='cevap4' class='cevap' style='width:35px;' onclick='document.getElementById(\"cevap4\").style.visibility = \"hidden\";\r\n\t\t\t cevapDegerlendir2(\"{$sor_d}\",{$id});' /> {$sor_d_met}<br/><br/>"; } if ($secenek5 != "") { $sonuc .= "<input type='checkbox' value='E' name='cevap' id='cevap5' class='cevap' style='width:35px;' onclick='document.getElementById(\"cevap5\").style.visibility = \"hidden\";\r\n\t\t\t cevapDegerlendir2(\"{$sor_e}\",{$id});' /> {$sor_e_met}<br/><br/>"; } if ($secenek6 != "") { $sonuc .= "<input type='checkbox' value='F' name='cevap' id='cevap6' class='cevap' style='width:35px;' onclick='document.getElementById(\"cevap6\").style.visibility = \"hidden\";\r\n\t\t\t cevapDegerlendir2(\"{$sor_f}\",{$id});' /> {$sor_f_met}"; } } } //soru seçenekleri bitti if ($sonuc == "") { $sonuc = "{$metin['350']}"; } return $sonuc; } else { return ""; } }