Go Back   Novahq.net Forum > Computers > Web design and Programming
FAQ Community Calendar Today's Posts Search

Web design and Programming Discuss website creation and other programming topics.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-01-2005, 11:00 AM
spinal is offline spinal
[Insert Title]

Join Date: Jul 2003
Posts: 451

php?id=

hi,

I was woundering if someone with php knowledge could help me out here, I want to do these php?id= codes, but I dont know what i would do to get these to work?
__________________


Gaming Rig

AMD 64 3200+ venice skt 939
Akasa ak-913 Evo 33
Abit an8 fatal1ty nforce 4 ulutra
OCZ 1gb pc3200 dual channel Platinum
Ledtek geforce 6800ultra 256mb ddr3
Seagate barracuda 160gb
Plextor px-716a
on-board 5.1 sound
Logitech X-530 surround sound
Reply With Quote
  #2  
Old 03-01-2005, 12:13 PM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,933

What do you want to use them for? Just for looks or to actually do something?
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #3  
Old 03-01-2005, 12:56 PM
spinal is offline spinal
[Insert Title]

Join Date: Jul 2003
Posts: 451

re:

Quote:
Originally posted by Panther
What do you want to use them for? Just for looks or to actually do something?
i want to make them work, like these two sites..

www.imusion.net
and
http://www.christie.shadowedvisions.....php?page=home
__________________


Gaming Rig

AMD 64 3200+ venice skt 939
Akasa ak-913 Evo 33
Abit an8 fatal1ty nforce 4 ulutra
OCZ 1gb pc3200 dual channel Platinum
Ledtek geforce 6800ultra 256mb ddr3
Seagate barracuda 160gb
Plextor px-716a
on-board 5.1 sound
Logitech X-530 surround sound
Reply With Quote
  #4  
Old 03-01-2005, 03:59 PM
JonM is offline JonM
Registered User

Join Date: Jun 2004
Posts: 2,156

well there's a few ways...if u know php this will be easier lol...


1-

<?
if($page=="page1"){
do actions here
}
elseif($page=="page2")
{
do actions here
}
else
{
do actions here
}
?>

2-

<?
switch($page)
{
case page1
yourfunctionor stuff here
break;
case page2
yourfunction or stuff here
break;
case page3
yourfunction or stuff here
break;
}
?>

then put in your link index.php?page=page1 or whatever, and it doesn't have to be index.php , it could be pages.php or whatver ,
Reply With Quote
  #5  
Old 03-01-2005, 04:03 PM
Trojan is offline Trojan
honest toil

Join Date: Feb 2005
Posts: 4,792

Send a message via ICQ to Trojan Send a message via AIM to Trojan Send a message via Yahoo to Trojan
yuck, lol. Is that Greek? lmao
__________________
••• USMCPI SCCLNCCGNCMCMWTC •••

••• 26th MEUSOC 940311 93-95MySpace •••
Reply With Quote
  #6  
Old 03-01-2005, 04:05 PM
DevilDog#1 is offline DevilDog#1

Join Date: Jul 2002
Posts: 7,040

Na, just programming lingo, If else do & Switch and Case conditions.
__________________








Quote:
If I don't do that doesn't mean I can't - DD#1
Reply With Quote
  #7  
Old 03-01-2005, 04:06 PM
Trojan is offline Trojan
honest toil

Join Date: Feb 2005
Posts: 4,792

Send a message via ICQ to Trojan Send a message via AIM to Trojan Send a message via Yahoo to Trojan
haha, I know what it is. I'm learing it also. It makes me feel dumb though.
__________________
••• USMCPI SCCLNCCGNCMCMWTC •••

••• 26th MEUSOC 940311 93-95MySpace •••
Reply With Quote
  #8  
Old 03-01-2005, 04:08 PM
NaughtyPerry is offline NaughtyPerry
Banned

Join Date: Sep 2004
Posts: 1,665

erm something like <?php include ("$id.php"); ?>

Where u want the content to go, put <?php include ("$id.php"); ?>

Then all pages you want ie id?=home etc are called name.php and are in same folder as the index page....
Reply With Quote
  #9  
Old 03-01-2005, 04:17 PM
DevilDog#1 is offline DevilDog#1

Join Date: Jul 2002
Posts: 7,040

Quote:
Originally posted by troj
haha, I know what it is. I'm learing it also. It makes me feel dumb though.
QA guy here. Better write working code. I back to the drawing board buddy.
__________________








