PDA

View Full Version : سوال: اسکریپت نظر سنجی



alih110
پنج شنبه 05 شهریور 1388, 08:17 صبح
دوستان عزیز و اساتید .

یه کمک کوچولو .

من یک سیستم نظر سنجی برای وبلاگم ساختم .
اینم کد نتیاجش هست که با هیچ دیتابیسی هم نیست در تکست ذخیره میشه .
میخوام به این نتایج نوار پیشرفت اضافه کنم . مثل همه نظر سنجی ها. کسی میتونه کمک کنه .



<html>
<head>
<title>نتايج نظر سنجي</title>
</head>
<body>
<div style="visibility:hidden;display:none"><script type="text/javascript" language="javascript" src="http://www.webgozar.ir/c.aspx?Code=1096823&t=counter" ></script></div>
<?php
$file='excellent.txt';
$fh=fopen($file,'r') or die ('Failed to read file');
$result1=fread($fh,filesize($file));
fclose($fh);
$file='good.txt';
$fh=fopen($file,'r') or die ('Failed to read file');
$result2=fread($fh,filesize($file));
fclose($fh);
$file='notbad.txt';
$fh=fopen($file,'r') or die ('Failed to read file');
$result3=fread($fh,filesize($file));
fclose($fh);
$file='bad.txt';
$fh=fopen($file,'r') or die ('Failed to read file');
$result4=fread($fh,filesize($file));
fclose($fh);
?>
<table border="1" width="100%">
<caption><b>نتايج نظر سنجي<br>کل راي ها : </b> <?php $total= $result1 + $result2 + $result3 + $result4; echo "$total"; ?><br> </caption>
<tr><th width="50%">عوامل سنجش</th><th width="50%">نظرات</th></tr>
<tr><td width="50%" align="center">عالي</td><td width="50%" align="center"><?php echo "$result1"; ?></td><td width="25%"></tr>
<tr><td width="50%" align="center">خوب</td><td width="50%" align="center"><?php echo "$result2"; ?></td></tr>
<tr><td width="50%" align="center">متوسط</td><td width="50%" align="center"><?php echo "$result3"; ?></td></tr>
<tr><td width="50%" align="center">بد</td><td width="50%" align="center"><?php echo "$result4"; ?></td></tr>
</table>
</body>
</html>