Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

how can i pass variable on a link ?

Posted on 2003-10-27
7
Medium Priority
?
232 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 2

Accepted Solution

by:
errows earned 120 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

705 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