PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old May 8th, 2008, 10:04 AM
watsons watsons is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 10 watsons User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 21 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old May 8th, 2008, 10:39 AM
thedude2010 thedude2010 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 247 thedude2010 User rank is Sergeant Major (2000 - 5000 Reputation Level)thedude2010 User rank is Sergeant Major (2000 - 5000 Reputation Level)thedude2010 User rank is Sergeant Major (2000 - 5000 Reputation Level)thedude2010 User rank is Sergeant Major (2000 - 5000 Reputation Level)thedude2010 User rank is Sergeant Major (2000 - 5000 Reputation Level)thedude2010 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 23 h 35 m 10 sec
Reputation Power: 33
the link should be
PHP Code:
<a href='mypage.php?pageid=$pageid'>Click Here</a

then on mypage.php
PHP Code:
 $pageid=$_GET['pageid']; 


Quote:
Originally Posted by watsons
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

Reply With Quote
  #3  
Old May 8th, 2008, 10:46 AM
BananaMaster BananaMaster is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2008
Posts: 15 BananaMaster User rank is Sergeant (500 - 2000 Reputation Level)BananaMaster User rank is Sergeant (500 - 2000 Reputation Level)BananaMaster User rank is Sergeant (500 - 2000 Reputation Level)BananaMaster User rank is Sergeant (500 - 2000 Reputation Level)BananaMaster User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 9 h 22 m 24 sec
Reputation Power: 0
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.
Comments on this post
b3n agrees!

Reply With Quote
  #4  
Old May 8th, 2008, 11:32 AM
watsons watsons is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 10 watsons User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 21 sec
Reputation Power: 0
Quote:
Originally Posted by BananaMaster
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.


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

Reply With Quote
  #5  
Old May 8th, 2008, 12:00 PM
JustPHP's Avatar
JustPHP JustPHP is offline
Software Developer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2006
Location: East London
Posts: 132 JustPHP User rank is Sergeant (500 - 2000 Reputation Level)JustPHP User rank is Sergeant (500 - 2000 Reputation Level)JustPHP User rank is Sergeant (500 - 2000 Reputation Level)JustPHP User rank is Sergeant (500 - 2000 Reputation Level)JustPHP User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 5 h 26 m 14 sec
Reputation Power: 10
Send a message via MSN to JustPHP Send a message via Yahoo to JustPHP Send a message via Skype to JustPHP
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!

Reply With Quote
  #6  
Old May 8th, 2008, 02:12 PM
lnxgeek lnxgeek is offline
I AM A GOLDEN GOD
Dev Shed God (5000 - 5499 posts)
 
Join Date: Apr 2003
Location: cannot find symbol: method showLocation()
Posts: 5,278 lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 21 h 17 m 36 sec
Reputation Power: 564
Quote:
Originally Posted by watsons
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


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.

Reply With Quote
  #7  
Old May 8th, 2008, 06:02 PM
OlyPerson OlyPerson is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2007
Posts: 37 OlyPerson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 34 m 41 sec
Reputation Power: 1
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > PHP variables ($_GET)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway