By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,890 Members | 1,050 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,890 IT Pros & Developers. It's quick & easy.

Passing Variable In Php pages

chelvan
P: 90
i've the code to check the log in.
the login form is login.php
i checked the user @ index.php, i read the login .php page variable here.
its right,,,,
then on index.php i called the page home.php by using include('home.php'); its occurs when the user is right person. on this home.php i need the login.php page variable ie $un;

how i do that.


regards
chel-1
Sep 2 '08 #1
Share this Question
Share on Google+
10 Replies


Dormilich
Expert Mod 5K+
P: 8,639
Maybe you want to go for a session?
Sep 2 '08 #2

chelvan
P: 90
Maybe you want to go for a session?
no. is any way out of that?

thanks

regards
chel-1
Sep 2 '08 #3

Markus
Expert 5K+
P: 6,050
no. is any way out of that?

thanks

regards
chel-1
What is wrong with using sessions?
Sep 2 '08 #4

chelvan
P: 90
What is wrong with using sessions?
i knew that the session is good for that.
but i'm searching other options

thanks
chel-1
Sep 5 '08 #5

100+
P: 190
Other wise u use hidden values or cookie
Sep 5 '08 #6

100+
P: 190
else you can write these values into files (like txt ) and read the values from these files when you need this......
Sep 5 '08 #7

Markus
Expert 5K+
P: 6,050
You could also use a database, althought that might be a bit extreme. Sessions is the best way to accomplish this.
Sep 5 '08 #8

100+
P: 258
Hi
This job can be done in many ways BUT the fastest and most secure way is to store a session on the server.

Other options:
1- Putting user information in a file. This way will overload the server and crash the systems if you have many users AND the other thing as that for doing this you have to have some information sent by user on each page just like a SESSION ID. It could be a cookie or a hidden object on each page . (This way is not recommended at all)

2- putting users information on a database. This way is faster than the first one but you still need to get an ID from user on each page to identify him/her. or you can save their IP address on the same database. What's wrong with this method? The first problem is that you have to send and recieve data from your database on each page. And the other problem is that some internet providers change the users IP on each page they view. That means your data will be lost and users will need to log in on each page. (This way is not recommended)

3- The 3rd way I can think of is to sore a Cookie on the users machine. This way is actualy faster than SESSION because the variables will be stored on the users computer not our server. But the problem is that people are able to easily change cookies. So lets use them for other things like (page language) , (users custom background color) , etc

4- The last and the worst way I can think of is to send users information with URL. NOT SECURE AT ALL. Because even if you encrypt the data anyone can copy the URL and login with your name. (DONT EVEN THINK ABOUT IT)


Why do we have to use session?
1- Because login informations are stored on the server and user can NOT reach them.
2- They are deleted after a period of not using them.
3- It's faster than most of other ways.
Sep 5 '08 #9

chelvan
P: 90
so sorry 4 my late...!
then finally i go with session,


thanks to you all
chel-1
Nov 4 '08 #10

Markus
Expert 5K+
P: 6,050
so sorry 4 my late...!
then finally i go with session,


thanks to you all
chel-1
Glad we could help.

Mark.
Nov 4 '08 #11

Post your reply

Sign in to post your reply or Sign up for a free account.