Project

General

Profile

redirect.php

redirect.php - sigap, 08/18/2009 07:27 PM

 
1
<?php
2
include ('connect.php');
3
include('getsomething.php');
4
$login=$_POST['login'];
5
$password=$_POST['password'];
6
$ip=realip();
7
if($login=='' || $password=='')
8
{
9
include ('echangeur2.php');
10
echo '<center><br><br><font size=2 face=verdana color=red><strong>Raison du refus d\'acc?s</strong>  : Vous avez oubli? de <strong>remplir un champ</strong> important </font></center>';
11
exit;
12
}
13
$sql = "select * from user where user_login='$login'";
14
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
15
$lignes=mysql_fetch_row($req);
16

    
17
if($lignes[2] != $password)
18
{
19
include ('echangeur2.php');
20
echo '<center><br><br><font size=2 face=verdana color=red><strong>Raison du refus d\'acc?s</strong> : Combinaison <strong>login et mot de passe</strong> non identif?e dans l\'annuaire.</font></center>';
21
exit;
22
}
23
else
24
{
25
        if($lignes[4] == 0) // si activation accept?e
26
        {
27
        include ('echangeur2.php');
28
        echo '<center><br><br><font size=2 face=verdana color=red><strong>Raison du refus d\'acc?s</strong>  : Votre acc?s est <strong>d?sactiv?</strong>. Contactez votre sup?rieur hi?rarchique.</font></center>';
29
        exit;
30
        } else {
31
        $s_id="";
32
        $userid="";
33
        $s_user="";
34
        //sess
35
        session_register("uzrlogin"); 
36
        session_register("sid");  
37
        $_SESSION["uzrlogin"]=$login; 
38
        $_SESSION["uzrlevel"]=$lignes[3]; 
39
        $djour=date("Y-m-d H:i:s"); 
40
        $s_user=md5($login.$password.$djour); 
41
        $s_id=md5($s_user.$djour); 
42
        $_SESSION['sid']=$s_id; 
43
        $userid=getuserid($login); 
44
        $requete="INSERT INTO session (session_id, date_debut, user_id, ip_user) VALUES ('$s_id','$djour',$userid,'$login') "; 
45
        $ret = mysql_query ($requete) or die (mysql_error ()); 
46
        //include('rss.create.php');
47
        echo"<meta http-equiv=\"Refresh\" content=\"3;URL=".getPage("config/pages/principale")."\"/>";
48
        }
49
}
50
?>