로그인 시스템을 만들려고하지만 내 한 페이지가 작동하고 다른 페이지는 작동하지 않습니다. 도와주세요!
다음은 작동하는 첫 번째 페이지입니다.
<?php
/* Displays user information and some useful messages */
session_start();
// Check if user is logged in using the session variable
if ( $_SESSION['logged_in'] != 1 ) {
$_SESSION['message'] = "You must log in before viewing your profile page!";
header("location: error.php");
}
else {
// Makes it easier to read
$first_name = $_SESSION['first_name'];
$last_name = $_SESSION['last_name'];
$email = $_SESSION['email'];
$active = $_SESSION['active'];
}
?>
<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<title>Welcome <?= $first_name.' '.$last_name ?></title>
<?php include 'css/css.html'; ?>
</head>
<body>
<div class="form">
<h1>Welcome</h1>
<p>
<?php
// Display message about account verification link only once
if ( isset($_SESSION['message']) )
{
echo $_SESSION['message'];
// Don't annoy the user with more messages upon page refresh
unset( $_SESSION['message'] );
}
?>
</p>
<?php
// Keep reminding the user this account is not active, until they
activate
if ( !$active ){
echo
'<div class="info">
Account is unverified, please confirm your email by clicking
on the email link!
</div>';
}
?>
<h2><?php echo $first_name.' '.$last_name; ?></h2>
<p><?= $email ?></p>
<a href="logout.php"><button class="button button-block"
name="logout"/>Log Out</button></a>
</div>
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src="js/index.js"></script>
</body>
</html>
이 페이지에서 다음과 같이 표시됩니다.
<title>Welcome <?= $first_name.' '.$last_name ?></title>
그것은 작동하고 환영과 사용자의 이름을 말합니다.
그러나이 페이지에서 :
<?php
session_start();
// any HTML input *must* be HTML-escaped to prevent the user from injecting
malicious JavaScript code
function html_escape($raw_input, $encoding)
{
return htmlspecialchars($raw_input, ENT_QUOTES | ENT_SUBSTITUTE, $encoding);
}
/* Displays user information and some useful messages */
if ($_SESSION['logged_in'] != 1) {
$first_name = 'Guest, Please Login or Sign Up to Play!';
$last_name = '';
}
else {
// Makes it easier to read
$first_name = $_SESSION['first_name'];
$last_name = $_SESSION['last_name'];
}
?>
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>CashBallz</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!--[if lte IE 8]><script src="assets/js/ie/html5shiv.js"></script><!
[endif]-->
<link rel="stylesheet" href="assets/css/main.css" />
<!--[if lte IE 9]><link rel="stylesheet" href="assets/css/ie9.css" /><!
[endif]-->
<!--[if lte IE 8]><link rel="stylesheet" href="assets/css/ie8.css" /><!
[endif]-->
</head>
<body class="landing">
<div id="page-wrapper">
<!-- Header -->
<header id="header">
<h1 id="logo"><a href="index.php">CashBallz</a></h1>
<nav id="nav">
<ul>
<li><a href="index.php">Home</a></li>
<li>
<a href="#">Play</a>
<ul>
<li><a href="left-sidebar.php">Server 1</a>
</li>
<li><a href="right-sidebar.php">Server 2</a>
</li>
<li><a href="no-sidebar.php">Server 3</a>
</li>
</ul>
</li>
<li><a href="elements.php">Paypal</a></li>
<li><a href="loginsystem/loginpage.php"
class="button special">Sign Up/Login</a></li>
</ul>
</nav>
<br>
<p style="float:right; font-size: 30px" >
Welcome <?php= $first_name.' '.$last_name ?>
</p>
</header>
<!-- Banner -->
<section id="banner">
<div class="content">
<header>
<h2>CashBallz</h2>
<p>The best way to make money by having fun.</p>
</header>
<span class="image"><img src="images/pic01.jpg" alt=""
/></span>
</div>
<a href="#one" class="goto-next scrolly">Next</a>
</section>
<!-- Explain -->
<section id="one" class="spotlight style1 bottom">
<span class="image fit main"><img src="images/pic02.jpg"
alt="" /></span>
<div class="content">
<div class="container">
<div class="row">
<div class="4u 12u$(medium)">
<header>
<h2>The Game</h2>
<p>CashBallz was made by two students to
help people gain easy money by having fun!</p>
</header>
</div>
<div class="4u 12u$(medium)">
<p>We had trouble finding ways to make money
because we werent old enough to get a job. So we decided to create a fun way
to
make money for ourselves and other people!</p>
</div>
<div class="4u$ 12u$(medium)">
<p>We hope you enjoy our game as much as we
did creating it.</p>
</div>
</div>
</div>
</div>
<a href="#two" class="goto-next scrolly">Next</a>
</section>
<!-- How to start playing -->
<section id="two" class="spotlight style2 right">
<span class="image fit main"><img src="images/pic03.jpg"
alt="" /></span>
<div class="content">
<header>
<h2>How to start playing!</h2>
<p>First, press sign up. You will be directed to a
page where you have to create an account with your paypal.</p>
</header>
<p>Log in with your paypal with our secure servers.
Then, press any server with the most people, and start playing!</p>
<ul class="actions">
<li><a href="loginsystem/loginpage.php"
class="button">Sign Up</a></li>
</ul>
</div>
<a href="#three" class="goto-next scrolly">Next</a>
</section>
<!-- How to play the game -->
<section id="three" class="spotlight style3 left">
<span class="image fit main bottom"><img
src="images/pic04.jpg" alt="" /></span>
<div class="content">
<header>
<h2>How to play the game / controls</h2>
<p>Use WASD or the arrow keys to move around.<p>
<p>Press space to split, and press shift to let out
a one-cent blob.<p>
</header>
<p>This game is similiar to Agar.io, eat another player
to gain their mass and price. Eat the small blobs to gain mass, but no
money.
</p>
<p>Press "C" to cash out, it will take 10 seconds of non
movement to leave the game with all your money.<p>
<ul class="actions">
<li><a href="#" class="button">Control Page</a></li>
</ul>
</div>
<a href="#four" class="goto-next scrolly">Next</a>
</section>
<!-- Strategies -->
<section id="four" class="wrapper style1 special fade-up">
<div class="container">
<header class="major">
<h2>Strategies to win!</h2>
<p>There are many ways to beat other players and
gain money faster!</p>
</header>
<div class="box alt">
<div class="row uniform">
<section class="4u 6u(medium) 12u$(xsmall)">
<span class="icon alt major fa-area-chart">
</span>
<h3>Split!</h3>
<p>Split to catch other blobs that are less
than 1/2 your size!</p>
</section>
<section class="4u 6u$(medium) 12u$(xsmall)">
<span class="icon alt major fa-comment">
</span>
<h3>Eleifend lorem ornare</h3>
<p>Feugiat accumsan lorem eu ac lorem amet
accumsan donec. Blandit orci porttitor.</p>
</section>
<section class="4u$ 6u(medium) 12u$(xsmall)">
<span class="icon alt major fa-flask">
</span>
<h3>Cubilia cep lobortis</h3>
<p>Feugiat accumsan lorem eu ac lorem amet
accumsan donec. Blandit orci porttitor.</p>
</section>
<section class="4u 6u$(medium) 12u$(xsmall)">
<span class="icon alt major fa-paper-plane">
</span>
<h3>Non semper interdum</h3>
<p>Feugiat accumsan lorem eu ac lorem amet
accumsan donec. Blandit orci porttitor.</p>
</section>
<section class="4u 6u(medium) 12u$(xsmall)">
<span class="icon alt major fa-file"></span>
<h3>Odio laoreet accumsan</h3>
<p>Feugiat accumsan lorem eu ac lorem amet
accumsan donec. Blandit orci porttitor.</p>
</section>
<section class="4u$ 6u$(medium) 12u$(xsmall)">
<span class="icon alt major fa-lock"></span>
<h3>Massa arcu accumsan</h3>
<p>Feugiat accumsan lorem eu ac lorem amet
accumsan donec. Blandit orci porttitor.</p>
</section>
</div>
</div>
<footer class="major">
<ul class="actions">
<li><a href="#" class="button">Magna sed
feugiat</a></li>
</ul>
</footer>
</div>
</section>
<!-- How you're making money -->
<section id="five" class="wrapper style2 special fade">
<div class="container">
<header>
<h2>Sign Up</h2>
<p>Start playing today!</p>
</header>
<form method="post" action="#" class="container 50%">
<div class="row uniform 50%">
<div class="8u 12u$(xsmall)"><input type="email"
name="email" id="email" placeholder="Your Email Address" /></div>
<div class="4u$ 12u$(xsmall)"><input
type="submit" value="Get Started" class="fit special" /></div>
</div>
</form>
</div>
</section>
<!-- Footer -->
<footer id="footer">
<ul class="icons">
<li><a href="#" class="icon alt fa-twitter"><span
class="label">Twitter</span></a></li>
<li><a href="#" class="icon alt fa-facebook"><span
class="label">Facebook</span></a></li>
<li><a href="#" class="icon alt fa-instagram"><span
class="label">Instagram</span></a></li>
<li><a href="#" class="icon alt fa-envelope"><span
class="label">Email</span></a></li>
</ul>
<ul class="copyright">
<li>© Untitled. All rights reserved.</li>
<li>Creator: <a href="http://html5up.net">CashBallz.Co</a></li>
</ul>
</footer>
</div>
<!-- Scripts -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/jquery.scrolly.min.js"></script>
<script src="assets/js/jquery.dropotron.min.js"></script>
<script src="assets/js/jquery.scrollex.min.js"></script>
<script src="assets/js/skel.min.js"></script>
<script src="assets/js/util.js"></script>
<!--[if lte IE 8]><script src="assets/js/ie/respond.min.js">
</script><![endif]-->
<script src="assets/js/main.js"></script>
</body>
</html>
다음과 같이 말할 때 사용자 이름이나 성 또는 손님 메시지도 말하지 않습니다.
Welcome <?php= $first_name.' '.$last_name ?>
나는 변수를 두 번 동일하게 설정하고 무엇이 잘못되었는지 이해하지 못합니다 이것이 도움이되는지 모르겠지만이 두 페이지는 다른 폴더에 있고 모든 세션 및 데이터베이스 PHP 파일은 첫 번째 페이지의 폴더에 있습니다. ,하지만 그게 중요한지 모르겠습니다.
감사합니다!
다음과 같이 말할 줄이 필요합니다.
Welcome <?php echo $first_name.' '.$last_name ?>
나는 당신이 사용하고있는 <? =?> 표기법에 대해 잘 모르겠지만 그것이 그것과 관련이 있다고 생각합니다. 두 번째는 <? = 대신 <? php =이며 예상대로 작동하지 않을 수 있습니다. 더 많은 것을 읽고 싶다면 그것들을 php short tags 라고 생각 합니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다