this is the code of the class
Code: Select all
<?
class dataset {
var $sets = array();
function pros() {
include("dbs.php");
$lk = mysql_connect($serv,$user,$pass) or die(mysql_error());
mysql_select_db($dbnameї0],$lk);
$qur = "select * from pollqa order by id desc limit 0,1";
$res = mysql_query($qur) or die ( "Error display \n" .mysql_error());
while ($row = mysql_fetch_assoc($res)) {
$this->setsї0] = $rowї'qs'];
$this->setsї1] = $rowї'ans1'];
$this->setsї2] = $rowї'ans2'];
$this->setsї3] = $rowї'ans3'];
$this->setsї4] = $rowї'ans4'];
$this->setsї5] = $rowї'ans5'];
$this->setsї6] = $rowї'ans6'];
}
return $this->sets;
}
}
?>Code: Select all
<?
session_start();
include_once("includes/pross.inc");
$infos = new dataset();
$infos->pros();
$ip = $_SERVERї'REMOTE_ADDR'];
session_register($sid ,$vote);
$_SESSIONї'SID'] = session_id();
if (is_array($infos)) {
foreach ($infos as $pres => $i) {
?>
<html>
<body>
<form action="polrs.php" method="POST" id="poll">
<p>
<H3><b><?= $infosї0] ?> </b></h3></p><br/><hr><br/>
<?
if ($i != 0) {
echo "<INPUT type="checkbox" value=" $i "> $pres <br/>";
}
}
}
?>
<hr><br/>
<input type="hidden" value="<?=$ip?>">
<input type="hidden" value="<?= $_SESSIONї'SID']?>"
<INPUT type="submit" value="Enter vote">
</body>
</html>