Location: PHPKode > projects > Prolawyer > etude/connection_data.php
<?
$test_val["name_to_test"]="";
$test_val["pass_to_test"]="";
if(ereg("config_verify", $anchor)){
if(isset($_POST["user"])) $test_val["name_to_test"]=$_POST["user"];
if(isset($_POST["pwd"])) $test_val["pass_to_test"]=$_POST["pwd"];
}
elseif(ereg("verify", $anchor)){
if(isset($_POST["start_utilisateur"])) $test_val["name_to_test"]=$_POST["start_utilisateur"];
if(isset($_POST["start_pwd"])) $test_val["pass_to_test"]=$_POST["start_pwd"];
}
else{
if(isset($_SESSION["session_utilisateur"])) $test_val["name_to_test"]=$_SESSION["session_utilisateur"];
if(isset($_SESSION["session_pwd"])) $test_val["pass_to_test"]=$_SESSION["session_pwd"];
}
if($test_val["pass_to_test"]=="") $test_val["pass_to_test"]=time(); //pas le droit d'avoir un mot de passe vide

$con_user="";
$con_pwd="";
$file=read_and_prepare("{$settings["passfile"]}");
foreach($file as $ligne){
$temp_pass=$test_val["pass_to_test"];
$connection["test"]=0;
@list($user, $accessname, $accesspass, $right)= split (",", $ligne);
$con_user=decode($accessname, $temp_pass);
$con_pwd=decode($accesspass, "{$test_val["pass_to_test"]}");
if($user==$test_val["name_to_test"]) @$connection["test"]=mysql_connect("localhost", "$con_user", "$con_pwd");
if($connection["test"]) $select=mysql_select_db("etude");
//lecture des droits sur la table courante
$settings["droitspecifique"]="";
$arr=read_and_prepare("{$settings["partnerfile"]}");
foreach($arr as $line){
list(,$baseencours,$listedroits)=split(",", $line);
if($baseencours==$test_val["name_to_test"]){
$tabdroits=explode(";", $listedroits);
foreach($tabdroits as $lignedroit){
if(trim($lignedroit) !="") list($possdroits, $nomdroit) = split("=", $lignedroit);
if($test_val["name_to_test"]==$possdroits) $settings["droitspecifique"]=$nomdroit;
}
}
}
if ($connection["test"]) {
break;
}
}
?>
Return current item: Prolawyer