jquery - Disable all input buttons on page if no PHP session exists -


i'm doing site voting system. want disable input buttons (the ability vote) if user isnt logged in (ie. session doesnt exist). how do check in php @ top of page , allow/disallow input buttons? use css or jquery?

somewhere in code check if session not set:

if(!isset($_session['some_key'])){    $disable = true; }else{    $disable = false; } 

then, in html:

<input type="radio" name="" value=""<?=($disable ? " disabled=\"disabled\"" : "");?>/> vote 1 <input type="radio" name="" value=""<?=($disable ? " disabled=\"disabled\"" : "");?>/> vote 2 <input type="radio" name="" value=""<?=($disable ? " disabled=\"disabled\"" : "");?>/> vote 3 

but still have check @ serverside before accept vote, if person has voted before, because form can edited post data again , again.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -