One variable printing, on the others I am getting Undefined index [duplicate]










0















This question already has an answer here:



  • “Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” using PHP

    28 answers



  • How to display errors for my MySQLi query? [duplicate]

    3 answers



I'm coding a webpage that has users register and then login. When trying to display the user's information on another page, I am struggling with trying to figure out why only the "username" variable will print but the "firstname" "lastname", "coursename" aren't appearing. Any insight would be helpful.



homepage.php - I am getting the error on the h3 User info tag



<?php
session_start();
?>



<!DOCTYPE html>
<html>
<head>
<title> Home Page</title>

<link rel="stylesheet" href="css/allstyle.css" >

</head>
<body>

<div class = "topnavbar">
<ul>
<li><a href = "UserInfo.php" class = "active"> User Info</a></li>
<li><a href = "Homework.php"> Homework </a></li>
<li><a href = "ToDoList.php"> To-Do-List </a></li>
<li><a href = "WishList.php"> Wishlist </a></li>
<li><a href = "MessageBoard.php"> MessageBoard </a></li>
<ul>
</div>


<div id = "main-wrapper">
<center>
<h2>Home Page</h2>
<h3> Welcome <?php echo $_SESSION['username']?> </h3>
<h3> User Info: <?php echo $_SESSION['firstname']?> </h3>
<h3><?php echo $_SESSION['lastname']?></h3>
<img src = "imgs/DefaultAvatar.jpg" class ="avatar"/>
</center>


<form class = "myform" action = "homepage.php" method = "post">

<input name = "logout" type = "submit" id = "logout_btn" value = "Log Out"/><br></a>

</form>

<?php

if(isset($_POST['logout']))

session_destroy();
header('location: index.php');


?>

</div>

</body>
</html>


register.php



<?php
require 'dbconfig/config.php';

?>

<!DOCTYPE html>

<html>
<head>
<title> Registration Page </title>

<link rel="stylesheet" href="css/allstyle.css" >
</head>
<body>






<div id = "main-wrapper">
<center>
<h2>Registration Form</h2>
<img src = "imgs/DefaultAvatar.jpg" class ="avatar"/>
</center>


<form class = "myform" action = "register.php" method = "post">


<label><b>First Name:</b></label><br>
<input name = "firstname" type = "text" class = "inputvalues" placeholder = "Enter your first name" required/><br>
<label><b>Last Name:</b></label><br>
<input name = "lastname" type = "text" class = "inputvalues" placeholder = "Enter your last name" required/><br>
<label><b>Course Name:</b></label><br>
<input name = "coursename" type = "text" class = "inputvalues" placeholder = "Enter your course name" required/><br>
<label><b>Username:</b></label><br>
<input name = "username" type = "text" class = "inputvalues" placeholder = "Enter your username" required/><br>
<label><b>Password:</b></label><br>
<input name = "password" type = "password" class = "inputvalues" placeholder = "Enter your password" required/><br>
<label><b> Confirm Password:</b></label><br>
<input name = "cpassword" type = "password" class = "inputvalues" placeholder = "Confirm your password" required/><br>
<input name = "submit_btn" type = "submit" id = "signup_btn" value = "Sign Up"/><br>
<a href = "index.php"><input type ="button" id = "back_btn" value = " << Back to Login"/></a>

</form>

</html>


<?php

if(isset($_POST['submit_btn']))

//echo '<script type = "text/javascript"> alert("Sign up button clicked") </script>';


$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$coursename = $_POST['coursename'];

$username = $_POST['username'];
$password = $_POST['password'];
$cpassword = $_POST['cpassword'];


if($password==$cpassword)

$query= " select * from user WHERE username='$username'";
$query_run = mysqli_query($con, $query);


if(mysqli_num_rows($query_run)>0)

//Notifying user their username is taken
echo '<script type = "text/javascript"> alert("This username is taken, please try another. ") </script>';

else

$query = "insert into user values ('$username','$password','$firstname','$lastname','$coursename')";
$query_run = mysqli_query($con,$query);

