LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-28-2004, 03:37 AM   #1
Elijah
Member
 
Registered: Feb 2003
Location: Philippines
Distribution: Debian, Mandrake, Redhat
Posts: 90

Rep: Reputation: 15
Programming: Best Solution?


I'm tasked to fix a frontend system for approving/disapproving database updates, it's made in PHP and Postgres as it's Database.

The system goes like this:

The user updates his currently existing db entry using the system, the changes are applied to the db entry and flagged it's status to "Modified". Approving that entry won't be a problem 'cause when the admin approves that request the system will flag that entry as "Approved". The problem is the disapproval of that update, the new changes must be deleted and must revert back to the old entry, but that's not possible 'cause the original entry has already been modified.

How do I go about this? I thought of backing up the original entry to be updated and restore it to the database only if the admin disapproves the new changes. But this means creating another set of tables to the database just for that backup ... I wonder if there's a better way?

Here's a small diagram of my idea...:
http://img57.photobucket.com/albums/...disapprove.png
 
Old 06-28-2004, 03:48 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
You need a new set of tables. How many - it depends on what you'd liek to backup. But you may handle the problem from the other way - the onld entry stays in the table until the new one (from an extra table) is approved.
I don't know how you picure looks like, as it doesn't display, so maybe you just have the same idea.
 
Old 06-28-2004, 07:46 PM   #3
Elijah
Member
 
Registered: Feb 2003
Location: Philippines
Distribution: Debian, Mandrake, Redhat
Posts: 90

Original Poster
Rep: Reputation: 15
Thanks for the advice, that's exactly what I was thinking. Each entry takes a lot of tables though ...
 
Old 06-29-2004, 01:43 PM   #4
QtCoder
Member
 
Registered: Aug 2003
Location: USA
Distribution: Slackware 12.0 RC1
Posts: 129

Rep: Reputation: 15
I had a problem similar to this. I was writing a link submission program where people could simply fill out a form and submit their link to my site. The main problem with it was that people could submit inappropriate sites. So, I added a little approve/disapprove routine where the information the user entered was sent to my inbox in an HTML formatted email that included a form that I could submit to the database.

Here's how it worked:

-- linknow.php

Here is where the user enters the information about the site he/she wishes to link. The form is submitted to submitlink.php

-- submitlink.php

This script formats and sends an HTML email that includes the form from linknow.php, with each text field/area filled with the information the user entered (all passed through POST vars). Nothing is placed into the database.

-- my email inbox

When I receive the email, I can edit each of the entries directly by simply changing the values in the text boxes then clicking submit. The form submits to a script I placed in an admin directory. This script puts the information into the database.

You may be able to do something similar, depending on how your system is set up. This way, nothing gets changed in the database before you approve/disapprove. The only problems, I suppose, are that the information would have to be POSTed several times and that my idea requires HTML emails (rather than a slick admin site) to do approving/disapproving.

Just an idea. Good luck!

Last edited by QtCoder; 06-29-2004 at 01:47 PM.
 
Old 07-01-2004, 10:38 AM   #5
Elijah
Member
 
Registered: Feb 2003
Location: Philippines
Distribution: Debian, Mandrake, Redhat
Posts: 90

Original Poster
Rep: Reputation: 15
Interesting solution, I'll keep that in mind. Thanks
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
which programming language is used to do tcp/ip programming?? gajaykrishnan Linux - Networking 9 12-21-2012 05:16 AM
Difference between Top Down programming & Bottom up programming minil Programming 1 06-17-2005 02:42 AM
solution for L 99 99 99 99 99 99 99 99 99 99 99!!!!!! evilhomer Mandriva 0 08-04-2004 11:01 AM
Please adivse on programming solution pembo13 Programming 9 06-16-2004 06:06 AM
Best Solution for me Thom_Redhat Linux - General 2 02-23-2004 07:04 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration