Deezi
I have a custom title
- Nov 14, 2016
- 50
- 12
I want something like this:
I already have a login form, a session started, but no idea how to make username & rank appear, tried searching for a while, but can't find something that actually works..
So I was wondering if anyone here could help me..
Have a nice day
*Thread can be closed, I figured this out.
SOLUTION
So the solution was much more simple than I though, atleast for me.
in your login file where you start the "$_SESSION[' ']" you just need to add another session called
$_SESSION['uid'] = $row['uid'];
// Row is the MYSQL database row in which the username is located, is not uid for everyone it's whatever you called the MYSQL row where usernames are located, and you could also use a number if you want. $_SESSION['uid'] is the name of the session, which I do believe you can call whatever you want.
After adding this session, you really only have to add it to your page ( I added to sidebar )
<div id="username"><?php echo $_SESSION['uid']; ?></div>
<div id="rank"><p><i><?php echo $_SESSION['rank']; ?></i></p></div>
// I do believe the <div>'s are not needed, I just added them so I could edit positions and such with CSS.
Then you might see it disappearing, which is actually good in this case, because when I first did it I starting trying to edit everything, which is something I realised I didn't have to do. After editing everything, I thought I'd just relog, so that I could see if the login & registration was still working, which was working just fine, and when I logged in, as that started a new session with the new $_SESSION[' '] that I added to the login page, and it was working fine.
I already have a login form, a session started, but no idea how to make username & rank appear, tried searching for a while, but can't find something that actually works..
So I was wondering if anyone here could help me..
Have a nice day
*Thread can be closed, I figured this out.
SOLUTION
So the solution was much more simple than I though, atleast for me.
in your login file where you start the "$_SESSION[' ']" you just need to add another session called
$_SESSION['uid'] = $row['uid'];
// Row is the MYSQL database row in which the username is located, is not uid for everyone it's whatever you called the MYSQL row where usernames are located, and you could also use a number if you want. $_SESSION['uid'] is the name of the session, which I do believe you can call whatever you want.
After adding this session, you really only have to add it to your page ( I added to sidebar )
<div id="username"><?php echo $_SESSION['uid']; ?></div>
<div id="rank"><p><i><?php echo $_SESSION['rank']; ?></i></p></div>
// I do believe the <div>'s are not needed, I just added them so I could edit positions and such with CSS.
Then you might see it disappearing, which is actually good in this case, because when I first did it I starting trying to edit everything, which is something I realised I didn't have to do. After editing everything, I thought I'd just relog, so that I could see if the login & registration was still working, which was working just fine, and when I logged in, as that started a new session with the new $_SESSION[' '] that I added to the login page, and it was working fine.
Last edited: