[PHP-DB] Question about access rights in php/mysql
Hi Everyone, I am attempting to wrap my head around an issue and wanted to see if I was thinking right. I am attempting to setup a pURL site, one where they go to something like: example.com/purl.php?purl=jason1234 and the site says Welcome Jason. I have that part of it working, and it's pulling the info from the database just fine, what I'm wondering about is locking it down a little bit more so that they can't just edit the info in the main page, but they have to specifically hit a button to edit the info. Is it better to have 2 connections to the database with 2 separate logins? One for the initial load which just has select privileges and a second for when they hit edit which then gives them update privileges? Or, should i just do 1 login with select, and update privileges? Any ideas or suggestions? Thanks! -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 11287 James St Holland, MI 49424 www.raoset.com [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Question about access rights in php/mysql
Hi Everyone, I am attempting to wrap my head around an issue and wanted to see if I was thinking right. I am attempting to setup a pURL site, one where they go to something like: example.com/purl.php?purl=jason1234 and the site says Welcome Jason. I have that part of it working, and it's pulling the info from the database just fine, what I'm wondering about is locking it down a little bit more so that they can't just edit the info in the main page, but they have to specifically hit a button to edit the info. Is it better to have 2 connections to the database with 2 separate logins? One for the initial load which just has select privileges and a second for when they hit edit which then gives them update privileges? Or, should i just do 1 login with select, and update privileges? Any ideas or suggestions? Thanks! Jason, I would assume you have some kind of login page, correct? Or can anyone type in the direct URL and access someone else's page? If they have already logged in, I would use some simple javascript to enable/disable the editing of form objects. By setting all of the form objects to disabled they will appear grayed out but the text is still legible. Then when they click on your Edit button just have a Javascript function set them all to enabled. You could do something similar to show/hide div's. Or, you could bypass all the javascript and just add an edit flag to your page? So once they click on the Edit button/link it would update a variable and you could do something like: if ($edit ==Y) { type=Submit name=save value=Save } Add in the option to save only if Edit has been selected? As for your database logins, I don't see a problem with doing it either way. I personally prefer to use a single login, but doing a include() for a second login is no big deal either.
Re: [PHP-DB] Question about access rights in php/mysql
On Aug 26, 2008, at 8:32 AM, Dan Shirah wrote: Hi Everyone, I am attempting to wrap my head around an issue and wanted to see if I was thinking right. I am attempting to setup a pURL site, one where they go to something like: example.com/purl.php?purl=jason1234 and the site says Welcome Jason. I have that part of it working, and it's pulling the info from the database just fine, what I'm wondering about is locking it down a little bit more so that they can't just edit the info in the main page, but they have to specifically hit a button to edit the info. Is it better to have 2 connections to the database with 2 separate logins? One for the initial load which just has select privileges and a second for when they hit edit which then gives them update privileges? Or, should i just do 1 login with select, and update privileges? Any ideas or suggestions? Thanks! Jason, I would assume you have some kind of login page, correct? Or can anyone type in the direct URL and access someone else's page? If they have already logged in, I would use some simple javascript to enable/disable the editing of form objects. By setting all of the form objects to disabled they will appear grayed out but the text is still legible. Then when they click on your Edit button just have a Javascript function set them all to enabled. You could do something similar to show/hide div's. Or, you could bypass all the javascript and just add an edit flag to your page? So once they click on the Edit button/link it would update a variable and you could do something like: if ($edit ==Y) { type=Submit name=save value=Save } Add in the option to save only if Edit has been selected? As for your database logins, I don't see a problem with doing it either way. I personally prefer to use a single login, but doing a include() for a second login is no big deal either. Hi Dan, Thanks for the info! the page will not actually require a login, it is a new direct mail technique where they get a piece of mail with the pURL on it, and then go there to follow up on the web. I think though that I will go with the 1 login, with a simple variable like to described. Thanks Dan! -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 11287 James St Holland, MI 49424 www.raoset.com [EMAIL PROTECTED]
[PHP-DB] PDFlib
Any help concerning installing PDFLib on PHP5.x APACHE2.x. with RHEL4 Thanks -- Madunix_at_Gmail Sysadmin Computers are useless. They can only give you answers - Pablo Picasso Never trust a computer you can't throw out a window. - Steve Wozniak
Re: [PHP-DB] PDFlib
Mad Unix wrote: Any help concerning installing PDFLib on PHP5.x APACHE2.x. with RHEL4 http://www.php.net/manual/en/pdf.setup.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Random content from MySql DB
I`m creating a small application that let users take test online, the user will login and visit the test page, questions and answers are stored in MySql database, i want to display each randomly without repeating. test must to completed between some specific amount of time or else the application will forcefully submit the form and calculated the completed ones (Eac question come up at a time and you choose the answer and submit, then another come show up again, just like that), I have plan of saving user`s progress and user may continue next time if he/she has not spent the total test time. I need your help on how to random the questions without repeating any and if a user may need to continue from he/her past, the random should also exclude the past questions stored inside the user progress table. What is your best advice, i want to start creating the mysql table soon. Thank you -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Random content from MySql DB
If the past questions are 1,2,3,4: Select * from `questions` where id not in (1,2,3,4) order by RAND(); Simcha Younger -Original Message- From: A. Joseph [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2008 7:38 PM To: php-db@lists.php.net Subject: [PHP-DB] Random content from MySql DB I`m creating a small application that let users take test online, the user will login and visit the test page, questions and answers are stored in MySql database, i want to display each randomly without repeating. test must to completed between some specific amount of time or else the application will forcefully submit the form and calculated the completed ones (Eac question come up at a time and you choose the answer and submit, then another come show up again, just like that), I have plan of saving user`s progress and user may continue next time if he/she has not spent the total test time. I need your help on how to random the questions without repeating any and if a user may need to continue from he/her past, the random should also exclude the past questions stored inside the user progress table. What is your best advice, i want to start creating the mysql table soon. Thank you -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php No virus found in this incoming message. Checked by AVG - http://www.avg.com Version: 8.0.138 / Virus Database: 270.6.7/1632 - Release Date: 25/08/2008 07:05 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Test connection to database
Hi I have written a little program that cycles through a list of databases and checks conectivity. it writes the status of this to a table now to check all 143 databases it takes about 50 seconds and I was wondering if this sounds about right to you guys. ?php //Include the required libraries and variables include_once (adodb5/adodb.inc.php); include_once (ola_ini.php); //Setup the connection to the database to be updated $db = NewADOConnection('oci8'); $db-Connect(false, $ola_usr, $ola_pwd, $ola_dbs); //Get the current status of the database (UP, DOWN or CHECKING) $stmt = $db-Prepare(select nvl(status,'NEW') from sla_monitoring where upper(database)=upper(:dbs)); $rs=$db-Execute($stmt, array('dbs' = $argv[1])); //Logon check for ORACLE (OCI) if($argv[2]=='Oracle') { if($rs-fields[0] == 'CHECKING') //If current status is CHECKING than the previous check has not completed. Find out why!!! { echo exiting; exit; } else { $stmt = $db-Prepare(update sla_monitoring set status=:status, last_check=to_date(:checkdate,'ddmmhh24miss') where upper(database)=upper(:dbs)); $rs=$db-Execute($stmt, array('dbs' = $argv[1],'status'='CHECKING','checkdate'=$argv[3])); //set status to CHECKING for current database before proceding if($db-Connect(false, $ora_usr, $ora_pwd,$argv[1] )) { $db-Execute($stmt, array('dbs' = $argv[1],'status'='UP')); } else { $rs=$db-Execute($stmt, array('dbs' = $argv[1],'status'='DOWN')); } } } ? this script gets called from a windows batch file to try and mimic a bit of multithreading snip startphp-win check_connect.php B2B Oracle 27082008145929 eamdasoplp01 startphp-win check_connect.php B2B Oracle 27082008145929 opal startphp-win check_connect.php BOCMSDEV Oracle 27082008145929 eawalsbop02 startphp-win check_connect.php BOCMSDR Oracle 27082008145929 eawalsbop02 startphp-win check_connect.php BOCMSP Oracle 27082008145929 eahobsorap01 . /snip Is this the best way to do this or are there any other ways that may lead to better performance. I realize I will have some contention on my table that can maybe be addressed, but for now let's focus on the PHP/BAT process Thanks Jack
Re: [PHP-DB] Test connection to database
Jack van Zanen wrote: Hi I have written a little program that cycles through a list of databases and checks conectivity. it writes the status of this to a table now to check all 143 databases it takes about 50 seconds and I was wondering if this sounds about right to you guys. Across your network I assume. All internal or some db's are external? Don't forget about network overhead, and even more so if you're going out to the internet at some point. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Test connection to database
Databases are located in several datacentres throughout the area/country and we connect through dedicated lines not internet. I realize that there may be many factors to consider, I just would like to have the PHP experts have a look at my method/PHP code to check that this is fairly optimized Jack On 27/08/2008, Chris [EMAIL PROTECTED] wrote: Jack van Zanen wrote: Hi I have written a little program that cycles through a list of databases and checks conectivity. it writes the status of this to a table now to check all 143 databases it takes about 50 seconds and I was wondering if this sounds about right to you guys. Across your network I assume. All internal or some db's are external? Don't forget about network overhead, and even more so if you're going out to the internet at some point. -- Postgresql php tutorials http://www.designmagick.com/ -- J.A. van Zanen