Solved

how can i pass variable on a link ?

Posted on 2003-10-27
7
204 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Display Calender only  When events is scheduled in Worpdress? 1 23
curl SSL certificate unable to get local issuer certificate 15 63
hosting images 4 27
comma true 6 31
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…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to count occurrences of each item in an array.
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.

816 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

12 Experts available now in Live!

Get 1:1 Help Now