if($query_run)

echo '<script type = "text/javascript"> alert("You have successfully registered! Return to login screen to login. ") </script>';


else

echo '<script type = "text/javascript"> alert("Error!") </script>';






else

echo '<script type = "text/javascript"> alert("Your passwords do not match, please try again.") </script>';





?>

</div>
</body>
</html>









share|improve this question















marked as duplicate by Funk Forty Niner html
Users with the  html badge can single-handedly close html questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 12 '18 at 23:20


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 2




    I don't see where you set any of those values in $_SESSION, even username.
    – Don't Panic
    Nov 12 '18 at 23:22










  • I'm surprised that 'username' is printing, because you do not set one of them (in the shown code) in $_Session
    – Jeff
    Nov 12 '18 at 23:22










  • @Don'tPanic you beat me by 4 seconds with the kind of same comment ;)
    – Jeff
    Nov 12 '18 at 23:23






  • 1




    I hope this is for academic purposes only. Otherwise, you're going to get your site/database compromised/hacked. Use a prepared statement and for passwords, use password_hash()/password_verify() if you value the time and work you've put into this and your userbase.
    – Funk Forty Niner
    Nov 12 '18 at 23:24










  • @Don'tPanic thank you guys, that tid bit helped me resolve part of my issue. I have the "SESSION" in my index file and adding the other variables resolved this, however the information is showing up as blank for all of the variables except the "username" now
    – Somone
    Nov 12 '18 at 23:55















0















This question already has an answer here:



  • “Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” using PHP

    28 answers



  • How to display errors for my MySQLi query? [duplicate]

    3 answers



I'm coding a webpage that has users register and then login. When trying to display the user's information on another page, I am struggling with trying to figure out why only the "username" variable will print but the "firstname" "lastname", "coursename" aren't appearing. Any insight would be helpful.



homepage.php - I am getting the error on the h3 User info tag



<?php
session_start();
?>



<!DOCTYPE html>
<html>
<head>
<title> Home Page</title>

<link rel="stylesheet" href="css/allstyle.css" >

</head>
<body>

<div class = "topnavbar">
<ul>
<li><a href = "UserInfo.php" class = "active"> User Info</a></li>
<li><a href = "Homework.php"> Homework </a></li>
<li><a href = "ToDoList.php"> To-Do-List </a></li>
<li><a href = "WishList.php"> Wishlist </a></li>
<li><a href = "MessageBoard.php"> MessageBoard </a></li>
<ul>
</div>


<div id = "main-wrapper">
<center>
<h2>Home Page</h2>
<h3> Welcome <?php echo $_SESSION['username']?> </h3>
<h3> User Info: <?php echo $_SESSION['firstname']?> </h3>
<h3><?php echo $_SESSION['lastname']?></h3>
<img src = "imgs/DefaultAvatar.jpg" class ="avatar"/>
</center>


<form class = "myform" action = "homepage.php" method = "post">

<input name = "logout" type = "submit" id = "logout_btn" value = "Log Out"/><br></a>

</form>

<?php

if(isset($_POST['logout']))

session_destroy();
header('location: index.php');


?>

</div>

</body>
</html>


register.php



<?php
require 'dbconfig/config.php';

?>

<!DOCTYPE html>

<html>
<head>
<title> Registration Page </title>

<link rel="stylesheet" href="css/allstyle.css" >
</head>
<body>






<div id = "main-wrapper">
<center>
<h2>Registration Form</h2>
<img src = "imgs/DefaultAvatar.jpg" class ="avatar"/>
</center>


<form class = "myform" action = "register.php" method = "post">


