RE: [PHP-DB] Session understanding
If you include the other page AFTER you do this check you'll be fine. So run your if statement and then add an else...include other.php; HTH, Steve. -Original Message- From: Rodrigo [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 26, 2002 9:38 AM To: PHP Subject: [PHP-DB] Session understanding Hi people, if i use this code: ?php session_start(); if(empty($_SESSION['username'])) { die('An error has ocurred. It may be that you have not logged in, or that your session has expired. Please try a href=login.phplogging in/a again or contact the a href=mailto:[EMAIL PROTECTED];system administrator/a'); } ? in one page to check if the user is logged, and in this same page i include another page, do i have to put this same test in this page that is beiing included??? this question may be dumb but i don´t knowthnaks a lot for the help. Equipe Pratic Sistemas Rodrigo Corrêa Fone: (14) 441-1700 [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] advise needed for 'authorized only' site
I do pretty much the same thing but with seesion vars, I just check that the user and level session vars are the appropriate values before I display confidential material. -Steve. -Original Message- From: Rob Day [mailto:[EMAIL PROTECTED]] Sent: Monday, September 23, 2002 11:22 AM To: 'PHP DB' Subject: RE: [PHP-DB] advise needed for 'authorized only' site I had a similar problem, but I can't promise that my solution is the best way to go about it. After the user was validated, I set a cookie. I then had all subsequent pages start with an if statement that checked for the cookie. If there was no cookie, they were sent back to the entry point. Another option if your application is somehow linear would be to make sure that the referring page is what you wanted it to be. -Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, September 23, 2002 10:14 AM To: PHP_DB Subject: [PHP-DB] advise needed for 'authorized only' site I have set up a section of my company site for use by authorized dealers only. I am currently using mysql authorization, which works for the first page, but if someone were to type in the url of an underlying page they would be able to get in without authorization. I know I could use .htaccess for handling this but with a minimum of 350 -400 users to keep track of that would be unwieldly to say the least, especially for my boss who doesn't have a clue about *nix and has never even heard of .htaccess. What other options do I have to keep the underlying pages from being accessed without the user being forced to go through the logon screen? Thanks, -- Chip Wiegand Computer Services Simrad, Inc www.simradusa.com [EMAIL PROTECTED] There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corporation, 1977 (They why do I have 9? Somebody help me!) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] time field query problems.
Thanks, I wasn't sure what kind of field to use, I'll give the timestamp a try and set 0 as default. Regards, Steve. -Original Message- From: DL Neil [mailto:[EMAIL PROTECTED]] Sent: Monday, July 29, 2002 6:34 PM To: Steve Bradwell; [EMAIL PROTECTED]; Php-Db (E-mail) Subject: Re: [PHP-DB] time field query problems. Steve, For some reason the below statement is not working. Can anyone tell me why? Select EDIT_LOCK from ordmaster where EDIT_LOCK + INTERVAL 10 MINUTE now() AND ORDER_NO = '5' AND EDIT_LOCK 0; -EDIT_LOCK is a MySQL (ver 3.23.49-max) time field, allows nulls, default is NULL. If this cannot be done in a query, whats the best way to compare time in php? The best way to compare time in PHP is to use the MySQL RDBMS that is managing/retrieving the data for you. Recommendation 1: do not use a Time field (you did mean the back 'half' of a Date-time field didn't you?). Because you are (apparently only) using this field to temporarily lock a row, the value is only ever used for computation (cf display). A Timestamp field is best for computation - a Time field for presentation. Consider also storing such data as an integer field or beware the automatic update feature for Timestamp fields. Recommendation 2: re-consider the (default) use of NULL - this may be the root of the question you're asking: what if the row has never been 'locked' and attempt the (above) SELECT? (then the last comparison clause would be illogical) If the default were zero (0 or 00:00:00) and the retrieval logic updated slightly, things should be less complicated. Regards, =dn - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] time field query problems.
Ya I checked and the manual said that with a version 3.23 or higher you can use + and - signs instead of the date_add subtract. Either way it just returns null. Ever tried somthing like this? Thanks, Steve. -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Monday, July 29, 2002 3:13 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] time field query problems. On Tuesday 30 July 2002 02:41, Steve Bradwell wrote: Sorry to repost but I typed in the wrong sql statement in my previous post. For some reason the below statement is not working. Can anyone tell me why? Select EDIT_LOCK from ordmaster where EDIT_LOCK + INTERVAL 10 MINUTE now() AND ORDER_NO = '5' AND EDIT_LOCK 0; I think you have to use something like: ... WHERE DATE_ADD(EDIT_LOCK, ...) ... Check manual for details. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Intuition, however illogical, is recognized as a command prerogative. -- Kirk, Obsession, stardate 3620.7 */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] time field query problems.
Sorry to repost but I typed in the wrong sql statement in my previous post. For some reason the below statement is not working. Can anyone tell me why? Select EDIT_LOCK from ordmaster where EDIT_LOCK + INTERVAL 10 MINUTE now() AND ORDER_NO = '5' AND EDIT_LOCK 0; -EDIT_LOCK is a MySQL (ver 3.23.49-max) time field, allows nulls, default is NULL. If this cannot be done in a query, whats the best way to compare time in php? Thanks, Steve. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Delete from multiple tables with php
Hi, What is the best way to simulate the following delete statement with php to MySQL 3.23..? $sql = DELETE ordlines.*, ordmaster.* FROM ordlines, ordmaster; $sql.= WHERE ordlines.ORDER_NO ='.$order.'; From what I've read MySQL doesn't support deletes from multiple tables. TIA, Steve. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Innodb and transactions.
So should I be using Innodb tables or BDB tables? Thanks, Steve. -Original Message- From: Michael Bretterklieber [mailto:[EMAIL PROTECTED]] Sent: Friday, June 21, 2002 2:49 AM To: Php-Db (E-mail) Subject: Re: [PHP-DB] Innodb and transactions. Hi, you have to do something like this: mysql_query('SET AUTOCOMMIT=0'); mysql_query('COMMIT'); or mysql_query('ROLLBACK'); mysql_query('SET AUTOCOMMIT=1'); bye, Steve Bradwell schrieb: Hi all, I have just figured out and set up my Innodb on my mysql server so I can use transactions Begin, commit, rollback. I'm now looking for examples on how to do this with php. I hit the php site and the best I could find was fbsql_commit etc... is this what I'm looking for? There's no documentation yet. I'm using php4 with mysql 3.23.49-max, and my tables are Innodb. I appologize if my lingo is somewhat confusing or just wrong but I'm pretty new to this stuff. Any input or examples would be greatly appreciated. Thanks, Steve. -- -- Michael Bretterklieber LCP JAWA Management Software GmbH Liebenauer Hauptstr. 200 A-8041 GRAZ Tel: ++43-(0)316-403274-12 Fax: ++43-(0)316-403274-10 GSM: ++43-(0)676-93 96 698 [EMAIL PROTECTED] homepage: http://www.jawa.at - privat --- E-mail: [EMAIL PROTECTED] homepage: http://www.inode.at/mbretter -- ...the number of UNIX installations has grown to 10, with more expected... - Dennis Ritchie and Ken Thompson, June 1972 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Innodb and transactions.
Great! thanks for your help. -Steve. -Original Message- From: Michael Bretterklieber [mailto:[EMAIL PROTECTED]] Sent: Friday, June 21, 2002 9:11 AM To: Php-Db (E-mail) Subject: Re: [PHP-DB] Innodb and transactions. Hi, use InnoDB, because InnoDB supports row-level locking, and InnoDB also supports referential-integrity, bye, Steve Bradwell schrieb: So should I be using Innodb tables or BDB tables? Thanks, Steve. -Original Message- From: Michael Bretterklieber [mailto:[EMAIL PROTECTED]] Sent: Friday, June 21, 2002 2:49 AM To: Php-Db (E-mail) Subject: Re: [PHP-DB] Innodb and transactions. Hi, you have to do something like this: mysql_query('SET AUTOCOMMIT=0'); mysql_query('COMMIT'); or mysql_query('ROLLBACK'); mysql_query('SET AUTOCOMMIT=1'); bye, Steve Bradwell schrieb: Hi all, I have just figured out and set up my Innodb on my mysql server so I can use transactions Begin, commit, rollback. I'm now looking for examples on how to do this with php. I hit the php site and the best I could find was fbsql_commit etc... is this what I'm looking for? There's no documentation yet. I'm using php4 with mysql 3.23.49-max, and my tables are Innodb. I appologize if my lingo is somewhat confusing or just wrong but I'm pretty new to this stuff. Any input or examples would be greatly appreciated. Thanks, Steve. -- -- Michael Bretterklieber LCP JAWA Management Software GmbH Liebenauer Hauptstr. 200 A-8041 GRAZ Tel: ++43-(0)316-403274-12 Fax: ++43-(0)316-403274-10 GSM: ++43-(0)676-93 96 698 [EMAIL PROTECTED] homepage: http://www.jawa.at - privat --- E-mail: [EMAIL PROTECTED] homepage: http://www.inode.at/mbretter -- ...the number of UNIX installations has grown to 10, with more expected... - Dennis Ritchie and Ken Thompson, June 1972 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Innodb and transactions.
Hi all, I have just figured out and set up my Innodb on my mysql server so I can use transactions Begin, commit, rollback. I'm now looking for examples on how to do this with php. I hit the php site and the best I could find was fbsql_commit etc... is this what I'm looking for? There's no documentation yet. I'm using php4 with mysql 3.23.49-max, and my tables are Innodb. I appologize if my lingo is somewhat confusing or just wrong but I'm pretty new to this stuff. Any input or examples would be greatly appreciated. Thanks, Steve. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] indexing
Hi all, More of a database question here, my apologies: I've been doing some reading on indexes but I thought I should get an experienced persons input. My question is about Over Indexing. I have a MySQL MyISAM table that stores inventory transactions, in, out etc. I store numeric fields that are primary indexes in other tables, 2 datetime fields and a qty field, Paul DuBois' MySQL book says that anything used in a where clause or join clause is a candidate for an index. It turns out that 7 out of eight fields fit this description,1 primary key, 4 smallints, and 2 are datetime fields. Should I use all these indexes or is this overkill? Thanks for any input Steve. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php