Jump to content

Superglobal variables question


bluedot

Recommended Posts

Hi,

I have a pretty simple member login, if the entered password and username are in the database it takes the user to a very simple control panal where they can edit things on the site.
I have a table in a database that has the usernames, passwords, first names, last names, and emails in it.

All I want is the name that corrasponds with the entered username to be displayed in the simple control panel.
I know a very round about way of doing it with hidden fields in an HTML form but i'd like to do it with superglobals, but i can't find a tutorial that i can understand.
I would greatly appriciate if somebody would break superglobals down to laymen terms and show me how to do this. Thanks!
Link to comment
https://forums.phpfreaks.com/topic/30595-superglobal-variables-question/
Share on other sites

How are you [i]loging in[/i] users? I meen, have you anything setup to stop me (if I knew the address of this [i]admin[/i] page) going directly to it?

You need to find a tutorial on a [i]php login system[/i]. Google should have MANY such tutorials.

Most login systems use the $_SESSION super global array to maintain a users identity.
If the password and username they entered are in the database then this is executed:
[code]setcookie("loggedin", "TRUE", time()+(3600 * 24));
setcookie("mysite_username", "$username");[/code]

then on each page that i want restricted i have:
[code]if (!isset($_COOKIE['loggedin'])) die("You are not logged in!");
$mysite_username = $HTTP_COOKIE_VARS["mysite_username"];[/code]

I tried google.. but people always make their programs so big and explain so little of it that i get lost. I just need the most simplistic breakdown of how superglobals work..

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.