1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
| // Test de l'envoi du formulaire
if(isset($_POST['connexion'])){
// Les identifiants sont transmis ?
if(!empty($_POST['login']) && !empty($_POST['password'])) {
// teste si les identifiants entrés existent dans la base des droits d'accès
// si oui: on ouvre la session, sinon: message d'erreur
$base = DBconnect(ACCES_SERVER, ACCES_PORT, ACCES_BASE, ACCES_USER, ACCES_PASSWORD);
$sql = 'SELECT LOGIN, PASSWORD, SOMLIT_VIEW, SOMLIT_DNLD, MAREL_VIEW, MAREL_DNLD,'.
' ECOFLUX_VIEW, ECOFLUX_DNLD, EVECOS_VIEW, EVECOS_DNLD,'.
' GEOMORPH_VIEW, GEOMORPH_DNLD, METEO_VIEW, METEO_DNLD,'.
' ARGO_VIEW, ARGO_DNLD, HYDRO_VIEW, HYDRO_DNLD'.
' FROM droits'.
' WHERE LOGIN=\''.$_POST['login'].'\' AND PASSWORD=\''.$_POST['password'].'\'';
$res = pg_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.pg_last_error());
if (pg_num_rows($res) > 0) {
$donnees = pg_fetch_array($res, NULL, PGSQL_ASSOC);
echo '<script type="text/javascript">alert(\''.$res.'\');</script>';
$_SESSION['login'] = $donnees['LOGIN'];
$_SESSION['somlit_view'] = $donnees['SOMLIT_VIEW'];
$_SESSION['somlit_dnld'] = $donnees['SOMLIT_DWLD'];
$_SESSION['marel_view'] = $donnees['MAREL_VIEW'];
$_SESSION['marel_dnld'] = $donnees['MAREL_DWLD'];
$_SESSION['ecoflux_view'] = $donnees['ECOFLUX_VIEW'];
$_SESSION['ecoflux_dnld'] = $donnees['ECOFLUX_DWLD'];
$_SESSION['evecos_view'] = $donnees['EVECOS_VIEW'];
$_SESSION['evecos_dnld'] = $donnees['EVECOS_DWLD'];
$_SESSION['geomorph_view'] = $donnees['GEOMORPH_VIEW'];
$_SESSION['geomorph_dnld'] = $donnees['GEOMORPH_DWLD'];
$_SESSION['meteo_view'] = $donnees['METEO_VIEW'];
$_SESSION['meteo_dnld'] = $donnees['METEO_DWLD'];
$_SESSION['argo_view'] = $donnees['ARGO_VIEW'];
$_SESSION['argo_dnld'] = $donnees['ARGO_DWLD'];
$_SESSION['hydro_view'] = $donnees['HYDRO_VIEW'];
$_SESSION['hydro_dnld'] = $donnees['HYDRO_DWLD'];
echo '<script type="text/javascript">alert(\''.$_SESSION['login'].'\');</script>';
header("Location:".$_SESSION['redirect']);
}
else {
echo '<script type="text/javascript">alert(\'Identifiants incorrects\');</script>';
}
pg_free_result($res);
DBdisconnect($base);
}
else {
$errorMessage = 'Veuillez saisir vos identifiants svp !';
echo '<script type="text/javascript">alert(\''.$errorMessage.'\');</script>';
}
} |
Partager