<label><b>First Name:</b></label><br>
<input name = "firstname" type = "text" class = "inputvalues" placeholder = "Enter your first name" required/><br>
<label><b>Last Name:</b></label><br>
<input name = "lastname" type = "text" class = "inputvalues" placeholder = "Enter your last name" required/><br>
<label><b>Course Name:</b></label><br>
<input name = "coursename" type = "text" class = "inputvalues" placeholder = "Enter your course name" required/><br>
<label><b>Username:</b></label><br>
<input name = "username" type = "text" class = "inputvalues" placeholder = "Enter your username" required/><br>
<label><b>Password:</b></label><br>
<input name = "password" type = "password" class = "inputvalues" placeholder = "Enter your password" required/><br>
<label><b> Confirm Password:</b></label><br>
<input name = "cpassword" type = "password" class = "inputvalues" placeholder = "Confirm your password" required/><br>
<input name = "submit_btn" type = "submit" id = "signup_btn" value = "Sign Up"/><br>
<a href = "index.php"><input type ="button" id = "back_btn" value = " << Back to Login"/></a>

</form>

</html>


<?php

if(isset($_POST['submit_btn']))

//echo '<script type = "text/javascript"> alert("Sign up button clicked") </script>';


$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$coursename = $_POST['coursename'];

$username = $_POST['username'];
$password = $_POST['password'];
$cpassword = $_POST['cpassword'];


if($password==$cpassword)

$query= " select * from user WHERE username='$username'";
$query_run = mysqli_query($con, $query);


if(mysqli_num_rows($query_run)>0)

//Notifying user their username is taken
echo '<script type = "text/javascript"> alert("This username is taken, please try another. ") </script>';

else

$query = "insert into user values ('$username','$password','$firstname','$lastname','$coursename')";
$query_run = mysqli_query($con,$query);

if($query_run)

echo '<script type = "text/javascript"> alert("You have successfully registered! Return to login screen to login. ") </script>';


else

echo '<script type = "text/javascript"> alert("Error!") </script>';






else

echo '<script type = "text/javascript"> alert("Your passwords do not match, please try again.") </script>';





?>

</div>
</body>
</html>









share|improve this question















marked as duplicate by Funk Forty Niner html
Users with the  html badge can single-handedly close html questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 12 '18 at 23:20


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 2




    I don't see where you set any of those values in $_SESSION, even username.
    – Don't Panic
    Nov 12 '18 at 23:22










  • I'm surprised that 'username' is printing, because you do not set one of them (in the shown code) in $_Session
    – Jeff
    Nov 12 '18 at 23:22










  • @Don'tPanic you beat me by 4 seconds with the kind of same comment ;)
    – Jeff
    Nov 12 '18 at 23:23






  • 1




    I hope this is for academic purposes only. Otherwise, you're going to get your site/database compromised/hacked. Use a prepared statement and for passwords, use password_hash()/password_verify() if you value the time and work you've put into this and your userbase.
    – Funk Forty Niner
    Nov 12 '18 at 23:24










  • @Don'tPanic thank you guys, that tid bit helped me resolve part of my issue. I have the "SESSION" in my index file and adding the other variables resolved this, however the information is showing up as blank for all of the variables except the "username" now
    – Somone
    Nov 12 '18 at 23:55













0












0








0








This question already has an answer here:



  • “Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” using PHP

    28 answers



  • How to display errors for my MySQLi query? [duplicate]

    3 answers



I'm coding a webpage that has users register and then login. When trying to display the user's information on another page, I am struggling with trying to figure out why only the "username" variable will print but the "firstname" "lastname", "coursename" aren't appearing. Any insight would be helpful.



homepage.php - I am getting the error on the h3 User info tag



<?php
session_start();
?>



<!DOCTYPE html>
<html>
<head>
<title> Home Page</title>

<link rel="stylesheet" href="css/allstyle.css" >

</head>
<body>

<div class = "topnavbar">
<ul>
<li><a href = "UserInfo.php" class = "active"> User Info</a></li>
<li><a href = "Homework.php"> Homework </a></li>
<li><a href = "ToDoList.php"> To-Do-List </a></li>
<li><a href = "WishList.php"> Wishlist </a></li>
<li><a href = "MessageBoard.php"> MessageBoard </a></li>
<ul>
</div>


