function cevapKontrol($cevap, $id) { global $yol1; global $metin; $cevap = iconv("UTF-8", "ISO-8859-9", $cevap); $olmasiGerekenDogruCevapSayisi = getCevapSay($id); $sql1 = "SELECT id FROM eo_5sayfa where cevap like '%{$cevap}%' and id='{$id}' limit 0,1"; $result1 = mysql_query($sql1, $yol1); if ($result1 && mysql_numrows($result1) == 1) { $uyeDogruCevapSayisi = $_SESSION["cevaplar"][$id] + 1; $_SESSION["cevaplar"][$id] = $uyeDogruCevapSayisi; //doðru sayýsýný 1 artýrdýk $hataSayisi = $_SESSION["hataSay"][$id]; //kaç hata yapýldý if ($olmasiGerekenDogruCevapSayisi == $uyeDogruCevapSayisi && $hataSayisi == 0) { //eðer hatasýz olarak tüm cevaplar seçilmiþ ise, DOÐRU $sonuc = "<span><img src='img/tick_circle.png' border='0' style=\"vertical-align: middle;\" alt=\"ok\" /> {$metin['348']}</span>"; $_SESSION["cevaplar"][$id] = "D"; } else { $sonuc = $uyeDogruCevapSayisi . " {$metin['453']}"; if ($hataSayisi > 0) { $sonuc .= $metin[454]; } } return $sonuc; } else { //hatalý bir cevap verildi ise $_SESSION["hataSay"][$id] += 1; return "<span><img src='img/error.png' border='0' style=\"vertical-align: middle;\" alt=\"error\" /> {$metin['349']}</span>"; } }
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 ""; } }