我正在尝试获取当前已登录用户的用户名,以便执行诸如在欢迎屏幕上显示用户名之类的操作。我使用php将用户连接到oracle11g数据库,但出现错误*注意:未定义的变量:第88行的C:\ xampp \ htdocs \ CamtelWork \ eBusiness \ index.php中的dbuser
注意:未定义的索引:在第88行的C:\ xampp \ htdocs \ CamtelWork \ eBusiness \ index.php中* 我已经定义了变量,但是我不知道该如何解决这个问题。
这是我的代码
login.php
<?php
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// always modified
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache");
session_start();
$uri = $_SERVER['PHP_SELF'] . "?" . SID;
if( isset($_POST['dbuser']) ) {
$dbuser = $_POST['dbuser'];
}
if( isset($_POST['pass']) ) {
$pass = $_POST['pass'];
}
?>
<title>Oracle in PHP test page</title>
<?php
// have username and password been passed from a form?
if ( isset($dbuser) && isset($pass) ) {
// try to connect to Oracle with user and password supplied
$conn = oci_connect($dbuser, $pass, 'localhost/orcl');
if (!$conn) {
$e = oci_error();
echo htmlentities($e['dbuser'], ENT_QUOTES);
unset($dbuser); unset($pass);
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<title>Welcome Page - Index</title>
<meta content="" name="descriptison">
<meta content="" name="keywords">
<!-- Favicons -->
<link href="assets/img/favicon.png" rel="icon">
<link href="assets/img/apple-touch-icon.png" rel="apple-touch-icon">
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,400i,600,700|Raleway:300,400,400i,500,500i,700,800,900" rel="stylesheet">
<!-- Vendor CSS Files -->
<link href="assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="assets/vendor/icofont/icofont.min.css" rel="stylesheet">
<link href="assets/vendor/animate.css/animate.min.css" rel="stylesheet">
<link href="assets/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="assets/vendor/nivo-slider/css/nivo-slider.css" rel="stylesheet">
<link href="assets/vendor/owl.carousel/assets/owl.carousel.min.css" rel="stylesheet">
<link href="assets/vendor/venobox/venobox.css" rel="stylesheet">
<!-- Template Main CSS File -->
<link href="assets/css/style.css" rel="stylesheet">
<!-- =======================================================
* Template Name: eBusiness - v2.0.0
* Template URL: https://bootstrapmade.com/ebusiness-bootstrap-corporate-template/
* Author: BootstrapMade.com
* License: https://bootstrapmade.com/license/
======================================================== -->
</head>
<body data-spy="scroll" data-target="#navbar-example">
<!-- ======= Header ======= -->
<header id="header" class="fixed-top">
<div class="container d-flex">
<div class="logo mr-auto">
<h1 class="text-light"><a href="index.html"><span>Welcome </span> <?php echo htmlentities($_GET["$dbuser"])."<br/>";?></a></h1>
<!-- Uncomment below if you prefer to use an image logo -->
<!-- <a href="index.html"><img src="assets/img/logo.png" alt="" class="img-fluid"></a>-->
</div>
欢迎页面
order
请问我该怎么做才能解决此问题,或者应该如何编写我的代码?预先感谢!