Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-05-2012, 02:40 AM   PM User | #1
Dan13071992
Regular Coder

 
Join Date: Dec 2010
Location: Kent, UK
Posts: 573
Thanks: 23
Thanked 10 Times in 10 Posts
Dan13071992 is an unknown quantity at this point
is it possible to hide $_GET['']; from URL

just as the title asks, is it possible to hide the $_GET['']; from the url, for example:

instead of:

Code:
 http://test.com/index.php?page=title
is it possible to make it just show index.php?
__________________
http://360-tactics.co.uk/forum/index.php

Crime-Wave

please post your code wrapped in tags
please post your PHP wrapped in tags
Dan13071992 is offline   Reply With Quote
Old 01-05-2012, 02:46 AM   PM User | #2
Spookster
Supreme Overlord


 
Spookster's Avatar
 
Join Date: May 2002
Location: Marion, IA USA
Posts: 6,220
Thanks: 4
Thanked 80 Times in 79 Posts
Spookster will become famous soon enough
Assuming this is coming from a form then yes use $_POST otherwise use sessions to pass the parameters.
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!
Spookster is offline   Reply With Quote
Old 01-05-2012, 02:48 AM   PM User | #3
Dan13071992
Regular Coder

 
Join Date: Dec 2010
Location: Kent, UK
Posts: 573
Thanks: 23
Thanked 10 Times in 10 Posts
Dan13071992 is an unknown quantity at this point
no its not coming from a form, im using this:

PHP Code:
<?php } if ($crew != "0" && $playercrew->owner == $fetch->username) {



if (empty(
$_GET)) {
include(
'crewmembers.php');

}

if (isset(
$_GET['page'])) {

    
 
   switch (
$_GET['page']) {
 
      case 
'members':
         include(
'crewmembers.php');
         break;
      case 
'hq':
         include(
'crewhq.php');
         break;
      case 
'apps':
         include(
'crewapps.php');
         break;
      case 
'info':
         include(
'crewinfo.php');
         break;
      case 
'alt':
         include(
'crewalt.php');
         break;
      case 
'donate':
         include(
'crewdonate.php');
         break;
         case 
'':
         include(
'crewblank.php');
         break;
   }
 
}
}
?>
i was just wondering if it would work without showing the ?page=*
__________________
http://360-tactics.co.uk/forum/index.php

Crime-Wave

please post your code wrapped in tags
please post your PHP wrapped in tags
Dan13071992 is offline   Reply With Quote
Old 01-05-2012, 03:03 AM   PM User | #4
Spookster
Supreme Overlord


 
Spookster's Avatar
 
Join Date: May 2002
Location: Marion, IA USA
Posts: 6,220
Thanks: 4
Thanked 80 Times in 79 Posts
Spookster will become famous soon enough
If you are going to use $_GET then the parameter has to exist in the URL otherwise there is nothing to "get". Your only option would be to write that parameter to a session where that parameter is being set at and then read it from the session when you need to use it.
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!
Spookster is offline   Reply With Quote
Old 01-05-2012, 04:15 AM   PM User | #5
Microsuck
Regular Coder

 
Microsuck's Avatar
 
Join Date: Oct 2011
Location: 127.0.0.1
Posts: 123
Thanks: 44
Thanked 5 Times in 5 Posts
Microsuck is an unknown quantity at this point
Spook, do you think something could be done to the GET URLS with mod_rewrite?
__________________
PHP Code:
<?php echo "Microsuck says hi!"?>
Microsuck is offline   Reply With Quote
Old 01-05-2012, 08:36 AM   PM User | #6
devinmaking
Regular Coder

 
Join Date: Oct 2011
Posts: 236
Thanks: 11
Thanked 5 Times in 5 Posts
devinmaking has a little shameless behaviour in the past
Quote:
Originally Posted by Microsuck View Post
Spook, do you think something could be done to the GET URLS with mod_rewrite?
you can change the names with htaccess and them call then in like this.

htaccess code:

Code:
RewriteRule ^pagename/pageoption/?$ pagename/.php?pageoption=whatever [L]
or if its variable based:
([A-Za-z0-9-]+)
Code:
RewriteRule ^pagename/([A-Za-z0-9-]+)/?$ pagename/.php?pageoption=$1 [L]
PHP Code:
if(isset($_REQUEST["result"]) && $_REQUEST["result"] == "whatever"){

//do something


devinmaking is offline   Reply With Quote
Old 01-05-2012, 01:31 PM   PM User | #7
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,497
Thanks: 44
Thanked 439 Times in 428 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
Using mod re-write however does kind of presume that you know all the url variations etc.

The only other thing you could do is use some complex javascript and convert your links to actually submit a hidden form instead.

That could be a lot of work for you though.
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Old 01-06-2012, 12:12 AM   PM User | #8
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Quote:
Originally Posted by devinmaking View Post
you can change the names with htaccess and them call then in like this.

htaccess code:

Code:
RewriteRule ^pagename/pageoption/?$ pagename/.php?pageoption=whatever [L]
or if its variable based:
([A-Za-z0-9-]+)
Code:
RewriteRule ^pagename/([A-Za-z0-9-]+)/?$ pagename/.php?pageoption=$1 [L]
PHP Code:
if(isset($_REQUEST["result"]) && $_REQUEST["result"] == "whatever"){

//do something


This doesn't answer the question; this takes a 'friendly' display and maps it to the appropriate query string. In either case, the same data is available in the url.
So to answer the OP, no you can't since that is illogical. As spooks mentioned, if you need to look something up provided by a user, they have to provide it to you either explicitly with a post or get, or implicitly with other decisions creating a session or cookie.
There is also no way to alter the viewed url; browsers are controlled by the client, not the server.
Fou-Lu is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:29 PM.


Advertisement
Log in to turn off these ads.