LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-18-2010, 09:37 AM   #1
resetreset
Senior Member
 
Registered: Mar 2008
Location: Cyberspace
Distribution: Dynebolic, Ubuntu 10.10
Posts: 1,340

Rep: Reputation: 62
Transmitting data across webpages (HTML and PHP question)


Hi,
For a page I'm making, there'll be a "make a friend" link, upon clicking which, the user will be taken to a login page, so that they can authenticate themselves (i.e. WHO wants to make a friend). I want the link to be processed by a "makefriendlogin.php" script which will have "person" as an argument, ie. makefriendlogin.php?person=26 (the number comes from a database, don't worry about it). My question is, how do I write the makefriendlogin.php script, so that the "author" argument will be available to the "makefriend.php" script that'll actually do the authenticating for the user when they enter their name and password?

I thought of something like this:

makefriendlogin.php:
<form method="post" action="makefriend.php">
<input name="username" type="text">
<input name="password" type="password">
<?php
$author=$_POST['author'] ;
<input name="author" type="hidden" value="$author">
?>
<input type="submit" value="submit">
</form>

But I'm getting confused about it all. Am I doing it correct?


Thanks.
 
Old 09-19-2010, 03:24 AM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
You can use PHP session variables for this.

http://www.php.net/manual/en/book.session.php
 
Old 09-19-2010, 04:42 AM   #3
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
Haven't we seen this question before?

http://www.linuxquestions.org/questi...-forms-826771/
 
Old 09-19-2010, 12:42 PM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
The concept works like this: a single token is placed into a cookie or hidden field of all pages in the application. The (unique) value of the token is an index/key to the full complement of session-specific data, and is use on the server as a way to locate all of the session-specific data on the server (in, for instance, a relational database).
The method of encoding the session key is implementation-specific. PHP Sessions is an example of such use of data persistence. You are free to contrive your own methods.

What part of the picture is still missing?

--- rod.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML form data in PHP without postback? linuxlover.chaitanya Programming 18 02-11-2010 11:10 PM
Optical interconnects for transmitting data within the PC jibey.jacob General 2 07-04-2009 01:05 PM
HTML, PHP, forms, submitting data Problem Silent1 Programming 3 08-31-2004 03:03 PM
transmitting data to a PC Stephanie General 3 04-05-2002 03:29 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration