Simple (I think) Code Question

Reply

Join Date: Aug 2003
Posts: 372
Reputation: TheOgre is a jewel in the rough TheOgre is a jewel in the rough TheOgre is a jewel in the rough 
Solved Threads: 6
TheOgre's Avatar
TheOgre TheOgre is offline Offline
Posting Whiz

Simple (I think) Code Question

 
0
  #1
Jul 28th, 2004
Can anyone tell me how I would code links to other pages on my site (using php) whereby the full URL in the address bar looks like this:

http://www.mysite.com/index.php?id=3 (which points to blah.php)

I've done the usual searches on google and such with no luck on how to do it.

Mind you, I'm *not* a coder/webmaster so if you start talking about arrays and such, I'll have no idea what you're talking about :)
If you spend more on coffee than on IT security, you will be hacked.
What's more, you deserve to be hacked.
-- former White House cybersecurity czar Richard Clarke
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 234
Reputation: PoA is an unknown quantity at this point 
Solved Threads: 8
PoA PoA is offline Offline
Posting Whiz in Training

Re: Simple (I think) Code Question

 
0
  #2
Jul 30th, 2004
I assume you want to redirect from http://www.mysite.com/index.php?id=3 to http://www.anothersite.com/blah.php

You can use header() function to do it.

If not, post here again.
Reply With Quote Quick reply to this message  
Join Date: Aug 2003
Posts: 372
Reputation: TheOgre is a jewel in the rough TheOgre is a jewel in the rough TheOgre is a jewel in the rough 
Solved Threads: 6
TheOgre's Avatar
TheOgre TheOgre is offline Offline
Posting Whiz

Re: Simple (I think) Code Question

 
0
  #3
Jul 31st, 2004
No, what I want to do is hide the actual page link, so the URL reads:

http://www.mysite.com/index.php?id=2

instead of:

http://www.mysite.com/iwanttohidethispage.html

No redirection to another domain, just hiding the actual pages from showing up in the location bar of the browser. For an example, please see http://www.cacert.org
If you spend more on coffee than on IT security, you will be hacked.
What's more, you deserve to be hacked.
-- former White House cybersecurity czar Richard Clarke
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 234
Reputation: PoA is an unknown quantity at this point 
Solved Threads: 8
PoA PoA is offline Offline
Posting Whiz in Training

Re: Simple (I think) Code Question

 
0
  #4
Jul 31st, 2004
Well, it's mod_rewrite. You can check out at http://www.mod-rewrite.com/forum/thread10.html
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 9
Reputation: kenleycapps is an unknown quantity at this point 
Solved Threads: 0
kenleycapps's Avatar
kenleycapps kenleycapps is offline Offline
Newbie Poster

Re: Simple (I think) Code Question

 
0
  #5
Aug 4th, 2004
hmm. sounds to me like a simple include, but that's probably inefficient.

[PHP]
<?php

$pages = "/path/to/pages/";
$default = 1;

if(is_file($pages.$_GET['id'].".php")) $p = $_GET['id'];
else $p = $default;

include $pages.$p.".php";
?>
[/PHP]

Just have all your pages as ID numbers.. IE: news page = 3.html

But that's really inefficient, and probably not how you do it =P
Current languages this technical polyglot knows:
PHP

Languages this technical polyglot is working on:
C++
Java
XML
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC