Jump to content

[SOLVED] link to table


asmith

Recommended Posts

till today i was always working with POST  ,

think it's time to take a bite of GET ! :)

 

I would create links like

 

table.php?table=tablename

 

these addresses i always see on sites address bar,

i don't know how they works, anywhere to start with ? 

 

Link to comment
Share on other sites

GET is the same as POST. Except GET is seen as its carried in the address bar. If a file name is followed by a question mark then anything after that is considered as a query string. A query string holds a collection of variables. A variable is set in the following format:

file.php?var1=value1

So in the above example a variable is being set (var1) with a value (value1). To have more than one variable you'll separate them with an ampersand (&) eg:

file.php?var1=value1&var2=value2

In order to get the variables from the query string in file.php you'd use $_GET. So to get var1 you'd use $_GET['var1'], for var2 you'd use $_GET['var2']

 

So if you ran the following script with the following url:

file.php?var1=value1&var2=value2

<?php

echo $_GET['var1'] . '<br />';
echo $_GET['var2']';

?>

 

You should get the following out put:

value1

value2

 

There are few precautions to make when handling GET data. As it is seen within the browser it can be easily changed by the user so it is important to validate any data coming in form GET, so if a variable is only supposed to contain a number use is_numeric to check to see if that variable is actually a number. Second of all do not pass sensitive information in the url such as passwords as any one within the view of seeing the browser will be able to read the contents of the address bar.

Link to comment
Share on other sites

 

http://www.phpfreaks.com/tutorials/34/0.php

 

 

it has said about changing the type of a php file to another , so it would make a "hacker"  wrong or confused....

 

following the above, if i use for example .ttt for my pages,

then  a hacker see    file.ttt?val=aaa

couldn't he by that "Get style" line find out the the page has written in php  ?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.