<div id = "main-wrapper">
<center>
<h2>Home Page</h2>
<h3> Welcome <?php echo $_SESSION['username']?> </h3>
<h3> User Info: <?php echo $_SESSION['firstname']?> </h3>
<h3><?php echo $_SESSION['lastname']?></h3>
<img src = "imgs/DefaultAvatar.jpg" class ="avatar"/>
</center>


<form class = "myform" action = "homepage.php" method = "post">

<input name = "logout" type = "submit" id = "logout_btn" value = "Log Out"/><br></a>

</form>

<?php

if(isset($_POST['logout']))

session_destroy();
header('location: index.php');


?>

</div>

</body>
</html>


register.php



<?php
require 'dbconfig/config.php';

?>

<!DOCTYPE html>

<html>
<head>
<title> Registration Page </title>

<link rel="stylesheet" href="css/allstyle.css" >
</head>
<body>






<div id = "main-wrapper">
<center>
<h2>Registration Form</h2>
<img src = "imgs/DefaultAvatar.jpg" class ="avatar"/>
</center>


<form class = "myform" action = "register.php" method = "post">


<label><b>First Name:</b></label><br>
<input name = "firstname" type = "text" class = "inputvalues" placeholder = "Enter your first name" required/><br>
<label><b>Last Name:</b></label><br>
<input name = "lastname" type = "text" class = "inputvalues" placeholder = "Enter your last name" required/><br>
<label><b>Course Name:</b></label><br>
<input name = "coursename" type = "text" class = "inputvalues" placeholder = "Enter your course name" required/><br>
<label><b>Username:</b></label><br>
<input name = "username" type = "text" class = "inputvalues" placeholder = "Enter your username" required/><br>
<label><b>Password:</b></label><br>
<input name = "password" type = "password" class = "inputvalues" placeholder = "Enter your password" required/><br>
<label><b> Confirm Password:</b></label><br>
<input name = "cpassword" type = "password" class = "inputvalues" placeholder = "Confirm your password" required/><br>
<input name = "submit_btn" type = "submit" id = "signup_btn" value = "Sign Up"/><br>
<a href = "index.php"><input type ="button" id = "back_btn" value = " << Back to Login"/></a>

</form>

</html>


<?php

if(isset($_POST['submit_btn']))

//echo '<script type = "text/javascript"> alert("Sign up button clicked") </script>';


$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$coursename = $_POST['coursename'];

$username = $_POST['username'];
$password = $_POST['password'];
$cpassword = $_POST['cpassword'];


if($password==$cpassword)

$query= " select * from user WHERE username='$username'";
$query_run = mysqli_query($con, $query);


if(mysqli_num_rows($query_run)>0)

//Notifying user their username is taken
echo '<script type = "text/javascript"> alert("This username is taken, please try another. ") </script>';

else

$query = "insert into user values ('$username','$password','$firstname','$lastname','$coursename')";
$query_run = mysqli_query($con,$query);

if($query_run)

echo '<script type = "text/javascript"> alert("You have successfully registered! Return to login screen to login. ") </script>';


else

echo '<script type = "text/javascript"> alert("Error!") </script>';






else

echo '<script type = "text/javascript"> alert("Your passwords do not match, please try again.") </script>';





?>

</div>
</body>
</html>









share|improve this question
















This question already has an answer here:



  • “Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” using PHP

    28 answers



  • How to display errors for my MySQLi query? [duplicate]

    3 answers



I'm coding a webpage that has users register and then login. When trying to display the user's information on another page, I am struggling with trying to figure out why only the "username" variable will print but the "firstname" "lastname", "coursename" aren't appearing. Any insight would be helpful.



homepage.php - I am getting the error on the h3 User info tag



<?php
session_start();
?>



<!DOCTYPE html>
<html>
<head>
<title> Home Page</title>

<link rel="stylesheet" href="css/allstyle.css" >

</head>
<body>

