![]() | Flash quiz by swish and php | ![]() |
|
|
ยินดีรับ ผู้สนับสนุน เว็บไซต์ด้านการศึกษา
กลุ่มเว็บไซต์นี้ เริ่มพัฒนา พ.ศ.2542 โดยบุคลากรทางการศึกษาด้านคอมพิวเตอร์ โทร. 081-9927223 (ผมเป็นคนลำปางหนา) ปล. ขอไม่รับ work at home / อาหารเสริม |
<?
session_start();
$dir_handle = opendir(".");
$cnt=0;
while ($list = readdir($dir_handle)) {
if (strtolower(substr($list,-4)) == ".swf") {
$ar[$cnt] = $list;
$cnt = $cnt + 1;
}
}
srand(time());
$r = rand() % $cnt;
if (!isset($_GET['act'])) {
$_SESSION['score'] = 0;
$showquiz = 1;
} else {
if ($_GET['act'] == 0) {
$showquiz = 0;
$oscore = $_SESSION['score'];
$_SESSION['score'] = 0;
} else {
$_SESSION['score'] = $_SESSION['score'] + 1;
$showquiz = 1;
}
}
echo "<head>";
if ($showquiz == 1) {
echo "<meta http-equiv=refresh content='30; url=". $ar[$r] ."'>";
echo "</head>";
} else {
echo "</head><body bgcolor=red link=yellow vlink=yellow><center>";
echo "<font size=4 face=impact color=white>Your score : ". $oscore;
echo "<br><br><a href=http://lampang.thcity.com/quizflash>Quiz again</a>";
echo "<br><br><a href=http://www.thaiall.com/quizflash/indexo.html target=_blank>Source code</a>";
echo "<br><br><font size=0>Script version 2.0 (Session version)";
echo "</body></html>";
}
?>
|
<?
$dir_handle = opendir(".");
$cnt=0;
while ($list = readdir($dir_handle)) {
if (strtolower(substr($list,-4)) == ".swf") {
$ar[$cnt] = $list;
$cnt = $cnt + 1;
}
}
srand(time());
$r = rand() % $cnt;
if (!isset($_GET['act'])) {
setcookie("score","0",time()+60);
$showquiz = 1;
} else {
if ($_GET['act'] == 0) {
$showquiz = 0;
$oscore = $score;
setcookie("score","0",time()+60);
} else {
setcookie("score",$score + 1,time()+60);
$showquiz = 1;
}
}
echo "<head>";
echo "<meta http-equiv=Expires content='Mon, 01 Jan 2001 12:00:00 GMT'>";
echo "<meta http-equiv=Cache-Control content=no-cache>";
if ($showquiz == 1) {
echo "<meta http-equiv=refresh content='30; url=". $ar[$r] ."'>";
echo "</head>";
} else {
echo "</head><body bgcolor=red link=yellow vlink=yellow><center>";
echo "<font size=6 face=impact color=white><br><br>Your score : ".$score;
echo "<br><br><a href=http://lampang.thcity.com/quizflash>Quiz again</a>";
echo "<br><br><a href=http://www.thaiall.com/quizflash/indexo.html>Source code</a>";
echo "</body></html>";
}
?>
|