![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jul 2004
Posts: 29
Rep Power: 0
![]() |
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 |
|
|
|
|
|
#2 |
|
Newbie
Join Date: Jul 2004
Posts: 29
Rep Power: 0
![]() |
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 |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Jan 2005
Location: Bayamon, Puerto Rico
Posts: 71
Rep Power: 4
![]() |
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. |
|
|
|
|
|
#4 |
|
Newbie
Join Date: May 2005
Posts: 3
Rep Power: 0
![]() |
$_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 |
|
|
|
|
|
#5 |
|
Newbie
Join Date: May 2005
Posts: 17
Rep Power: 0
![]() |
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.
|
|
|
|
|
|
#6 |
|
Newbie
Join Date: May 2005
Posts: 3
Rep Power: 0
![]() |
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 |
|
|
|
|
|
#7 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
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.
|
|
|
|
|
|
#8 |
|
Professional Programmer
Join Date: May 2005
Location: Woo - Boot Sector!
Posts: 294
Rep Power: 4
![]() |
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 |
|
|
|
|
|
#9 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Erm... no. He'd have to get the PHP file on your server first.
|
|
|
|
|
|
#10 |
|
Professional Programmer
Join Date: May 2005
Location: Woo - Boot Sector!
Posts: 294
Rep Power: 4
![]() |
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 |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|