$erro=$_GET['erro'];
$rgerro=$_GET['rgerro'];
$nome=$_POST['nome'];
$rg=$_POST['rg'];
$cpf=$_POST['cpf'];
$curso=$_POST['curso'];
$data=$_POST['data'];
$local=$_POST['local'];
$carga=$_POST['carga'];
$assinatura_participante=$_POST['assinatura_participante'];
$instrutor=$_POST['instrutor'];
$instrutor2=$_POST['instrutor2'];
$texto=$_POST['texto'];
$empresa_atendida=$_POST['empresa_atendida'];
$total=1;
$i=0;
if ($nome!='')
{
while ($total>=$i)
{
$novo_valor= "";
$valor = "abcdefghjkmnpqrstuvwyzABCDEFGHJKLMNPQRSTUVWYZ23456789";
srand((double)microtime()*1000000);
for ($i=0; $i<10; $i++){
$novo_valor.= $valor[rand()%strlen($valor)];
}
//consulta para pegar o total de resultados encontrados
$sql = "SELECT COUNT(*) AS TOTAL FROM `certificados` where `id` LIKE '" . $novo_valor . "'";
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_assoc($result);
$total=$row['TOTAL'];
//echo "Total - " . $total;
if ($total==0)
{
$i=1000;
$sql = mysqli_query($conn, "INSERT INTO certificados (id, nome, rg, cpf, curso, data, local, carga_horaria, assinatura_participante, instrutor, instrutor2, verso, empresa_atendida) VALUES ('$novo_valor', '$nome', '$rg','$cpf', '$curso', '$data', '$local', '$carga', '$assinatura_participante', '$instrutor', '$instrutor2', '$texto', '$empresa_atendida')"); $row = mysqli_num_rows($sql);
}
else
{
$i=0;
}
}
}
if ($nome!='')
{
$sql = "select * FROM `certificados` where `id` LIKE '" . $novo_valor . "'";
$result = mysqli_query($conn, $sql);
$linha = mysqli_fetch_assoc($result);
$rg=$linha['rg'];
$curso=$linha['curso'];
$data=$linha['data'];
$local=$linha['local'];
$carga_horaria=$linha['carga_horaria'];
$assinatura_participante=$linha['assinatura_participante'];
$instrutor=$linha['instrutor'];
$instrutor2=$linha['instrutor2'];
$empresa_atendida=$row2['empresa_atendida'];
$verso=$row2['verso'];
?>
|
CERTIFICADOS
Gerencie os certificados cadastrados
|
Certificado cadastrado com sucesso!
- Escolha abaixo o que deseja fazer:
CADASTRAR NOVO CERTIFICADO
- Preencha abaixo os dados referentes ao certificado que deseja cadastrar.
}
else
{
?>
|
CERTIFICADOS
Gerencie os certificados cadastrados
|
Pesquisar certificado: if ($erro!='') { echo " Nenhum certificado encontrado iniciando com a letra " . $erro . "";} ?>
if ($rgerro!='') { echo " Nenhum certificado encontrado para o RG " . $rgerro . "";} ?>
GERENCIAR INSTRUTORES
ÚLTIMOS CERTIFICADOS CADASTRADOS:
$sql = "select * from certificados WHERE status !='0' ORDER BY contador DESC LIMIT 10";
$res2 = mysqli_query($conn, $sql);
while ($row2 = mysqli_fetch_assoc($res2))
{
$id=$row2['id'];
$nome=$row2['nome'];
$curso=$row2['curso'];
$data=$row2['data'];
$max = 30;
$curso=substr_replace($curso, (strlen($curso) > $max ? '...' : ''), $max);
$max = 30;
$nome=substr_replace($nome, (strlen($nome) > $max ? '...' : ''), $max);
?>
echo $nome; ?>
echo $curso; ?>
echo $data; ?>
}
?>
CADASTRAR NOVO CERTIFICADO
- Preencha abaixo os dados referentes ao certificado que deseja cadastrar.
}
$sql = "select * FROM `certificados` where `id` LIKE '" . $novo_valor . "'";
$result = mysqli_query($conn, $sql);
$linha = mysqli_fetch_assoc($result);
$rg=$linha['rg'];
$curso=$linha['curso'];
$data=$linha['data'];
$local=$linha['local'];
$carga_horaria=$linha['carga_horaria'];
$assinatura_participante=$linha['assinatura_participante'];
$instrutor=$linha['instrutor'];
$instrutor2=$linha['instrutor2'];
$empresa_atendida=$linha['empresa_atendida'];
$verso=$linha['verso'];
?>