php hiding queries in address bar

Far

tsniffer
Staff member
Developer
May 19, 2003
20,184
30
2,788
540
at the moment my site displays test.php?id=2&page=4 etc

how do i make it so it only ever shows test.php and nothing else (so ppl cant just change the id and jump to a different page)

i know theres a name for it, but i cant remember what its called.
 

Far

tsniffer
Staff member
Developer
May 19, 2003
20,184
30
2,788
540
i dont use forms for linking, i use this

<?php echo "<A href='test.php?id=$getid3[id]'>$getid3[idname] </a>"
?>

im gonna do some research on .htaccess now i know that where its done.
 

Kaori

LOMCN MiR3 Queen!
VIP
Jun 3, 2004
3,584
38
285
Canada
i dont use forms for linking, i use this

<?php echo "<A href='test.php?id=$getid3[id]'>$getid3[idname] </a>"
?>

im gonna do some research on .htaccess now i know that where its done.

.htaccess can't guess your ID if you are not passing it over.
still think you need a form somewhere... and then use onclick instead.
 

KnightRider

Dedicated Member
Dedicated Member
Oct 30, 2003
107
1
65
.htaccess can't guess your ID if you are not passing it over.
still think you need a form somewhere... and then use onclick instead.

taken from http://corz.org/serv/tricks/htaccess2.php

inside .htaccess
Code:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^files/([^/]+)/([^/]+).zip /download.php?section=$1&file=$2 [NC]

would allow you to present this link as..

http://mysite/files/games/hoopy.zip

and in the background have that transparently translated, server-side, to..

http://mysite/download.php?section=games&file=hoopy
 

Primal

LOMCN VIP
VIP
Jun 28, 2004
1,756
102
259
kaoris right with using post, use buttons instead of links

PHP:
<?php
if ($_POST['Submit'] == 'TEST')
{
$id = $_POST[id];
$idname = $_POST[idname]
$page = $_POST[page]
//ENTER REST OF CODE HERE
exit;
}
?>

<?php
echo '<form name="form1" method="post" action="test.php" style="padding:5px;">
<input name="idname" type="text" id="idname" value="';
echo $getid3[id];
echo '"><br/>
<input name="id" type="text" id="id" value="';
echo $getid3[idname];
echo '"><br/>
<input name="page" type="text" id="page" value="PAGE NUMBER"><br/>
<input type="submit" name="Submit" value="TEST"> </form>

?>';

try something like that

that isnt 2 different php pages btw, thats the test.php
 
Last edited:

hellcaster

Golden Oldie
Golden Oldie
Mar 24, 2005
903
0
123
Yeah, im doing php atm and i think, im quite sure that post hides it out of the address bar

Kevin