<div class = "topnavbar">
<ul>
<li><a href = "UserInfo.php" class = "active"> User Info</a></li>
<li><a href = "Homework.php"> Homework </a></li>
<li><a href = "ToDoList.php"> To-Do-List </a></li>
<li><a href = "WishList.php"> Wishlist </a></li>
<li><a href = "MessageBoard.php"> MessageBoard </a></li>
<ul>
</div>


<div id = "main-wrapper">
<center>
<h2>Home Page</h2>
<h3> Welcome <?php echo $_SESSION['username']?> </h3>
<h3> User Info: <?php echo $_SESSION['firstname']?> </h3>
<h3><?php echo $_SESSION['lastname']?></h3>
<img src = "imgs/DefaultAvatar.jpg" class ="avatar"/>
</center>


<form class = "myform" action = "homepage.php" method = "post">

<input name = "logout" type = "submit" id = "logout_btn" value = "Log Out"/><br></a>

</form>

<?php

if(isset($_POST['logout']))

session_destroy();
header('location: index.php');


?>

</div>

</body>
</html>


register.php



<?php
require 'dbconfig/config.php';

?>

<!DOCTYPE html>

<html>
<head>
<title> Registration Page </title>

<link rel="stylesheet" href="css/allstyle.css" >
</head>
<body>






<div id = "main-wrapper">
<center>
<h2>Registration Form</h2>
<img src = "imgs/DefaultAvatar.jpg" class ="avatar"/>
</center>


<form class = "myform" action = "register.php" method = "post">


<label><b>First Name:</b></label><br>
<input name = "firstname" type = "text" class = "inputvalues" placeholder = "Enter your first name" required/><br>
<label><b>Last Name:</b></label><br>
<input name = "lastname" type = "text" class = "inputvalues" placeholder = "Enter your last name" required/><br>
<label><b>Course Name:</b></label><br>
<input name = "coursename" type = "text" class = "inputvalues" placeholder = "Enter your course name" required/><br>
<label><b>Username:</b></label><br>
<input name = "username" type = "text" class = "inputvalues" placeholder = "Enter your username" required/><br>
<label><b>Password:</b></label><br>
<input name = "password" type = "password" class = "inputvalues" placeholder = "Enter your password" required/><br>
<label><b> Confirm Password:</b></label><br>
<input name = "cpassword" type = "password" class = "inputvalues" placeholder = "Confirm your password" required/><br>
<input name = "submit_btn" type = "submit" id = "signup_btn" value = "Sign Up"/><br>
<a href = "index.php"><input type ="button" id = "back_btn" value = " << Back to Login"/></a>

</form>

</html>


<?php

if(isset($_POST['submit_btn']))

//echo '<script type = "text/javascript"> alert("Sign up button clicked") </script>';


$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$coursename = $_POST['coursename'];

$username = $_POST['username'];
$password = $_POST['password'];
$cpassword = $_POST['cpassword'];


if($password==$cpassword)

$query= " select * from user WHERE username='$username'";
$query_run = mysqli_query($con, $query);


if(mysqli_num_rows($query_run)>0)

//Notifying user their username is taken
echo '<script type = "text/javascript"> alert("This username is taken, please try another. ") </script>';

else

$query = "insert into user values ('$username','$password','$firstname','$lastname','$coursename')";
$query_run = mysqli_query($con,$query);

if($query_run)

echo '<script type = "text/javascript"> alert("You have successfully registered! Return to login screen to login. ") </script>';


else

echo '<script type = "text/javascript"> alert("Error!") </script>';






else

echo '<script type = "text/javascript"> alert("Your passwords do not match, please try again.") </script>';





?>

</div>
</body>
</html>




This question already has an answer here:



  • “Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” using PHP

    28 answers



  • How to display errors for my MySQLi query? [duplicate]

    3 answers







php html mysql session undefined






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 '18 at 23:25









Funk Forty Niner

80.5k1247101




80.5k1247101










asked Nov 12 '18 at 23:11









SomoneSomone

28110




28110




