php-general Digest 11 Nov 2006 12:33:36 -0000 Issue 4453
php-general Digest 11 Nov 2006 12:33:36 - Issue 4453 Topics (messages 244486 through 244492): Re: Staff log-in 244486 by: Daevid Vincent 244491 by: Jochem Maas PEAR and MDB2 244487 by: Alain Roger Re: MDB2 simple test 244488 by: Alain Roger 244489 by: Alain Roger 244490 by: Alain Roger MDB2 and PostgreSQL 244492 by: Alain Roger Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- ---BeginMessage--- -Original Message- From: Google Kreme [mailto:[EMAIL PROTECTED] Is that *really* your name?! :) The trouble comes when you need to time-out a session because someone never logged out properly. That can be hairy. Yeah, it's so hard to do that subtraction... 8 snip 8--- ?php require_once('classes/user.php'); // defines a class that needs to be de-serialized in the session. session_start(); //this must be called at the top of every page anyways. // user.php included above is needed so the session can instantiate the User object. if ( !is_bool($_SESSION['login']) || $_SESSION['login'] != true ) //we specifically test 'true' here and boolean. { exit(SCRIPTlocation.href='/index.php?page=.base64_encode($_SERVER['REQUE ST_URI']).';/SCRIPT); } else { SQL_DB ($_SESSION['companydb']); // Connect to their default V2_Database SQL_QUERY(UPDATE .$_SESSION['companydb']..Users SET LastAccessed = NOW() WHERE CoreID = '.$_SESSION['coreid'].' LIMIT 1); if ((!isset($_COOKIE['sid']) (time() - $_SESSION['last_access'] = $_SESSION['login_timeout'])) ) { echo scriptalert('Your session has been idle for .$_SESSION['login_timeout']. seconds.');location.href='./index.php';/script; require_once(/your/path/htdocs/index.php); exit; } $_SESSION['last_access'] = time(); } ? And in case you wonder why I store the base64 of the current page, it's so that after you authenticate them, you can gracefully pass them on to where they were trying to go (if they weren't logged in, or had timed out), complete with all $_GET parameters in tact... if ($_REQUEST['page']) header(Location: .base64_decode($_REQUEST['page'])); else header(Location: some_other_page.php); ---End Message--- ---BeginMessage--- Daevid Vincent wrote: -Original Message- From: Google Kreme [mailto:[EMAIL PROTECTED] Is that *really* your name?! :) The trouble comes when you need to time-out a session because someone never logged out properly. That can be hairy. Yeah, it's so hard to do that subtraction... you can only forcefully log someone out if they actually make a(nother) request - if they are logged in and then never visit the site again then you can't actually 'log them out' [at least not using the info stored in the relevant session file. the best you could do is run a 'cronjob' that periodically sets 'idle' logged in users as being logged out. not that the OP wanted to log the login and the logout of the user - your code below doesn't cover that. 8 snip 8--- ?php require_once('classes/user.php'); // defines a class that needs to be de-serialized in the session. session_start(); //this must be called at the top of every page anyways. // user.php included above is needed so the session can instantiate the User object. if ( !is_bool($_SESSION['login']) || $_SESSION['login'] != true ) //we specifically test 'true' here and boolean. { exit(SCRIPTlocation.href='/index.php?page=.base64_encode($_SERVER['REQUE ST_URI']).';/SCRIPT); } else { SQL_DB ($_SESSION['companydb']); // Connect to their default V2_Database SQL_QUERY(UPDATE .$_SESSION['companydb']..Users SET LastAccessed = NOW() WHERE CoreID = '.$_SESSION['coreid'].' LIMIT 1); if ((!isset($_COOKIE['sid']) (time() - $_SESSION['last_access'] = $_SESSION['login_timeout'])) ) { echo scriptalert('Your session has been idle for .$_SESSION['login_timeout']. seconds.');location.href='./index.php';/script; require_once(/your/path/htdocs/index.php); exit; } $_SESSION['last_access'] = time(); } ? And in case you wonder why I store the base64 of the current page, it's so that after you authenticate them, you can gracefully pass them on to where they were trying to go (if they weren't logged in, or had timed out), complete with all $_GET parameters in tact... if ($_REQUEST['page']) header(Location: .base64_decode($_REQUEST['page'])); else header(Location: some_other_page.php); ---End Message---
php-general Digest 12 Nov 2006 04:00:33 -0000 Issue 4454
php-general Digest 12 Nov 2006 04:00:33 - Issue 4454 Topics (messages 244493 through 244511): Re: Staff log-in 244493 by: John Nichel 244494 by: David Giragosian 244506 by: Google Kreme convert postgres date to PHP 244495 by: Alain Roger 244497 by: M.Sokolewicz 244498 by: Alain Roger 244499 by: Børge Holen 244500 by: Børge Holen 244501 by: M.Sokolewicz PHP Source File Encoding 244496 by: C Drozdowski 244507 by: Google Kreme 244509 by: M.Sokolewicz PEAR, MDB2 and MDB2_Driver_pgsql 244502 by: Alain Roger Re: http_build_query ... argh 244503 by: Roman Neuhauser activation through email 244504 by: Ahmad Al-Twaijiry 244508 by: Google Kreme Re: PEAR and MDB2 244505 by: Roman Neuhauser Encoder efficiency 244510 by: Sancar Saran How do you do the ? mark after a filename 244511 by: Thomas Bonham Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- ---BeginMessage--- Paul Novitski wrote: At 11/10/2006 07:09 AM, tedd wrote: Lastly, I think we all know that non-profit simply means that at the end of the year you get to roll your profits over to the next year without incurring taxes on the excess. Nothing more. Plus, there's no limit or requirements as to the amount/percentage you pay yourself as compared to what amounts you apply to your cause. So, mentioning non-profit to me is like saying you're just another scam -- and one, who's trolling for free php services. snip school lesson In the meantime, I suppose it is emblematic of my own innocence that it always surprises me when someone asks a naive question and is answered by insults and jeers in a listserve composed of bright and knowledgeable people who have purportedly come together for mutual education. The OP didn't ask a 'naive question' about why his register globals isn't working or something like that...he asked us to do his work for him. No 'mutual education' there. There may be no such thing as a stupid question, but the same cannot be said of the range of possible answers. It's naive to think there are no stupid questions. Had the original poster known enough about our field to ask for recommendations of open source solutions, would he have been treated so roughly? Nope. He didn't, by the way, ask for anything for free. He said, I unfortunately can't make it myself because I don't have the knowledge, can anyone of you do this for me? When no mention of remuneration has been made, why do you assume none will be forthcoming? Is this how you greet all prospective clients, non-profit or otherwise, who approach you asking for help? Are we to assume that this indicates your innate curiosity, your desire to gain clients, your ability to negotiate, your willingness to devote yourself to a good cause, or your capacity for politeness? If you followed the thread, you would have read that the OP got his panties in a knot when I posted him my rates for doing the job for him. On the surface you appear defend your right to be paid for your work (as though anyone had demanded otherwise!), but I would be very surprised if the OP considered for a moment hiring any self-proclaimed professional who replied so harshly to his query. His loss. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] ---End Message--- ---BeginMessage--- On 11/11/06, John Nichel [EMAIL PROTECTED] wrote: Paul Novitski wrote: At 11/10/2006 07:09 AM, tedd wrote: Lastly, I think we all know that non-profit simply means that at the end of the year you get to roll your profits over to the next year without incurring taxes on the excess. Nothing more. Plus, there's no limit or requirements as to the amount/percentage you pay yourself as compared to what amounts you apply to your cause. So, mentioning non-profit to me is like saying you're just another scam -- and one, who's trolling for free php services. snip school lesson In the meantime, I suppose it is emblematic of my own innocence that it always surprises me when someone asks a naive question and is answered by insults and jeers in a listserve composed of bright and knowledgeable people who have purportedly come together for mutual education. The OP didn't ask a 'naive question' about why his register globals isn't working or something like that...he asked us to do his work for him. No 'mutual education' there. There may be no such thing as a stupid question, but the same cannot be said of the range of possible answers. It's naive to think there are no stupid questions. Had the original poster known enough about
[PHP] PEAR and MDB2
Hi, As i'm new to PEAR world, i try to understand how does it work. for that i took the MDB2 and try to use it with PostgreSQL. here is a basic sample extract from PEAR help file and only modified. require_once 'Pear/MDB2.php'; $dsn = 'pgsql://login:[EMAIL PROTECTED]'; $mdb2 = MDB2::connect($dsn); if (PEAR::isError($mdb2)) { die($mdb2-getMessage()); } $res = $mdb2-query('SELECT * FROM articles'); while ($row = $res-fetchRow(MDB2_FETCHMODE_ASSOC)) { echo $row['title'] . ', ' . $row['content'] . \n; } $res-free(); when i try this code, the following error is raised : Call to undefined method MDB2_Error::fetchRow() which points to == while ($row = $res-fetchRow(MDB2_FETCHMODE_ASSOC)) So i'm lost now ? i have the feeling that something is missing but what ? thanks a lot, Al.
[PHP] Re: MDB2 simple test
Mark, this is my main_includes.php file : ?php $path = 'pear'; set_include_path(get_include_path() . PATH_SEPARATOR . $path); require_once Structures/DataGrid.php; require_once 'MDB2.php'; ? and in my file where i try to use MDB2.php, it's included like that : ?php include_once('includes/main_include.php'); ? at the beginning of my file before all META Articles table exists in my database, i've checked also if i did not make some mistakes in the user name, password or dbnane in my dsn, but as i do not have any error raised from the database connection. I guess that everything is correct. Al. On 11/11/06, Mark Wiesemann [EMAIL PROTECTED] wrote: Alain Roger wrote: I have a main_includes.php which include_once/require_once all needed things like MDB2.php or setpath for /pear folder Okay, but remember that the PEAR dir needs to in the include_path. Otherwise, e.g. MDB2 won't find its own files and might not work as expected. Anyway, you are right. issue is on the Query command. Here is the error message : MDB2 Error: unknown error _doQuery: [Error message: Could not execute statement] [Last executed query: SELECT * FROM articles] but it does not help me so much this error. Is this the output of getMessage() and getDebugInfo(). If it isn't, getDebugInfo() should give you more information. Anyway: Does the articles table exist in your database? Regards, Mark
[PHP] Fwd: MDB2 simple test
-- Forwarded message -- From: Alain Roger [EMAIL PROTECTED] Date: Nov 11, 2006 12:26 PM Subject: Re: MDB2 simple test To: Mark Wiesemann [EMAIL PROTECTED] I have a main_includes.php which include_once/require_once all needed things like MDB2.php or setpath for /pear folder Anyway, you are right. issue is on the Query command. Here is the error message : MDB2 Error: unknown error _doQuery: [Error message: Could not execute statement] [Last executed query: SELECT * FROM articles] but it does not help me so much this error. Ok, it can not execute the query but why ? example if from the PEAR help file :-( Al. On 11/11/06, Mark Wiesemann [EMAIL PROTECTED] wrote: [FYI: This is a copy of a message posted to news:php.pear.general Message-ID: [EMAIL PROTECTED]] Alain Roger wrote: As i'm new to PEAR world, i try to understand how does it work. for that i took the MDB2 and try to use it with PostgreSQL. here is a basic sample extract from PEAR help file and only modified. require_once 'Pear/MDB2.php'; This line should be better: require_once 'MDB2.php'; (and the PEAR directory should be in your include_path) $dsn = 'pgsql://login:[EMAIL PROTECTED]'; $mdb2 = MDB2::connect($dsn); if (PEAR::isError($mdb2)) { die($mdb2-getMessage()); } $res = $mdb2-query('SELECT * FROM articles'); You need to an error check here: if (PEAR::isError($res)) { die($res-getMessage() . 'br /' . $res-getDebugInfo()); } It's very likely that the following error about fetchRow() is caused because the query failed: fetchRow() would then be called on an MDB2_Error (or PEAR_Error) object which, of course, does not have a fetchRow() method. while ($row = $res-fetchRow(MDB2_FETCHMODE_ASSOC)) { echo $row['title'] . ', ' . $row['content'] . \n; } $res-free(); when i try this code, the following error is raised : Call to undefined method MDB2_Error::fetchRow() which points to == while ($row = $res-fetchRow(MDB2_FETCHMODE_ASSOC)) Regards, Mark
[PHP] Re: MDB2 simple test
for more information, here is the variable where points the include_path : include path = F:\My documents\Development\Website\Immense\Pear as i did not install PEAR via script, i uncompress it and copy files into Pear folder. i did this because my web hoster will not accept to install PEAR on his server. in folder : F:\My documents\Development\Website\Immense\Pear, i have all standard PEAR folder installation files... e.g. PEAR.PHP, MDB2.PHP, and relative subfolders. Al. On 11/11/06, Alain Roger [EMAIL PROTECTED] wrote: Mark, this is my main_includes.php file : ?php $path = 'pear'; set_include_path(get_include_path() . PATH_SEPARATOR . $path); require_once Structures/DataGrid.php; require_once 'MDB2.php'; ? and in my file where i try to use MDB2.php, it's included like that : ?php include_once('includes/main_include.php'); ? at the beginning of my file before all META Articles table exists in my database, i've checked also if i did not make some mistakes in the user name, password or dbnane in my dsn, but as i do not have any error raised from the database connection. I guess that everything is correct. Al. On 11/11/06, Mark Wiesemann [EMAIL PROTECTED] wrote: Alain Roger wrote: I have a main_includes.php which include_once/require_once all needed things like MDB2.php or setpath for /pear folder Okay, but remember that the PEAR dir needs to in the include_path. Otherwise, e.g. MDB2 won't find its own files and might not work as expected. Anyway, you are right. issue is on the Query command. Here is the error message : MDB2 Error: unknown error _doQuery: [Error message: Could not execute statement] [Last executed query: SELECT * FROM articles] but it does not help me so much this error. Is this the output of getMessage() and getDebugInfo(). If it isn't, getDebugInfo() should give you more information. Anyway: Does the articles table exist in your database? Regards, Mark
Re: [PHP] Staff log-in
Daevid Vincent wrote: -Original Message- From: Google Kreme [mailto:[EMAIL PROTECTED] Is that *really* your name?! :) The trouble comes when you need to time-out a session because someone never logged out properly. That can be hairy. Yeah, it's so hard to do that subtraction... you can only forcefully log someone out if they actually make a(nother) request - if they are logged in and then never visit the site again then you can't actually 'log them out' [at least not using the info stored in the relevant session file. the best you could do is run a 'cronjob' that periodically sets 'idle' logged in users as being logged out. not that the OP wanted to log the login and the logout of the user - your code below doesn't cover that. 8 snip 8--- ?php require_once('classes/user.php'); // defines a class that needs to be de-serialized in the session. session_start(); //this must be called at the top of every page anyways. // user.php included above is needed so the session can instantiate the User object. if ( !is_bool($_SESSION['login']) || $_SESSION['login'] != true ) //we specifically test 'true' here and boolean. { exit(SCRIPTlocation.href='/index.php?page=.base64_encode($_SERVER['REQUE ST_URI']).';/SCRIPT); } else { SQL_DB ($_SESSION['companydb']); // Connect to their default V2_Database SQL_QUERY(UPDATE .$_SESSION['companydb']..Users SET LastAccessed = NOW() WHERE CoreID = '.$_SESSION['coreid'].' LIMIT 1); if ((!isset($_COOKIE['sid']) (time() - $_SESSION['last_access'] = $_SESSION['login_timeout'])) ) { echo scriptalert('Your session has been idle for .$_SESSION['login_timeout']. seconds.');location.href='./index.php';/script; require_once(/your/path/htdocs/index.php); exit; } $_SESSION['last_access'] = time(); } ? And in case you wonder why I store the base64 of the current page, it's so that after you authenticate them, you can gracefully pass them on to where they were trying to go (if they weren't logged in, or had timed out), complete with all $_GET parameters in tact... if ($_REQUEST['page']) header(Location: .base64_decode($_REQUEST['page'])); else header(Location: some_other_page.php); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MDB2 and PostgreSQL
Hi, I'm still working on the issue with MDB2. i've checked the $mdb2 object and i discover that method doQuery does not exist when i write $mdb2- So it seems that MDB2.php does not pickup the datasource package pgsql.php. Therefore i would like to know if the following folder struture is correct : - Pear | |-MDB2.php |-.. |-\MDB2\ |-\Driver |-pgsql.php |- -- each subfolder has : pgsql.php and common.phpfiles |-... here is my code in my php file : $dsn = 'pgsql://my_login:[EMAIL PROTECTED]'; $mdb2 = MDB2::connect($dsn); if (PEAR::isError($mdb2)) { die($mdb2-getMessage()); } $res = $mdb2-query('SELECT * FROM articles'); if (PEAR::isError($res)) { die($res-getMessage() . 'br /' . $res-getDebugInfo()); } thanks a lot, Alain
Re: [PHP] Staff log-in
Paul Novitski wrote: At 11/10/2006 07:09 AM, tedd wrote: Lastly, I think we all know that non-profit simply means that at the end of the year you get to roll your profits over to the next year without incurring taxes on the excess. Nothing more. Plus, there's no limit or requirements as to the amount/percentage you pay yourself as compared to what amounts you apply to your cause. So, mentioning non-profit to me is like saying you're just another scam -- and one, who's trolling for free php services. snip school lesson In the meantime, I suppose it is emblematic of my own innocence that it always surprises me when someone asks a naive question and is answered by insults and jeers in a listserve composed of bright and knowledgeable people who have purportedly come together for mutual education. The OP didn't ask a 'naive question' about why his register globals isn't working or something like that...he asked us to do his work for him. No 'mutual education' there. There may be no such thing as a stupid question, but the same cannot be said of the range of possible answers. It's naive to think there are no stupid questions. Had the original poster known enough about our field to ask for recommendations of open source solutions, would he have been treated so roughly? Nope. He didn't, by the way, ask for anything for free. He said, I unfortunately can't make it myself because I don't have the knowledge, can anyone of you do this for me? When no mention of remuneration has been made, why do you assume none will be forthcoming? Is this how you greet all prospective clients, non-profit or otherwise, who approach you asking for help? Are we to assume that this indicates your innate curiosity, your desire to gain clients, your ability to negotiate, your willingness to devote yourself to a good cause, or your capacity for politeness? If you followed the thread, you would have read that the OP got his panties in a knot when I posted him my rates for doing the job for him. On the surface you appear defend your right to be paid for your work (as though anyone had demanded otherwise!), but I would be very surprised if the OP considered for a moment hiring any self-proclaimed professional who replied so harshly to his query. His loss. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Staff log-in
On 11/11/06, John Nichel [EMAIL PROTECTED] wrote: Paul Novitski wrote: At 11/10/2006 07:09 AM, tedd wrote: Lastly, I think we all know that non-profit simply means that at the end of the year you get to roll your profits over to the next year without incurring taxes on the excess. Nothing more. Plus, there's no limit or requirements as to the amount/percentage you pay yourself as compared to what amounts you apply to your cause. So, mentioning non-profit to me is like saying you're just another scam -- and one, who's trolling for free php services. snip school lesson In the meantime, I suppose it is emblematic of my own innocence that it always surprises me when someone asks a naive question and is answered by insults and jeers in a listserve composed of bright and knowledgeable people who have purportedly come together for mutual education. The OP didn't ask a 'naive question' about why his register globals isn't working or something like that...he asked us to do his work for him. No 'mutual education' there. There may be no such thing as a stupid question, but the same cannot be said of the range of possible answers. It's naive to think there are no stupid questions. Had the original poster known enough about our field to ask for recommendations of open source solutions, would he have been treated so roughly? Nope. He didn't, by the way, ask for anything for free. He said, I unfortunately can't make it myself because I don't have the knowledge, can anyone of you do this for me? When no mention of remuneration has been made, why do you assume none will be forthcoming? Is this how you greet all prospective clients, non-profit or otherwise, who approach you asking for help? Are we to assume that this indicates your innate curiosity, your desire to gain clients, your ability to negotiate, your willingness to devote yourself to a good cause, or your capacity for politeness? If you followed the thread, you would have read that the OP got his panties in a knot when I posted him my rates for doing the job for him. On the surface you appear defend your right to be paid for your work (as though anyone had demanded otherwise!), but I would be very surprised if the OP considered for a moment hiring any self-proclaimed professional who replied so harshly to his query. His loss. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] Paul Novitski previously wrote: My, aren't we grumpy! What big bad non-profit organization rained on your parade? I agree with Paul. No need to jump to conclusions when it would have been just as easy for anyone on this list to ask a clarifying question of the OP. David
[PHP] convert postgres date to PHP
Hi, in my database PosgreSQL i have stored some date in the following format : -MM-DD HH:MM:SS this is a real TimeStamp without time zone field format. Under PHP i would like to display this field as text with the following format DD.MM. How can i do that ? i was thinking to do : $date_from_pgsql; echo date(d.m.Y,$date_from_pgsql); but in this case it displays 01.01.1970 :-( any idea ? thanks. -- Alain Windows XP SP2 PostgreSQL 8.1.4 Apache 2.0.58 PHP 5
[PHP] PHP Source File Encoding
Gotta a question whose answer should be really obvious to me but, for some reason, is just eluding me. Which encodings can PHP handle for source files? I've been using iso-8859-1 but what about utf-8? Thanks, C Drozdowski -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: convert postgres date to PHP
well, I could say RTFM, but I'll help you this time with a few links: 1. date() http://www.php.net/manual/en/function.date.php 2. strtotime() http://www.php.net/manual/en/function.strtotime.php - tul P.S. RTFM! Alain Roger wrote: Hi, in my database PosgreSQL i have stored some date in the following format : -MM-DD HH:MM:SS this is a real TimeStamp without time zone field format. Under PHP i would like to display this field as text with the following format DD.MM. How can i do that ? i was thinking to do : $date_from_pgsql; echo date(d.m.Y,$date_from_pgsql); but in this case it displays 01.01.1970 :-( any idea ? thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: convert postgres date to PHP
Sorry to tell you that but that's why i ask here this question, because i get everytime 01.01.1970.. RTFM i did ! On 11/11/06, M.Sokolewicz [EMAIL PROTECTED] wrote: well, I could say RTFM, but I'll help you this time with a few links: 1. date() http://www.php.net/manual/en/function.date.php 2. strtotime() http://www.php.net/manual/en/function.strtotime.php - tul P.S. RTFM! Alain Roger wrote: Hi, in my database PosgreSQL i have stored some date in the following format : -MM-DD HH:MM:SS this is a real TimeStamp without time zone field format. Under PHP i would like to display this field as text with the following format DD.MM. How can i do that ? i was thinking to do : $date_from_pgsql; echo date(d.m.Y,$date_from_pgsql); but in this case it displays 01.01.1970 :-( any idea ? thanks. -- Alain R. Windows XP SP2 PostgreSQL 8.1.4 Apache 2.0.58 PHP 5
Re: [PHP] convert postgres date to PHP
Dunno 'bout posgresql, but mysql can handle that situation quite easily with DATE_FORMAT witch is what I use. On Saturday 11 November 2006 16:59, Alain Roger wrote: Hi, in my database PosgreSQL i have stored some date in the following format : -MM-DD HH:MM:SS this is a real TimeStamp without time zone field format. Under PHP i would like to display this field as text with the following format DD.MM. How can i do that ? i was thinking to do : $date_from_pgsql; echo date(d.m.Y,$date_from_pgsql); but in this case it displays 01.01.1970 :-( any idea ? thanks. -- --- Børge Kennel Arivene http://www.arivene.net --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert postgres date to PHP
And while on it... Explode could do the trick to. On Saturday 11 November 2006 16:59, Alain Roger wrote: Hi, in my database PosgreSQL i have stored some date in the following format : -MM-DD HH:MM:SS this is a real TimeStamp without time zone field format. Under PHP i would like to display this field as text with the following format DD.MM. How can i do that ? i was thinking to do : $date_from_pgsql; echo date(d.m.Y,$date_from_pgsql); but in this case it displays 01.01.1970 :-( any idea ? thanks. -- --- Børge Kennel Arivene http://www.arivene.net --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: convert postgres date to PHP
You get that because your input is not a unix timestamp, it's a RFC 3339 formatted date-/timestamp. You first need to convert it (using ie. strtotime, or explode() and feeding it to mktime()) to a unix timestamp before you can feed the unix timestamp to the date() function. Unix timestamps are integers. When feeding it into date() the STRING (because '2006-11-11 01:02:03' is a STRING) will be converted to an integer (value of 0) and interpreted as being a valid unix timestamp (namely, 0). Unix Timestamp = 0 is January 1st, 1970. The start of the UNIX epoch. - tul Alain Roger wrote: Sorry to tell you that but that's why i ask here this question, because i get everytime 01.01.1970.. RTFM i did ! On 11/11/06, M.Sokolewicz [EMAIL PROTECTED] wrote: well, I could say RTFM, but I'll help you this time with a few links: 1. date() http://www.php.net/manual/en/function.date.php 2. strtotime() http://www.php.net/manual/en/function.strtotime.php - tul P.S. RTFM! Alain Roger wrote: Hi, in my database PosgreSQL i have stored some date in the following format : -MM-DD HH:MM:SS this is a real TimeStamp without time zone field format. Under PHP i would like to display this field as text with the following format DD.MM. How can i do that ? i was thinking to do : $date_from_pgsql; echo date(d.m.Y,$date_from_pgsql); but in this case it displays 01.01.1970 :-( any idea ? thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PEAR, MDB2 and MDB2_Driver_pgsql
Hi, So i solved my problem with Pager, MDB2...therefore thanks a lot to everybody for your support. I have nevertheless still 1 question to which i need help. I would like to understand how MDB2_Driver_pgsql and MDB2 class are linked to each other ? i was thinking that the first one is derived from the MDB2 but it is not. MDB2_Driver_pgsql has almost the same function that MDB2... So i would like to understand how MDB2_Driver_pgsql works ? Could you give me an example where : - there we open a connection to a pgsql db - where there is a query - where we display the result of this query ? because i have the feeling that every time we come back to MDB2::connect, MDB2::fetchrow,... thanks a lot, -- Alain Windows XP SP2 PostgreSQL 8.1.4 Apache 2.0.58 PHP 5
Re: [PHP] http_build_query ... argh
# [EMAIL PROTECTED] / 2006-11-10 14:08:22 +0100: Arpad Ray wrote: ~ %5[bd] # the bracket (?= # must be followed by [^]* # any characters except = # then a = ) ~eix thanks very much for the explanation! Note that it's still a valid PCRE, and you can use this commented version in place of the one Arpad posted earlier. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] activation through email
Hi everyone I have a site with around 1000 new users everyday, and when every user register my scripts will send a random password to his email. the problem is that I got many users (specially hotmail users) complain that they didn't receive any email (even in the hotmail junk box). I know that hotmail is filtering me as a possibly a spammer (because I use a shared mail server) and there is nothing I can do about this. now I stooped sending the password to the users email and I just make the user chose his own password and he can login directly without the need to check his email for the password. but the problem now is that many users are registering with a fake emails :( so I want to ask you if you have any solution for this ? how can I (in someway) make my scripts check if the email is valid and exists email before I register him without the need to send any password or activation link to his email ? do you have any idea ? Thanks -- echo Hello World :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PEAR and MDB2
# [EMAIL PROTECTED] / 2006-11-11 12:02:37 +0100: require_once 'Pear/MDB2.php'; $dsn = 'pgsql://login:[EMAIL PROTECTED]'; $mdb2 = MDB2::connect($dsn); if (PEAR::isError($mdb2)) { die($mdb2-getMessage()); } $res = $mdb2-query('SELECT * FROM articles'); if (PEAR::isError($res)) { die($res-getMessage()); } while ($row = $res-fetchRow(MDB2_FETCHMODE_ASSOC)) { echo $row['title'] . ', ' . $row['content'] . \n; } $res-free(); -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Staff log-in
On 10 Nov 2006, at 19:25 , Daevid Vincent wrote: -Original Message- From: Google Kreme [mailto:[EMAIL PROTECTED] Is that *really* your name?! :) Well, I TRIED to change it, but two guys in birks, tie-dyed t-shirts, and macramé briefcases showed up with an injunction. :) The trouble comes when you need to time-out a session because someone never logged out properly. That can be hairy. Yeah, it's so hard to do that subtraction... Figuring out when and how to time out a connection and what time stamp to give to a timeout. After all, if minutes count and a connection times out after 30 minutes do you set the logout time then, or 30 minutes i the past? That's the sort of hairy I meant. Not math. Math is never hairy. Squiggly, yes, tentacle-ly, perhaps if there is calculus involved. -- Gentlemen, you can't fight in here! This is the War Room. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Source File Encoding
On 11 Nov 2006, at 08:45 , C Drozdowski wrote: Gotta a question whose answer should be really obvious to me but, for some reason, is just eluding me. Which encodings can PHP handle for source files? I've been using iso-8859-1 but what about utf-8? Try it? 5.0.6 seems to work fine with files from BBEdit saved as utf-8, but I don't know that there are any non-ISO-8859-1 characters in the file, so it's not a fair test. -- Because you can't cotton to evil. No Sir. You have to smack evil on the nose with the rolled-up newspaper of justice and say,'Bad evil. bad BAD evil' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] activation through email
On 11 Nov 2006, at 12:38 , Ahmad Al-Twaijiry wrote: I know that hotmail is filtering me as a possibly a spammer (because I use a shared mail server) and there is nothing I can do about this. Sure there is, move to a better neighborhood. And hotmail will not block you for being on a shared server unless the others on the shared server are spammers. so I want to ask you if you have any solution for this ? how can I (in someway) make my scripts check if the email is valid and exists email before I register him without the need to send any password or activation link to his email ? Well, you can do what some mail servers do, and try to connect to the MX for the domain and see if the username is accepted. Or, if this is a hotmail specific issue, you can not allow hotmail addresses. -- Like the moment when the brakes lock/And you slide towards the big truck/You stretch the frozen moments with your fear -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Source File Encoding
UTF-8 works as long as you don't include a BOM (ByteOrderMark). - tul Google Kreme wrote: On 11 Nov 2006, at 08:45 , C Drozdowski wrote: Gotta a question whose answer should be really obvious to me but, for some reason, is just eluding me. Which encodings can PHP handle for source files? I've been using iso-8859-1 but what about utf-8? Try it? 5.0.6 seems to work fine with files from BBEdit saved as utf-8, but I don't know that there are any non-ISO-8859-1 characters in the file, so it's not a fair test. --Because you can't cotton to evil. No Sir. You have to smack evil on the nose with the rolled-up newspaper of justice and say,'Bad evil. bad BAD evil' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Encoder efficiency
Hi, What is Zend Encoder efficency. After encoding shall we assume our code was safe... Or what should we expected Regards Sancar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How do you do the ? mark after a filename
Hi All, I keep seeing the ? mark after many file names index.php?id=234. So what I would like to know is how do you make them. I have heard that they can make a programs life sampler when doing somethings with a database. Thank you, Thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do you do the ? mark after a filename
the ? is a delimiter between the url and the get variables, which are set by the script itself, either through forms or by scripts. Thomas Bonham wrote: Hi All, I keep seeing the ? mark after many file names index.php?id=234. So what I would like to know is how do you make them. I have heard that they can make a programs life sampler when doing somethings with a database. Thank you, Thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php