Oturumu ile sorgula: Bu doğru bir yolu var mı?

0 Cevap php

I have developed a membership script with php for learning and I have confused in a session issue: In login.php, after username and password query there is:

$_SESSION['user'] = $aut_user['user_name'];
$_SESSION['user_id'] = $aut_user['user_id'];

and after this, page redirects to user.php. In user.php I have used this query:

$id = $_SESSION['user_id'];
$sql = sprintf("SELECT *FROM members WHERE user_id = '%d' ", $id);

My question is; Which is the correct way:

  1. login.php tüm tablo öğeleri (id, adı, kullanıcı nick vs) atamak
  2. User.php oturumda dayalı bir sorgu

Şimdiden teşekkürler

0 Cevap