query($sql);
$num = $result->num_rows;
$row = $result->fetch_assoc();
$editpass = $row["pass"];
$ready = 0;
if( (0 < $num) and ($editpass != $p1) ){
echo "
";
echo " '".$c1."' 已被選用, 請用另一匿名, 重新輸入 !
";
echo "";
echo "";
} else {
$sql = "select aid, decision, mflag, tvalid from voteattend where pass='$p1'";
$result = $conn->query($sql);
$num = $result->num_rows;
if(0 < $num){
$ready = 0;
$row = $result->fetch_assoc();
$editable = $row["mflag"];
$validticket = $row["tvalid"];
$idnum = $row["aid"];
if($validticket){
if($editable){
session_start();
$_SESSION['login'] = "YES";
$_SESSION['attendid'] = $row["aid"];
$aaiidd = $row["aid"];
$_SESSION['votedec'] = $row["decision"];
$_SESSION['canmodify'] = $row["mflag"];
$upsql = "update voteattend set nick='$c1' where aid='$aaiidd'";
$upresult = $conn->query($upsql);
if($upresult) {
$_SESSION['nickname'] = $c1;
$ready = 1;
header("Location:Attendperson.php");
} else {
echo "";
echo " '".$c1."' 匿名未能更新!
";
echo "";
echo "";
}
} else {
echo "";
echo " '".$p1."' 在此項投票, 已不能更改了 !
";
echo "";
echo "";
}
} else {
echo "";
echo " '".$idnum."' 號票無效,是未登記的票 !
";
echo "";
echo "";
}
} else {
header("Location:index.php");
}
}
} else {
header("Location:index.php");
}
?>