다음과 같은 문제가 있습니다.로그인을 통한 PHP 연결
데이터베이스에 연결할 때 로그인을 기억하지 못합니다. 사실, 내 웹 페이지에 연결된 회원의 이름을 보여주고 싶습니다.
내 코드 :
config.php를
<?php
$connect = mysql_connect('localhost','root','aragorn11') or die ("erreur de connexion");
mysql_select_db('biblio',$connect) or die ("erreur de connexion base");
?>
session.php
<?php
session_start();
if (isset($_SESSION["login"])){
$connected=1;
$login=$_SESSION["login"];
}
?>
그리고 당신이 우리를 잘 보여주는 것
<?php
include ("config.php");
include ("session.php");
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Adherents_Connectés</title>
<link rel="stylesheet" type="text/css" href="accueil.css" />
</head>
<body>
<?php
echo "<h4>Welcome : $login</h4>\n";
?>
<h4> <a href = "index.html"> Déconnexion </a> <br/> </h4>
<p> Liste des actions possibles pour un adherent de la bibliothèque est :
<ul>
<a href = "liste_dispo_adherents.php" > Consulter la liste des livres disponibles </a>
</ul>
<ul>
<a href = "emprunt.php" > Emprunter un livre </a>
</ul>
</p>
</body>
</html>
왜 mysql_ * 함수를 사용하지 말아야합니까? http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php – Mark
읽기 => http : // www .sitepoint.com/php-sessions/ –