TKW22 Posted March 18, 2009 Share Posted March 18, 2009 ok i think i got this right but not sure.you uses headers to go to a different page.so can you use that to make a url come up like this http://domain.com?t=22 not this http://domain.com/index.php ?and if so how.iv tryed to do it already just cant get it to go. Link to comment Share on other sites More sharing options...
zppblood Posted March 19, 2009 Share Posted March 19, 2009 Just know that when you use headers, it's not going to always be sending a user to a new page, though it might be what you do most of the time. <?php if($_GET['t']!=22) { header('Location: http://domain.com/?t=22'); exit; }?> Link to comment Share on other sites More sharing options...
TKW22 Posted March 19, 2009 Author Share Posted March 19, 2009 Just know that when you use headers, it's not going to always be sending a user to a new page, though it might be what you do most of the time.http://domain.com/?page=22 something like that or switch the url as soon as they go on it Link to comment Share on other sites More sharing options...
ProblemHelpPlease Posted March 19, 2009 Share Posted March 19, 2009 The address http://domain.com/?page=22 is basically sending a user to the main index page of the domain and is passing the varaiable "page" with a value of "22"If you don't want to go to the index page then you can use any address like http://domain.com/anotherpage.php. It doesnt make any difference to the header which address you use as long as it is valid.Their are other options to go to another page but it depends on what page you are coming from and if you need to pass any data between pages. Link to comment Share on other sites More sharing options...
TKW22 Posted March 19, 2009 Author Share Posted March 19, 2009 I'm trying to do this so ppl cant bookmark a page.like a payment page. Link to comment Share on other sites More sharing options...
justsomeguy Posted March 19, 2009 Share Posted March 19, 2009 People can really bookmark any page, you can't really stop that. If you have something that your page is doing then you either need to have a way to detect when to do that or when not to do it, or after it's done you redirect to another page that shows a summary of what happened. Even if they bookmark the summary page it won't re-process anything. Link to comment Share on other sites More sharing options...
ColdEdge Posted March 19, 2009 Share Posted March 19, 2009 Hmm... I agree with @Justsomeguy that you can bookmark any page really and that index.php or any other files named index do now show up, as you can only see the domain http://www.domain.com/ now you can always make direcotrys inside your server and put an index file inside which will only show the URL like this http://www.domain.com/somethingIn any case here is the script... <?phpif($_REQUEST['do'] == "account"){//Do some code here such as echo some source here or do something of that sort}elseif($_REQUEST['do'] == "shop){//Do something else here usinfg source or echo classes and stuff like that}else{//If its neither of those then do something here }?> Now if they go to http://www.domain.com/?do=shop this will trigger the PHP to show the contence of SHOP so basicly you can put full website layout where it says //Do some code here... bla bla bla...If you want the extenction to be different then what I have which is ['do'] just replace that with anything you want like ['act'], ['action'], ['p'], ['page'].... ect...Hope that helps ^^ Link to comment Share on other sites More sharing options...
TKW22 Posted March 20, 2009 Author Share Posted March 20, 2009 Hmm... I agree with @Justsomeguy that you can bookmark any page really and that index.php or any other files named index do now show up, as you can only see the domain http://www.domain.com/ now you can always make direcotrys inside your server and put an index file inside which will only show the URL like this http://www.domain.com/somethingIn any case here is the script...<?phpif($_REQUEST['do'] == "account"){//Do some code here such as echo some source here or do something of that sort}elseif($_REQUEST['do'] == "shop){//Do something else here usinfg source or echo classes and stuff like that}else{//If its neither of those then do something here }?> Now if they go to http://www.domain.com/?do=shop this will trigger the PHP to show the contence of SHOP so basicly you can put full website layout where it says //Do some code here... bla bla bla...If you want the extenction to be different then what I have which is ['do'] just replace that with anything you want like ['act'], ['action'], ['p'], ['page'].... ect...Hope that helps ^^ thanks for the info sorry for wasting you time.I should of looked first. Link to comment Share on other sites More sharing options...
TKW22 Posted March 20, 2009 Author Share Posted March 20, 2009 i have one more ?.can you change this http://somedomain.com/login/index.php to this? http://somedomain.com/?login=1 sorry for double post didn't see i post the last post Link to comment Share on other sites More sharing options...
jlhaslip Posted March 20, 2009 Share Posted March 20, 2009 Check out the Apache Mod-rewrite tutorials found in Google.See also, apachefriends.org Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.