Tutorials
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOtherTutorials

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 Codewalkers Forums Sponsor:
  #1  
Old December 17th, 2003, 02:02 AM
sapac sapac is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Adelaide,SA,Australia
Posts: 9 sapac User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
REQUEST: News tutorial

Hey,

Im having some trouble completing the news tutorial posted by Matt.

Seems stupid really considering all you have to do is copy the code....

But, im up to the part where im tryin to add the option to delete a particular news item.

Everything was going well until i realised that when i click on the link 'Delete' it does not enter the 'if' statement:
if($action=="delete"){....}

However, the url changes to http://server/php/news.php?action=delete&id=7
so im guessing that the variable $action does get set correctly on the server side...

Is the $action variable global and everlasting as such....i.e. does it at any point get reset or change value...??

I would appreciate any and all feedback that can be given.

Cheers,

Luke

Reply With Quote
  #2  
Old December 17th, 2003, 02:39 AM
sliver's Avatar
sliver sliver is offline
Moderator
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: WI, USA
Posts: 932 sliver User rank is Private First Class (20 - 50 Reputation Level)sliver User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 11 h
Reputation Power: 3
Send a message via AIM to sliver Send a message via XFire to sliver
RE: News tutorial

At the beginning of the script add this:
php Code:
Original - php Code
  1.  
  2. $action=$_GET['action']

and see if it works. Or you can open ur php.ini, and turn on register_globals.

Reply With Quote
  #3  
Old December 17th, 2003, 03:56 AM
Matt Matt is offline
Contributing User
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 12 m 16 sec
Reputation Power: 7
RE: News tutorial

Yep...it most likely is that you have register_globals off on your server. I need to update some of the tutorials to work with register_globals off...

Reply With Quote
  #4  
Old December 17th, 2003, 04:29 AM
sapac sapac is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Adelaide,SA,Australia
Posts: 9 sapac User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: REQUEST: News tutorial

Me again,

Yes, that worked....i do have register_globals turned off as i read somewhere that in general it is more secure....?? True?

Anyway, im still having trouble with this one....

Now when i go to read in the file 'news.txt' into the variable $data as to print it out and show the user what they are about to delete....i am returned an empty array.

I am therefore also unable to actual delete that news item from the storage file.

I looked in the forum and read that if you dont close the file after writing/apending it, then this can happen....but i have checked my code and i have explicitly closed the file each time after opening it.

Also, Matt....if your reading this....can you please explain in a little more detail what difference the order in which we check for action='delete' etc. makes.
You said:

<?PHP
if($action == "delete" && isset($HTTP_POST_VARS['password'])) {
?>

"That line should go to the very top of our script. Definitely make it above the last snippet that checked for an action of delete."

Where it looks to me that this code is indeed itself checking for the action of delete....this is rather confusing.

Once again, I would appreciate yours and anyone elses helpful feedback.

Thanks heaps,

Luke

Reply With Quote
  #5  
Old December 17th, 2003, 03:14 PM
notepad notepad is offline
Codewalkers Loyal (3000 - 3499 posts)
 
Join Date: Apr 2007
Location: Central, IL USA
Posts: 3,214 notepad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to notepad
RE: REQUEST: News tutorial

Quote:
Yes, that worked....i do have register_globals turned off as i read somewhere that in general it is more secure....?? True?

no, not true. it just makes it easier to write sloppy code which could be insecure if you don't know what you're doing.

Reply With Quote
Reply

Viewing: Codewalkers ForumsOtherTutorials > REQUEST: News tutorial


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!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

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




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek