Location: PHPKode > projects > VIRTUAL.ID > PHP PFE/index.php
<?
session_start();
error_reporting(0);
$_SESSION['affiche_demande']=0;

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Administration en ligne</title>
<style type="text/css">
<!--
body {
	background-image: url();
	background-repeat: no-repeat;
}
#Layer1 {
	position:absolute;
	width:330px;
	height:169px;
	z-index:1;
	left: 459px;
	top: 232px;
}
.Style4 {
	font-size: 12px;
	font-weight: bold;
}
.Style5 {
	color: #990000;
	font-weight: bold;
}
-->
</style>
</head>
 <?php
 if (isset($_POST['mlogin']) && isset($_POST['mpaswd'])) 
{		
$l=$_POST["mlogin"];
$p=$_POST["mpaswd"];

if($l!="" || $p!="")
{

//parametres de connexions

$dn = "dc=marop,dc=tn";
$tLogin = $l;
$pPassword = $p;
//fin parametres de connexions

$ds=ldap_connect("localhost:10389");// or die ("Connection a l'annuaire impossible");

ldap_set_option($ds,LDAP_OPT_PROTOCOL_VERSION,3);
if ($ds)
{

$r=ldap_bind($ds,"uid=".$l.",dc=marop,dc=tn",$p);

if ($r)
{
$m="";

$dn = "dc=marop,dc=tn";

	$filtre="(|(sn=*)(cn=*))";

	$restriction = array( "cn", "sn", "uid");

	$sr=ldap_search($ds, $dn, $filtre, $restriction);
	$info = ldap_get_entries($ds, $sr);
	
	$_SESSION['name_user']=$info[0]["cn"][0];
	$_SESSION['second_name_user']=$info[0]["sn"][0];
	$_SESSION['u_user']=$l;
	$_SESSION['u_password']=$p;
	
	$close=ldap_close ($ds);
?>

<script language="JavaScript" type="text/JavaScript">;
	document.location.href="Page_services.php";
</script>;

<?php

} //fin if debut de recherche

else
$m="Login ou Mot de passe Incorrect";
} //fin pb de connexion
else
$m="Problème de connexion au serveur";

} //fin if les champs non vide

else
$m="Remplir tous les champs";
} //fin if isset

else
$m="";


 ?>
<body>
<div align="center">
  <p>&nbsp;</p>
  <div id="Layer1">
    <p>&nbsp;</p>
    <table width="329" border="0"><form name="formuser" method="post" action="<?php $_SERVER['PHP_SELF'] ?>">
      <tr>
        <td width="148"><div align="right"><span class="Style4">Entrer votre identifiant:</span></div></td>
        <td width="171"><label>
          <input type="text" name="mlogin" id="mlogin"/>
        </label></td>
      </tr>
      <tr>
        <td><div align="right"><span class="Style4">Entrer votre mot de passe:</span></div></td>
        <td><label>
          <input type="password" name="mpaswd" id="mpaswd"/>
        </label></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td><label>
          <input type="submit" name="Submit" value="Valider" />
        </label></td>
      </tr>
    </form></table>
    <p class="Style5"><?php echo $m; ?></p>
  </div>
  <p><img src="img\ImgAcc.jpg" width="843" height="484" />    </p>
</div>


</body>
</html>
Return current item: VIRTUAL.ID