marked as duplicate by Funk Forty Niner html
Users with the  html badge can single-handedly close html questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 12 '18 at 23:20


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by Funk Forty Niner html
Users with the  html badge can single-handedly close html questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 12 '18 at 23:20


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









  • 2




    I don't see where you set any of those values in $_SESSION, even username.
    – Don't Panic
    Nov 12 '18 at 23:22










  • I'm surprised that 'username' is printing, because you do not set one of them (in the shown code) in $_Session
    – Jeff
    Nov 12 '18 at 23:22










  • @Don'tPanic you beat me by 4 seconds with the kind of same comment ;)
    – Jeff
    Nov 12 '18 at 23:23






  • 1




    I hope this is for academic purposes only. Otherwise, you're going to get your site/database compromised/hacked. Use a prepared statement and for passwords, use password_hash()/password_verify() if you value the time and work you've put into this and your userbase.
    – Funk Forty Niner
    Nov 12 '18 at 23:24










  • @Don'tPanic thank you guys, that tid bit helped me resolve part of my issue. I have the "SESSION" in my index file and adding the other variables resolved this, however the information is showing up as blank for all of the variables except the "username" now
    – Somone
    Nov 12 '18 at 23:55












  • 2




    I don't see where you set any of those values in $_SESSION, even username.
    – Don't Panic
    Nov 12 '18 at 23:22










  • I'm surprised that 'username' is printing, because you do not set one of them (in the shown code) in $_Session
    – Jeff
    Nov 12 '18 at 23:22










  • @Don'tPanic you beat me by 4 seconds with the kind of same comment ;)
    – Jeff
    Nov 12 '18 at 23:23






  • 1




    I hope this is for academic purposes only. Otherwise, you're going to get your site/database compromised/hacked. Use a prepared statement and for passwords, use password_hash()/password_verify() if you value the time and work you've put into this and your userbase.
    – Funk Forty Niner
    Nov 12 '18 at 23:24










  • @Don'tPanic thank you guys, that tid bit helped me resolve part of my issue. I have the "SESSION" in my index file and adding the other variables resolved this, however the information is showing up as blank for all of the variables except the "username" now
    – Somone
    Nov 12 '18 at 23:55







2




2




I don't see where you set any of those values in $_SESSION, even username.
– Don't Panic
Nov 12 '18 at 23:22




I don't see where you set any of those values in $_SESSION, even username.
– Don't Panic
Nov 12 '18 at 23:22












I'm surprised that 'username' is printing, because you do not set one of them (in the shown code) in $_Session
– Jeff
Nov 12 '18 at 23:22




I'm surprised that 'username' is printing, because you do not set one of them (in the shown code) in $_Session
– Jeff
Nov 12 '18 at 23:22












@Don'tPanic you beat me by 4 seconds with the kind of same comment ;)
– Jeff
Nov 12 '18 at 23:23




@Don'tPanic you beat me by 4 seconds with the kind of same comment ;)
– Jeff
Nov 12 '18 at 23:23




1




1




I hope this is for academic purposes only. Otherwise, you're going to get your site/database compromised/hacked. Use a prepared statement and for passwords, use password_hash()/password_verify() if you value the time and work you've put into this and your userbase.
– Funk Forty Niner
Nov 12 '18 at 23:24




I hope this is for academic purposes only. Otherwise, you're going to get your site/database compromised/hacked. Use a prepared statement and for passwords, use password_hash()/password_verify() if you value the time and work you've put into this and your userbase.
– Funk Forty Niner
Nov 12 '18 at 23:24












@Don'tPanic thank you guys, that tid bit helped me resolve part of my issue. I have the "SESSION" in my index file and adding the other variables resolved this, however the information is showing up as blank for all of the variables except the "username" now
– Somone
Nov 12 '18 at 23:55




@Don'tPanic thank you guys, that tid bit helped me resolve part of my issue. I have the "SESSION" in my index file and adding the other variables resolved this, however the information is showing up as blank for all of the variables except the "username" now
– Somone
Nov 12 '18 at 23:55












0






active

oldest

votes

















0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes

這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3