Solved

how can i pass variable on a link ?

Posted on 2003-10-27
7
194 Views
Last Modified: 2006-11-17
hi,
i have one links, from that user can access one of secure page...
but i want to check first, if user is already logged in, then only he can access page otherwise, he directly go to login.php from that links.
0
Comment
Question by:kets4u
7 Comments
 
LVL 2

Accepted Solution

by:
errows earned 30 total points
ID: 9626979
Then you should use sessions instead of variables on a link.

See http://www.zend.com/zend/tut/session.php for a session tutorial

or http://www.zend.com/zend/tut/tutorial-delin4.php for an authentication tutorial with cookies... as you wish !
0
 
LVL 7

Expert Comment

by:kohashi
ID: 9632343
link:
<a href="file.php?var1=data1&var2=data2&var3=data3">link stuff</a>

data retrieval:
$var1=$_GET["var1"];
$var2=$_GET["var2"];
$var3=$_GET["var3"];


You can add as many as you like, just keep adding a & sign in the link with 'variable name' = 'data'.

To retrieve it, you just use the $_GET environmental variable.

You can then work with those variables however you like... compare them against a database or something hard coded into the PHP file to authenticate.

hope that helps,
-kohashi
0
 
LVL 1

Expert Comment

by:lamdor
ID: 9632369
Hi kohashi,

 I think we can't pass with URL more than 256K of data..
' don't say as many as he wants'..

 The above one works fine..

with regards
lam.
0
 
LVL 2

Expert Comment

by:TaintedGod
ID: 9654298
I dont know about you but, its pretty hard to make a url with 256k worth of data, by hard i mean, you would never end up storing that much in an address bar.

But i think sessions is a better idea if you are worried about security.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now