Location: PHPKode > projects > SSEP - Election Simulation System > ssep-0.2/eleger3.php
<?

require("conf.php");

# Inicia sessao
session_start();

# SESSAO Autenticada
if((!session_is_registered(letsafe)) || ($letsafe != $keyword) || !$id)
exit("status=Error Session problem");

if(!$candidato)
exit("status=Error Select your candidate");

# Verifica tipo digitado no codigo
if(!ereg('[0-9]', $candidato))
exit("status=Error Candidate must have only numbers");

# Tamanho do Candidato
if(strlen($candidato) > 2)
exit("status=Error Candidate must have only two-digit.");

$sql="update people set candidate='$candidato',ip='$ip'  where id='$id'";
$query = mysql_db_query($db,$sql,$conn);

if(!$query){
mysql_close($conn);
exit("status=Error Problem recording SQL data");
}


$sql="select ip from people where id='$id'";
$query=mysql_db_query($db,$sql,$conn);
$row=mysql_fetch_array($query);
if(!$row)
exit("<script language=JavaScript>alert(\"Error: Your ID does not existis in your database.\");history.go(-1);</script>");
if(empty($row['ip'])) {
mysql_close($conn);
exit("status=Error Data not recorded");
}




mysql_close($conn);

session_destroy();
exit("status=Cadastrado com sucesso");

?>
Return current item: SSEP - Election Simulation System