Quote:
If I don't do that doesn't mean I can't - DD#1
Reply With Quote
  #10  
Old 03-01-2005, 04:27 PM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,933

Except you guys are leaving out one major thing.

SECURITY.

include("$id.php"); if VERY bad..... think about it

index.php?id=http://somesite.com/badfile

will include http://somesite.com/badfile.php.

security checks are a must when including files from the address bar...

If(file_exists("/path/$id.php")) {
include("/path/$id.php");
}

is not nessarely ok either (tested myself) because now it's

index.php?id=http://somesite.com/../../../somefile_that_ends_in_php_from_another_domain_on_t he_server

so what do you do?
<?

If(!eregi("^[-?_?a-z0-9]+$",$id)) { // Will only allow alpha numeric chars with - or _'s in the name.
exit("Bad include file");
} Elseif(file_exists("/path/$id.php")) {
include("/path/$id.php");
} Else {
Exit("Bad include file");
}
?>
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #11  
Old 03-01-2005, 04:27 PM
Trojan is offline Trojan
honest toil

Join Date: Feb 2005
Posts: 4,792

Send a message via ICQ to Trojan Send a message via AIM to Trojan Send a message via Yahoo to Trojan
cool man
__________________
••• USMCPI SCCLNCCGNCMCMWTC •••

••• 26th MEUSOC 940311 93-95MySpace •••
Reply With Quote
  #12  
Old 03-01-2005, 04:55 PM
JonM is offline JonM
Registered User

Join Date: Jun 2004
Posts: 2,156

panther do u do includes, or have all the codin in index.php?
Reply With Quote
  #13  
Old 03-01-2005, 05:17 PM
spinal is offline spinal
[Insert Title]

Join Date: Jul 2003
Posts: 451

re:

you what now?

ok, which code should I use? Im new to php, but i can work my way around php.
__________________


Gaming Rig

AMD 64 3200+ venice skt 939
Akasa ak-913 Evo 33
Abit an8 fatal1ty nforce 4 ulutra
OCZ 1gb pc3200 dual channel Platinum
Ledtek geforce 6800ultra 256mb ddr3
Seagate barracuda 160gb
Plextor px-716a
on-board 5.1 sound
Logitech X-530 surround sound
Reply With Quote
  #14  
Old 03-01-2005, 07:44 PM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,933

Elite: Yes I use includes, 1 included file for every section on this site.


xusion:
If(!eregi("^[-?_?a-z0-9]+$",$id)) { // Will only allow alpha numeric chars with - or _'s in the name.
exit("Bad include file");
} Elseif(file_exists("/path/$id.php")) {
include("/path/$id.php");
} Else {
Exit("Bad include file");
}
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #15  
Old 06-20-2005, 02:14 AM
NaughtyPerry is offline NaughtyPerry
Banned

Join Date: Sep 2004
Posts: 1,665

panther, sorry to bother you... i tried that... and it doesnt work??

i put this in main index bit and i cant get it to work at all...


If(!eregi("^[-?_?a-z0-9]+$",$id)) { // Will only allow alpha numeric chars with - or _'s in the name.
exit("Bad include file");
} Elseif(file_exists("/path/$id.php")) {
include("/path/$id.php");
} Else {
Exit("Bad include file");
}


www.erazor-studios.net/a51/

any ideas??
Reply With Quote
  #16  
Old 06-20-2005, 04:27 PM
IcIshoot is offline IcIshoot

Join Date: Mar 2004
Location: Farmington Hills, MI
Posts: 1,473

Send a message via AIM to IcIshoot Send a message via MSN to IcIshoot Send a message via Yahoo to IcIshoot
put $id = $_GET['id']; at the beggining of the script.

There is a an other way to get the submitted date using the extract function, you can read up on that here:

http://us2.php.net/manual/en/function.extract.php

Also, in the script by panther, you need to replace the /path with your info. If the $id.php file is in the same folder as the script, you can just take out /path/.

IcI


ps, note to others... examples should probably assume that register_globals is off, and that the person asking may not know how to retrieve the data passed to the script. Just a thought
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
page.php?id=blablabla NaughtyPerry Web design and Programming 3 12-22-2005 06:05 PM
request id done Jason Sigs and Graphics 6 04-27-2005 08:24 PM
Links to ID's XinG phphq.Net Forums 7 12-26-2004 11:16 AM
Things id like to see......... .DareDevil. Delta Force 11 05-20-2004 03:53 PM


All times are GMT -5. The time now is 01:09 PM.




Powered by vBulletin®