Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 10th, 2005, 7:35 PM   #1
crypter
Newbie
 
crypter's Avatar
 
Join Date: Jul 2004
Posts: 29
Rep Power: 0 crypter is on a distinguished road
Help with php

Hi guys! i am making this website and i was wondering how do u get to make links like these:
tutorial.php?id=c#

i dont understand how to get these and ive searched the net, probably i dont exactly know what im looking for.
Basically what i want to know is how to do this and what i need to do this...
And would it be possible to have download.php
and when this link is clicked:
download.php?id=C#tut
it customizes for that specific file....

n e ways hope you can help!

Crypter
__________________
.::SharPCreativitY.CoM::.
Come and visit the progress now!

Crypto Project Needs Your Help! Click HERE for more info!

- Version 0.2 | 95% Complete | <-- Getting more & more stable as the days go bye!
- Version 0.3 | 50% Complete | <-- Help is on its way!
- Version 0.5 | 25% Complete | <-- Really coming along nice ;) (will not work with win2000 & lower :()

No i am not Crazy... I have my reasons for doing this. LOL
crypter is offline   Reply With Quote
Old Apr 10th, 2005, 8:28 PM   #2
crypter
Newbie
 
crypter's Avatar
 
Join Date: Jul 2004
Posts: 29
Rep Power: 0 crypter is on a distinguished road
ok well you guys might think im crazy but i found out what i wanted to know
basically i got a page called
download.php
now i add this code to make this cuztomizable in the future
<?php include ("content.php"); ?>

in content.php i put this code
<?
$id = $_GET['id'];
echo $id;
?>

so now i want to have some text displayed in download.php

si i have a link on my index page towards .../download.php?id=c# tutorial

I click on the link and the page will display
c# tutorial

Do i have this right?
And btw.. would there be a way for ppl not to write wtv they want!? because if you know the link you can replace c# tutorial with wtv you want and it will be displayed
__________________
.::SharPCreativitY.CoM::.
Come and visit the progress now!

Crypto Project Needs Your Help! Click HERE for more info!

- Version 0.2 | 95% Complete | <-- Getting more & more stable as the days go bye!
- Version 0.3 | 50% Complete | <-- Help is on its way!
- Version 0.5 | 25% Complete | <-- Really coming along nice ;) (will not work with win2000 & lower :()

No i am not Crazy... I have my reasons for doing this. LOL
crypter is offline   Reply With Quote
Old Apr 11th, 2005, 8:53 AM   #3
codetaino
Programmer
 
codetaino's Avatar
 
Join Date: Jan 2005
Location: Bayamon, Puerto Rico
Posts: 71
Rep Power: 4 codetaino is on a distinguished road
ok... you can used what you have found but there are other safer ways... and if you want to use an id... well you need to have somewhare in a Database or in an file or hardcoded in the page that select the file... with a list of id and its respective link

are you using some database in your web site? do you have accesss to write on your server?

-codetaino
__________________
"God bless u all" :)

Last edited by codetaino; Apr 11th, 2005 at 9:07 AM.
codetaino is offline   Reply With Quote
Old May 4th, 2005, 3:12 PM   #4
studioSlac
Newbie
 
Join Date: May 2005
Posts: 3
Rep Power: 0 studioSlac is on a distinguished road
$_GET['id'] is not useful primarily for displaying text that is in the location bar for the reason you just mentioned (anyone can write whatever they please in the URL). It's mostly useful for changing part of the page while having the rest remain unchanged.

For instance, say you've made a page with lots of awesome code but you want a picture in it to change depending on what's in the URL.

//Lots of code you don't want affected comes before this
<?
$id = $_GET['id'];
echo "<img src=\"images/" . $id . ".jpg\" alt=\"" . $id . "\" />";
?>
//More code you don't want affected comes after this

If the php file is named "index.php," and the above code is in it, then a url containing "index.php?id=12" will display the page with the picture "12.jpg" where you specificed.

This is a php forum, so we could just take the url from this very page:
This document "showthread.php" is displaying everything unchanged except for what was designated as "t" (which stands for thread) with the value 3265. Change the value to 3264 and you'll get the same page, with the same headers and formats and everything, except it will display information pertaining to Dameon's greating thread instead of this one.

I hope I was some help.

Last edited by studioSlac; May 4th, 2005 at 3:24 PM. Reason: took out the word "constant," which may have been interpreted differently
studioSlac is offline   Reply With Quote
Old May 4th, 2005, 3:48 PM   #5
nisim777
Newbie
 
Join Date: May 2005
Posts: 17
Rep Power: 0 nisim777 is on a distinguished road
I'm sure there is a proper use for it and that is why I ask, what is the appeal of $_GET? I'm still a newbie and so far all I've heard is that people think it's cool to have the URL look like that.
nisim777 is offline   Reply With Quote
Old May 6th, 2005, 2:00 PM   #6
studioSlac
Newbie
 
Join Date: May 2005
Posts: 3
Rep Power: 0 studioSlac is on a distinguished road
If you can't see the appeal after reading my post, I must've done a very bad job of explaining it. Sorry, I guess I'm still a newbie too.
__________________
http://slac.uni.cc/ - formal beta release
studioSlac is offline   Reply With Quote
Old May 6th, 2005, 6:33 PM   #7
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Basically, it's a way of transparently passing variables to a PHP script, so the user can see what's happening, and, more importantly, can bookmark it.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old May 7th, 2005, 3:11 PM   #8
LOI Kratong
Professional Programmer
 
Join Date: May 2005
Location: Woo - Boot Sector!
Posts: 294
Rep Power: 4 LOI Kratong is on a distinguished road
However it allows room for all sorts of hacks... I think i've got this right, some bozo could create hist own php file, telling the server to execute some commands, ie he could have full control over your linux server just by you having that in your url...

that's what i remember reading anyhoo
__________________
www.heldtogether.co.uk
LOI Kratong is offline   Reply With Quote
Old May 7th, 2005, 8:33 PM   #9
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Erm... no. He'd have to get the PHP file on your server first.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old May 8th, 2005, 6:13 AM   #10
LOI Kratong
Professional Programmer
 
Join Date: May 2005
Location: Woo - Boot Sector!
Posts: 294
Rep Power: 4 LOI Kratong is on a distinguished road
I swear that i read as long as the file is hosted you could type in the file name, for example:
[PHP]tutorial.php?id=www.myhoster.com/myphphack.php[/PHP]

Maybe it was with some other crazy php extension though
__________________
www.heldtogether.co.uk
LOI Kratong is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

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

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:58 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC