【发布时间】:2012-05-01 09:41:17
【问题描述】:
我再次尝试使用我的 PHP,但我遇到了一些内联问题。我正在使用我在http://www.1stoptutorials.com/Membership_Course.html 学到的成员脚本。
我的表有以下字段:userid、first_name、last_name、email_address、username、password、dob、guardianid、user_level、signup_date、last_login、activated。
我想要做的是在用户登录时使用我的表中的数据,但由于某种原因,我能够访问的只是名字和姓氏字段。其他人都没有工作。
这是我当前在标题中的 PHP
<?php
require_once ('verify.php');
// Start output buffering:
ob_start();
// Initialize a session:
session_start();
// If no first_name session variable exists, redirect the user:
if (!isset($_SESSION['first_name'])) {
$url = BASE_URL . ''; // Define the URL.
ob_end_clean(); // Delete the buffer.
header("Location: $url");
exit(); // Quit the script.
}
?>
它在底部被关闭。现在登录,他们使用他们的用户名和密码,但我想知道为什么我只能使用他们的名字和姓氏?另外我如何嵌入内联?我目前正在使用以下内容。
<p style="color:White;">
Welcome
<strong>
<a href="profile.php?id=<? echo $_SESSION['userid'] ?>" style="font-family:Arial, Helvetica, sans-serif;color:White;">
<? echo $_SESSION['first_name'] ." ". $_SESSION['last_name'] ?>
</a>
</strong>
- Home |
<a href="photo.php" class="link">Photos</a>
|
<a href="video.php" class="link">Videos</a>
|
<a href="logout.php" class="link">Log Out</a>
</p>
当然,我的输出页面中只会出现名称,而不是 id 或任何其他字段。
有人可以帮忙吗?或者我需要发布更多信息吗?
或者谁能推荐一个更好的登录脚本?
【问题讨论】:
-
感谢您的帮助。我是一名 ASP 开发人员,所以到目前为止 PHP 对我来说并不是那么好。有什么有用的可以补充吗?
-
这里没有足够的信息来回答您的问题。您如何将数据放入 $_SESSION?它来自哪里?
-
我不确定。我是 PHP 新手,只是使用这个模板作为一种学习方式。我实际上想从 cookie 中使用,但需要解决这个问题