Forgot Password / Register
Site Statistics
Total Members: 509
Total Tutorials: 242
Newsest User: Lestop
Todays Unique Hits: 161
0 Users 4 Guests Online

Neaten Up PHP User Systems

Alright. ive deciced that im sick of $logged[this.] everywere. so ive done some coding, and made a few files.
[that you will need to add to] to make your life alot easier.
So right now we are going to make a file that changes $logged[username] into $name. there will only be one file that will contain a large list

Call This File simplify.php
simplify.php Copy to clipboard
1
2
3
4
5
6
7
8
9
10
11
<?php
include_once("connect.php"); // this isnt needed. but you may feel free to remove it.
 
$name = $logged[username] //instead of typing $logged[username] you may now time $name
$email = $logged[email] //instead of $logged[email] its $email
$location = $logged[location] //i think you get it now
$userlevel = $logged[userlevel]//you can add code witch i will explain in part 2. that can make it say Different things.
$age = $logged[age]
$sex = $logged[sex]
 
?>


You can do heaps with this. run sql querys by adding
1
$query = MYSQL_QUERY("SELECT * FROM `members` WHERE `id` = '$_SESSION[id]' AND `password` = '$_SESSION[password]'"); 


It makes it alot easier for when you want to change and update things.

Finally. inculde this into the pages you want to make the changes into

1
2
3
<?php
include("simplify.php");
?>


Any Questions Ask Me :)
Liquidsteel
Views:
1931
Rating:
Posted on Tuesday 10th June 2008 at 12:04 PM
ilyas-shezad
ilyas-shezad
Yeh it is pretty simple... maybe too simple >:(
Posted on Saturday 19th January 2008 at 11:14 PM
Thomas
Thomas
Why would this be advanced, it's pretty simple. =]
Posted on Thursday 15th November 2007 at 09:09 PM
Liquidsteel
Liquidsteel
Im pretty sure it can :P
Posted on Thursday 15th November 2007 at 03:07 PM
awo
awo
And the code can be use to SQL-injections.

If i have dont have wrong....

have i right???
Posted on Wednesday 14th November 2007 at 08:14 PM
ShadowMage
ShadowMage
if your register_globals is set to on, then you could also set a global variable then you can use it where ever.