|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
PHP variables ($_GET)
Hi,
I am trying to use a variable in the URL and put it through my MySQL DB to insert, edit, etc. I am told that my web host has REGISTER_GLOBALS OFF so this method wont work and i need to use the following: $_GET[‘pageid’] I've tried everything, i think, and cant get it all to work. Do i need to put that statement in the URL (instead of my $pageid, like ?pageid=$_GET[‘pageid’]) and also in the MySQL query: ie, SELECT * FROM table WHERE pageid='$_GET[‘pageid’]' those, i have tried, but am getting nothing. I'm basically trying to call up an edit form with the specific pageid attached to it (so, i can edit that page). I hope this isnt too vague - i'm a part-timer with PHP! Thanks for any help you can give. Greg |
|
#2
|
|||
|
|||
|
the link should be
PHP Code:
then on mypage.php PHP Code:
Quote:
|
|
#3
|
|||
|
|||
|
Also I wouldn't just let inputs like that be enabled as then they could do pages.php?page=contact ' DROP TABLE pages --
Learn about SQL injections if you are to do things like that. |
|
#4
|
|||
|
|||
|
Quote:
i'm doing all this in an admin area, so would have hoped it would be secure against things like that (or am i wrong?). God knows, i'm losing all faith in my ability! just when i thought i knew enough, i clearly don't! The thing is my client has already paid me for the website, so i need to at least get it functional! anyway, i've tried and tried the above suggestions and i can't get it to work |
|
#5
|
||||
|
||||
|
OK lets start from the beginning what page are you coming from, what variables do you want to pass and what page are you going to. do you have some code you could show us?
__________________
So much to learn.. so little time! |
|
#6
|
|||
|
|||
|
Quote:
a) 'Security' is a relative term; even so, I would never assume that an 'admin area' was secure and use sloppy coding habits. b) So, you're charging people and you've no idea what you're doing? c) Define "can't get it to work". What doesn't work? What do you expect to happen? Unless we see some code, a rough outline of what you're trying to accomplish our answers are going to be as vague as your questions.
__________________
BookMooch.com : Give books away. Get books you want. |
|
#7
|
|||
|
|||
|
Are you using sessions to make sure that only the admin can do this? That is what I have used to make my admin backend more secure.
To be fair, I'm new to PHP myself and am not sure how secure that is. I'm intrigued about this SQL interjections... I'll have to look it up! PS: How did you get a paying job if you're new to it?? I'm not saying that in a mean way, I want to get a job myself on some simple project and I'm just wondering how you went about it. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > PHP Development > PHP variables ($_GET) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|