75 lines
2.2 KiB
PHP
75 lines
2.2 KiB
PHP
<?php
|
|
include('include/entete.php');
|
|
include('config/config.inc.php');
|
|
include('config/lib.inc.php');
|
|
|
|
|
|
if(isset($_POST['action']) && $_POST['action']=='go_co'){
|
|
|
|
foreach($_POST as $cle=>$val) $$cle=$val;
|
|
|
|
$maCleDeCryptage = getCleDeCryptage();
|
|
$email_cap2=crypter($maCleDeCryptage,$identifiant);
|
|
|
|
//echo $email_cap2.'<br/>'.md5($mdp);die();
|
|
|
|
$count=0;
|
|
$query = 'select * from eta where email_ref=:email_ref and mdp_ref=:mdp_ref';
|
|
$db = connect_base();
|
|
$queryRequest = $db->prepare( $query );
|
|
$queryRequest->bindParam( ':email_ref', $email_cap2, PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':mdp_ref', md5($mdp), PDO::PARAM_STR );
|
|
$queryRequest->execute();
|
|
$count = $queryRequest->rowCount();
|
|
|
|
if($count==1){
|
|
$r = $queryRequest->fetch( PDO::FETCH_ASSOC );
|
|
$_SESSION['cfa_num']=$r['id_eta'];
|
|
/*
|
|
$query2 = 'update eta set date_co=:date_co where id_eta=:id_eta';
|
|
$db2 = connect_base();
|
|
$queryRequest2 = $db2->prepare( $query2 );
|
|
$queryRequest2->bindParam( ':id_eta', $r['id_eta'], PDO::PARAM_INT );
|
|
$queryRequest2->bindParam( ':date_co', date('Y-m-d'), PDO::PARAM_STR );
|
|
$queryRequest2->execute();
|
|
*/
|
|
if($r['date_co']=='0000-00-00'){
|
|
header('location:first.php');
|
|
exit();
|
|
}
|
|
$_SESSION['cfa_co']=1;
|
|
header('location:index-cfa.php');
|
|
exit();
|
|
}
|
|
|
|
$count=0;
|
|
$query = 'select * from capitaines where email_cap=:email_cap and mdp_cap=:mdp_cap';
|
|
$db = connect_base();
|
|
$queryRequest = $db->prepare( $query );
|
|
$queryRequest->bindParam( ':email_cap', $email_cap2, PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':mdp_cap', md5($mdp), PDO::PARAM_STR );
|
|
$queryRequest->execute();
|
|
$count = $queryRequest->rowCount();
|
|
|
|
|
|
if($count==1){
|
|
$r = $queryRequest->fetch( PDO::FETCH_ASSOC );
|
|
$_SESSION['cap_co']=1;
|
|
$_SESSION['cap_num']=$r['id_cap'];
|
|
$query2 = 'update capitaines set date_co=:date_co where id_cap=:id_cap';
|
|
$db2 = connect_base();
|
|
$queryRequest2 = $db2->prepare( $query );
|
|
$queryRequest2->bindParam( ':id_cap', $r['id_cap'], PDO::PARAM_INT );
|
|
$queryRequest2->bindParam( ':date_co', date('Y-m-d'), PDO::PARAM_STR );
|
|
$queryRequest2->execute();
|
|
header('location:index-cap.php');
|
|
exit();
|
|
}
|
|
|
|
|
|
|
|
}
|
|
header('location:connexion-cfa.php?err=1');
|
|
exit();
|
|
|
|
?>
|