php-general Digest 31 Aug 2007 04:33:20 -0000 Issue 4991

Topics (messages 261535 through 261557):

Re: How to show proper time to users from around the world
        261535 by: Hemanth
        261541 by: Ólafur Waage

Reload page after form submit
        261536 by: Wagner Garcia Campagner
        261537 by: Per Jessen
        261538 by: Wouter van Vliet / Interpotential
        261539 by: Wagner Garcia Campagner
        261542 by: Stut
        261543 by: Instruct ICC
        261544 by: Instruct ICC
        261545 by: Afan Pasalic
        261546 by: Instruct ICC
        261548 by: Martin Marques
        261550 by: Stut
        261551 by: Instruct ICC

Compiling PHP 5.2.3
        261540 by: Eric Gorr

make test failures (was Re: [PHP] Compiling PHP 5.2.3)
        261547 by: Eric Gorr

Re: Internet Explorer Caching
        261549 by: Daevid Vincent

crypt salt question
        261552 by: Andras Kende
        261553 by: Satyam
        261554 by: Jan Reiter
        261555 by: Jan Reiter
        261556 by: Andras Kende

Re: date formatting
        261557 by: Haydar TUNA

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:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Its ok if I can display just the time set in their computers
wherever they are and even if they are travelling.

anyway thats as far as anyone can get short of asking them for the time

Is there some simple way

I have collected various ideas and snippets searching google
trying to piece them all together



On 8/30/07, Richard Lynch <[EMAIL PROTECTED]> wrote:
>
> On Wed, August 29, 2007 2:24 am, Hemanth wrote:
> > Is there a solution to showing the proper time and date at user
> > browsers
> > and also recording proper USER times in the database operations in
> > mysql
>
> Not really.
>
> You can use Javascript to get what the user's clock SAYS is the
> date/time, but WAY too many users have their clocks set wrong, and
> you'll never fix that.
>
> You can ask them where they live, or ask them to input their own
> time-zone.
>
> Traveling users may prefer to use UTC or something as well, rather
> than try to figure out what time-zone they are in this minute (cough
> Indiana cough).
>
> --
>



-- 
www.ValueAds.biz    so easy....
FREE India Classifieds
Jobs, Matrimony, Property and more....
A Bangalore, India Venture.

--- End Message ---
--- Begin Message ---
Since there are always many ways to do things here's one id like to
see how well it worked. It would be getting the IP address of the user
and matching it against an IP address locator. Since ive seen these to
be accurate to what timezone people are in.

Olafur W

2007/8/30, Hemanth <[EMAIL PROTECTED]>:
> Its ok if I can display just the time set in their computers
> wherever they are and even if they are travelling.
>
> anyway thats as far as anyone can get short of asking them for the time
>
> Is there some simple way
>
> I have collected various ideas and snippets searching google
> trying to piece them all together
>
>
>
> On 8/30/07, Richard Lynch <[EMAIL PROTECTED]> wrote:
> >
> > On Wed, August 29, 2007 2:24 am, Hemanth wrote:
> > > Is there a solution to showing the proper time and date at user
> > > browsers
> > > and also recording proper USER times in the database operations in
> > > mysql
> >
> > Not really.
> >
> > You can use Javascript to get what the user's clock SAYS is the
> > date/time, but WAY too many users have their clocks set wrong, and
> > you'll never fix that.
> >
> > You can ask them where they live, or ask them to input their own
> > time-zone.
> >
> > Traveling users may prefer to use UTC or something as well, rather
> > than try to figure out what time-zone they are in this minute (cough
> > Indiana cough).
> >
> > --
> >
>
>
>
> --
> www.ValueAds.biz    so easy....
> FREE India Classifieds
> Jobs, Matrimony, Property and more....
> A Bangalore, India Venture.
>

--- End Message ---
--- Begin Message ---
Hello,

I'm building a web page just like a blog...

Where the user input some information... (name, website and comment)

This information is stored in a file...

And then the page displays it...

When the user access the page the first time, the information is displayed
correct...

After the user submit the information, the page become outdated... without
this last information the user submitted...

Is there a way to tell PHP to reload the page after the user submit the
information, so the page is always updated??

Thanks in advance,
Wagner.

--- End Message ---
--- Begin Message ---
Wagner Garcia Campagner wrote:

> Hello,
> 
> I'm building a web page just like a blog...
> 
> Where the user input some information... (name, website and comment)
> 
> This information is stored in a file...
> 
> And then the page displays it...
> 
> When the user access the page the first time, the information is
> displayed correct...
> 
> After the user submit the information, the page become outdated...
> without this last information the user submitted...
> 
> Is there a way to tell PHP to reload the page after the user submit
> the information, so the page is always updated??

After you've processed the POST request, you finish with something like
this:

header("HTTP/1.0 303 See other");
header("Location: #");
exit;


/Per Jessen, Zürich

--- End Message ---
--- Begin Message ---
On 30/08/2007, Per Jessen <[EMAIL PROTECTED]> wrote:
>
> Wagner Garcia Campagner wrote:
>
> > Hello,
> >
> > I'm building a web page just like a blog...
> >
> > Where the user input some information... (name, website and comment)
> >
> > This information is stored in a file...
> >
> > And then the page displays it...
> >
> > When the user access the page the first time, the information is
> > displayed correct...
> >
> > After the user submit the information, the page become outdated...
> > without this last information the user submitted...
> >
> > Is there a way to tell PHP to reload the page after the user submit
> > the information, so the page is always updated??
>
> After you've processed the POST request, you finish with something like
> this:
>
> header("HTTP/1.0 303 See other");
> header("Location: #");
> exit;


It needs a little bit more than that. The script to which the form has been
submitted knows about the $_POST data, once you Location: to another page
that gets forgotten. Just add a line like $_SESSION['lastFormSubmit'] =
$_POST just before the first header() call and you're fine.






-- 
Interpotential.com
Phone: +31615397471

--- End Message ---
--- Begin Message ---
Thanks a lot,

I tried both suggestions, but it didn't work...

I did it send an Echo with this string:

<META HTTP-EQUIV='refresh' content='0;URL=index.php'>

After processing the form... it worked...

Is there any problem doing this?

Thanks again,
Wagner.



-----Original Message-----
From: Wouter van Vliet / Interpotential
[mailto:[EMAIL PROTECTED]
Sent: quinta-feira, 30 de agosto de 2007 14:44
To: Per Jessen
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Reload page after form submit


On 30/08/2007, Per Jessen <[EMAIL PROTECTED]> wrote:
>
> Wagner Garcia Campagner wrote:
>
> > Hello,
> >
> > I'm building a web page just like a blog...
> >
> > Where the user input some information... (name, website and comment)
> >
> > This information is stored in a file...
> >
> > And then the page displays it...
> >
> > When the user access the page the first time, the information is
> > displayed correct...
> >
> > After the user submit the information, the page become outdated...
> > without this last information the user submitted...
> >
> > Is there a way to tell PHP to reload the page after the user submit
> > the information, so the page is always updated??
>
> After you've processed the POST request, you finish with something like
> this:
>
> header("HTTP/1.0 303 See other");
> header("Location: #");
> exit;


It needs a little bit more than that. The script to which the form has been
submitted knows about the $_POST data, once you Location: to another page
that gets forgotten. Just add a line like $_SESSION['lastFormSubmit'] =
$_POST just before the first header() call and you're fine.






-- 
Interpotential.com
Phone: +31615397471

--- End Message ---
--- Begin Message ---
Wagner Garcia Campagner wrote:
Thanks a lot,

I tried both suggestions, but it didn't work...

I did it send an Echo with this string:

<META HTTP-EQUIV='refresh' content='0;URL=index.php'>

After processing the form... it worked...

Is there any problem doing this?

You'd be better off with...

header('Location: index.php');

Although technically speaking that should be an absolute URL.

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message ---
From: "Wagner Garcia Campagner" <[EMAIL PROTECTED]>

Hello,

I'm building a web page just like a blog...

Where the user input some information... (name, website and comment)

This information is stored in a file...

And then the page displays it...

When the user access the page the first time, the information is displayed
correct...

After the user submit the information, the page become outdated... without
this last information the user submitted...

Is there a way to tell PHP to reload the page after the user submit the
information, so the page is always updated??

Thanks in advance,
Wagner.

I don't get your fundamental problem. When a user submits a form, the page handling the submission (the PHP script) decides what next to display. Can't you have it display the updated information?

From your subject, I was thinking "xajax". But isn't this basic form
handling?

_________________________________________________________________
A new home for Mom, no cleanup required. All starts here. http://www.reallivemoms.com?ocid=TXT_TAGHM&loc=us
--- End Message ---
--- Begin Message ---
From: "Wagner Garcia Campagner" <[EMAIL PROTECTED]>
Is there a way to tell PHP to reload the page after the user submit the
information, so the page is always updated??

Thanks in advance,
Wagner.

I don't get your fundamental problem. When a user submits a form, the page handling the submission (the PHP script) decides what next to display. Can't you have it display the updated information?

From your subject, I was thinking "xajax". But isn't this basic form handling?

Do you mean User1 submits a change, and you want User1, User2 and UserN to see the new information? Then I could see scheduling a refresh.

_________________________________________________________________
Booking a flight? Know when to buy with airfare predictions on MSN Travel. http://travel.msn.com/Articles/aboutfarecast.aspx&ocid=T001MSN25A07001
--- End Message ---
--- Begin Message ---
rough code, to give you an idea:

<?php
if (isset($_POST))
{
   # after validation
   $first = $_POST['firs'];
   $last = $_POST['last'];
   mysql_query("
           insert into table
           (first, last)
           values
('".mysql_real_escape_string($first)."', '".mysql_real_escape_string($last)."')
       ");
}
else
{
   $query = mysql_query("
           select first, last
           from table
           where id=xyz
       ");
   $result = mysql_fetch_array($query, MYSQL_ASSOC);
   $first = $result['first'];
   $last = $result['last'];
}
?>

<form method="POST" action="<?= $_SERVER['PHP_SELF'] ?>">
First: <input type="text" name="first" value="<?= $first ?>"><br>
Last: <input type="text" name="last" value="<?= $last ?>"><br>
<input type="submit" value="submit">
</form>


-afan




From: "Wagner Garcia Campagner" <[EMAIL PROTECTED]>

Hello,

I'm building a web page just like a blog...

Where the user input some information... (name, website and comment)

This information is stored in a file...

And then the page displays it...

When the user access the page the first time, the information is displayed
correct...

After the user submit the information, the page become outdated... without
this last information the user submitted...

Is there a way to tell PHP to reload the page after the user submit the
information, so the page is always updated??

Thanks in advance,
Wagner.

--- End Message ---
--- Begin Message ---
From: Afan Pasalic <[EMAIL PROTECTED]>

rough code, to give you an idea:

<?php
if (isset($_POST))
{
   # after validation
   $first = $_POST['firs'];
   $last = $_POST['last'];
   mysql_query("
           insert into table
           (first, last)
           values
('".mysql_real_escape_string($first)."', '".mysql_real_escape_string($last)."')
       ");
}
else
{
   $query = mysql_query("
           select first, last
           from table
           where id=xyz
       ");
   $result = mysql_fetch_array($query, MYSQL_ASSOC);
   $first = $result['first'];
   $last = $result['last'];
}
?>

<form method="POST" action="<?= $_SERVER['PHP_SELF'] ?>">
First: <input type="text" name="first" value="<?= $first ?>"><br>
Last: <input type="text" name="last" value="<?= $last ?>"><br>
<input type="submit" value="submit">
</form>


-afan

Afan,
From your rough code, I'd say the OP always needs the select block (just
remove the "else" keyword and keep the block) for the current info at the present page refresh/load. But I'd like clarification on how the OP thinks about it.

_________________________________________________________________
A new home for Mom, no cleanup required. All starts here. http://www.reallivemoms.com?ocid=TXT_TAGHM&loc=us
--- End Message ---
--- Begin Message ---
Stut wrote:
Wagner Garcia Campagner wrote:

<META HTTP-EQUIV='refresh' content='0;URL=index.php'>

header('Location: index.php');

Although technically speaking that should be an absolute URL.

AFAIK, they are both equivalent.

--
 21:50:04 up 2 days,  9:07,  0 users,  load average: 0.92, 0.37, 0.18
---------------------------------------------------------
Lic. Martín Marqués         |   SELECT 'mmarques' ||
Centro de Telemática        |       '@' || 'unl.edu.ar';
Universidad Nacional        |   DBA, Programador,
    del Litoral             |   Administrador
---------------------------------------------------------

--- End Message ---
--- Begin Message ---
Martin Marques wrote:
Stut wrote:
Wagner Garcia Campagner wrote:

<META HTTP-EQUIV='refresh' content='0;URL=index.php'>

header('Location: index.php');

Although technically speaking that should be an absolute URL.

AFAIK, they are both equivalent.

Essentially yes, but personally (and for no logical reason I can think of) I always prefer headers over HTML content, especially when any other HTML content in the page will not be seen.

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message ---
From: Martin Marques <[EMAIL PROTECTED]>
Stut wrote:
Wagner Garcia Campagner wrote:

<META HTTP-EQUIV='refresh' content='0;URL=index.php'>

header('Location: index.php');

Although technically speaking that should be an absolute URL.

AFAIK, they are both equivalent.

Ahhh, if the OP meant, "Load a different page after doing some form processing in the current PHP page", then just go with the PHP "header" function. The HTML META HTTP-EQUIV='refresh' would require the HTML be rendered first. The PHP "header" would be slightly faster, and you are already in the PHP script.

I'm like, "How is the page becoming outdated? You are not still on that page -- it's gone. The next page display will gather the latest info."

_________________________________________________________________
A new home for Mom, no cleanup required. All starts here. http://www.reallivemoms.com?ocid=TXT_TAGHM&loc=us
--- End Message ---
--- Begin Message --- I am attempting to compile PHP 5.2.3 and am having trouble with the configuration step:

configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.

I cannot figure this one out. Any help would be appreciated.

I am using MacPorts (http://www.macports.org/ - same idea as Fink) to obtain various packages I need and am running MacOSX 10.4.10.

To what configuration option does this belong? If it belongs to something I don't really need, I'll just turn the option off.

What MacPort would I need to install? I could even install something via Fink, if wha tI need is not available via MacPorts.

My configure line currently is:


./configure --prefix=/mine/local/php5 --with-apxs2=/opt/local/apache2/ bin/apxs --with-config-file-scan-dir=/mine/local/php5/php.d --with- iconv-dir=/opt/local --with-iconv --with-openssl=/opt/local --with- zlib=/opt/local --with-gd=/opt/local --with-zlib-dir=/opt/local -- with-ldap --with-xmlrpc --with-snmp=/opt/local --enable-sqlite-utf8 -- enable-exif --enable-wddx --enable-soap --with-sqlite=/opt/local -- enable-ftp --enable-sockets --enable-dbx --enable-dbase --enable- mbstring --enable-calendar --enable-bcmath --with-bz2=/opt/local -- enable-memory-limit --with-curl=shared,/mine/local/php5 --with- mysql=shared,/mine/local/php5 --with-mysqli=shared,/mine/local/php5/ bin/mysql_config --with-pdo-mysql=shared,/mine/local/php5 --with- libxml-dir=shared,/mine/local/php5 --with-xsl=shared,/mine/local/php5 --with-pdflib=shared,/mine/local/php5 --with-imap=../imap-2004g -- with-kerberos=/opt/local --with-imap-ssl=/opt/local --with-jpeg-dir=/ mine/local/php5 --with-png-dir=/mine/local/php5 --enable-gd-native- ttf --with-freetype-dir=/opt/local --with-iodbc=shared,/opt/local -- with-pgsql=shared,/mine/local/php5 --with-pdo-pgsql=shared,/mine/ local/php5 --with-t1lib=/opt/local --with-gettext=shared,/mine/local/ php5 --with-ming=shared,/mine/local/php5 --with-mcrypt=shared,/mine/ local/php5 --with-mhash=shared,/mine/local/php5 --with-mssql=shared,/ mine/local/php5 --with-json=shared --enable-memcache --with-xpm-dir=/ opt --with-readline=/opt --enable-openbase_module

I'm sure there are still problems with it that I am slowly working through...I basically copied the one from http://www.entropy.ch/ software/macosx/php/ since I know that installation of PHP has worked for me in the past.
--- End Message ---
--- Begin Message --- I was able to get past the configure problem. It was apparently associated with the --with-imap option and I don't need imap support.

In any case, I got to the make test and got the following failures:

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Bug #30638 (localeconv returns wrong LC_NUMERIC settings) (ok to fail on MacOS X) [tests/lang/bug30638.phpt] imagecreatefromwbmp with invalid wbmp [ext/gd/tests/ createfromwbmp2.phpt]
Sort with SORT_LOCALE_STRING [ext/standard/tests/array/locale_sort.phpt]
Test gettype() & settype() functions : usage variations [ext/standard/ tests/general_functions/gettype_settype_variation2.phpt] htmlentities() test 2 (setlocale / fr_FR.ISO-8859-15) [ext/standard/ tests/strings/htmlentities02.phpt] (warn: possibly braindead libc) htmlentities() test 4 (setlocale / ja_JP.EUC-JP) [ext/standard/tests/ strings/htmlentities04.phpt] htmlentities() test 15 (setlocale / KOI8-R) [ext/standard/tests/ strings/htmlentities15.phpt]
Generic pack()/unpack() tests [ext/standard/tests/strings/pack.phpt]
=====================================================================


Are these failures expected?


On Aug 30, 2007, at 2:43 PM, Eric Gorr wrote:

I am attempting to compile PHP 5.2.3 and am having trouble with the configuration step:

configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.

I cannot figure this one out. Any help would be appreciated.

I am using MacPorts (http://www.macports.org/ - same idea as Fink) to obtain various packages I need and am running MacOSX 10.4.10.

To what configuration option does this belong? If it belongs to something I don't really need, I'll just turn the option off.

What MacPort would I need to install? I could even install something via Fink, if wha tI need is not available via MacPorts.

My configure line currently is:


./configure --prefix=/mine/local/php5 --with-apxs2=/opt/local/ apache2/bin/apxs --with-config-file-scan-dir=/mine/local/php5/php.d --with-iconv-dir=/opt/local --with-iconv --with-openssl=/opt/local --with-zlib=/opt/local --with-gd=/opt/local --with-zlib-dir=/opt/ local --with-ldap --with-xmlrpc --with-snmp=/opt/local --enable- sqlite-utf8 --enable-exif --enable-wddx --enable-soap --with- sqlite=/opt/local --enable-ftp --enable-sockets --enable-dbx -- enable-dbase --enable-mbstring --enable-calendar --enable-bcmath -- with-bz2=/opt/local --enable-memory-limit --with-curl=shared,/mine/ local/php5 --with-mysql=shared,/mine/local/php5 --with- mysqli=shared,/mine/local/php5/bin/mysql_config --with-pdo- mysql=shared,/mine/local/php5 --with-libxml-dir=shared,/mine/local/ php5 --with-xsl=shared,/mine/local/php5 --with-pdflib=shared,/mine/ local/php5 --with-imap=../imap-2004g --with-kerberos=/opt/local -- with-imap-ssl=/opt/local --with-jpeg-dir=/mine/local/php5 --with- png-dir=/mine/local/php5 --enable-gd-native-ttf --with-freetype- dir=/opt/local --with-iodbc=shared,/opt/local --with-pgsql=shared,/ mine/local/php5 --with-pdo-pgsql=shared,/mine/local/php5 --with- t1lib=/opt/local --with-gettext=shared,/mine/local/php5 --with- ming=shared,/mine/local/php5 --with-mcrypt=shared,/mine/local/php5 --with-mhash=shared,/mine/local/php5 --with-mssql=shared,/mine/ local/php5 --with-json=shared --enable-memcache --with-xpm-dir=/opt --with-readline=/opt --enable-openbase_module

I'm sure there are still problems with it that I am slowly working through...I basically copied the one from http://www.entropy.ch/ software/macosx/php/ since I know that installation of PHP has worked for me in the past.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
Here are some cache things we do for IE...


// workaround for IE bug that prevents downloading files from an httpS site
// (see http://support.microsoft.com/default.aspx?scid=kb;en-us;316431 )
session_cache_limiter('public');


// This ensures that most browsers known to human beings won't try to cache
the page.
// Proxy caching is, I believe, somewhat addressed by the cache-control, but

// additional directives exist should that ever become a concern.
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");    // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always
modified
header("Cache-Control: no-store, no-cache, must-revalidate");  // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");                          // HTTP/1.0

--- End Message ---
--- Begin Message ---
Hello,

 

I'm trying to move some app from postgresql to mysql but unable to find out
how to authenticate

against the current crypted passwords with php..

 

insert to database:

 

$cset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
$salt = substr($cset, time() & 63, 1) . substr($cset, time()/64 & 63, 1);
$password = crypt($password, $salt);   //pass crypted version of password
for further processing



$result = pg_query ("INSERT INTO users (username, password) VALUES
('$username', '$password')");

 

I read the crypt is one way encryption but how to compare the password
entered with the encrypted 

version if don't know the salt ??

 

 

Thanks,

 

Andras


--- End Message ---
--- Begin Message --- No chance. Unless you have the salt stored along each password, your passwords are as good as random texts

Satyam



----- Original Message ----- From: "Andras Kende" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 30, 2007 11:42 PM
Subject: [PHP] crypt salt question


Hello,



I'm trying to move some app from postgresql to mysql but unable to find out
how to authenticate

against the current crypted passwords with php..



insert to database:



$cset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
$salt = substr($cset, time() & 63, 1) . substr($cset, time()/64 & 63, 1);
$password = crypt($password, $salt);   //pass crypted version of password
for further processing



$result = pg_query ("INSERT INTO users (username, password) VALUES
('$username', '$password')");



I read the crypt is one way encryption but how to compare the password
entered with the encrypted

version if don't know the salt ??





Thanks,



Andras




--------------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.484 / Virus Database: 269.12.12/979 - Release Date: 29/08/2007 20:21
--- End Message ---
--- Begin Message ---
Hi!

How did you do the comparison with the PG_SQL database?? I believe there is
a UNIX function, able to retrieve the salt from a crypt string, or one that
can do the comparison, without a slat given. But I'm not quite sure. I'm
gonna investigate that. But how did you compare passwords before, when using
a time based "random" salt? I understand you use the CRYPT_STD_DES method
... 

Greets,
 Jan

-----Original Message-----
From: Andras Kende [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 30, 2007 11:42 PM
To: [EMAIL PROTECTED]
Subject: [PHP] crypt salt question

Hello,

 

I'm trying to move some app from postgresql to mysql but unable to find out
how to authenticate

against the current crypted passwords with php..

 

insert to database:

 

$cset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
$salt = substr($cset, time() & 63, 1) . substr($cset, time()/64 & 63, 1);
$password = crypt($password, $salt);   //pass crypted version of password
for further processing



$result = pg_query ("INSERT INTO users (username, password) VALUES
('$username', '$password')");

 

I read the crypt is one way encryption but how to compare the password
entered with the encrypted 

version if don't know the salt ??

 

 

Thanks,

 

Andras

--- End Message ---
--- Begin Message ---
No, I'm sorry, I spoke out that thought to early!! At the university we used
a PG_SQL database to store the passwords, and used the LDAP tree with all
the user information and stuff to store the salt as well! 

How do your scripts operate on that with the PG_SQL database before
migrating to mysql ...

Greets, 
 Jan

-----Original Message-----
From: Jan Reiter [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 31, 2007 12:07 AM
To: 'Andras Kende'; PHP Mailing List
Subject: RE: [PHP] crypt salt question

Hi!

How did you do the comparison with the PG_SQL database?? I believe there is
a UNIX function, able to retrieve the salt from a crypt string, or one that
can do the comparison, without a slat given. But I'm not quite sure. I'm
gonna investigate that. But how did you compare passwords before, when using
a time based "random" salt? I understand you use the CRYPT_STD_DES method
... 

Greets,
 Jan

-----Original Message-----
From: Andras Kende [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 30, 2007 11:42 PM
To: [EMAIL PROTECTED]
Subject: [PHP] crypt salt question

Hello,

 

I'm trying to move some app from postgresql to mysql but unable to find out
how to authenticate

against the current crypted passwords with php..

 

insert to database:

 

$cset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
$salt = substr($cset, time() & 63, 1) . substr($cset, time()/64 & 63, 1);
$password = crypt($password, $salt);   //pass crypted version of password
for further processing



$result = pg_query ("INSERT INTO users (username, password) VALUES
('$username', '$password')");

 

I read the crypt is one way encryption but how to compare the password
entered with the encrypted 

version if don't know the salt ??

 

 

Thanks,

 

Andras

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
I figured out finally:)
Actually the random salt is always the first 2 character of the encryoted
password,
so this works fine now :


<?php
// "username","saltencryptedpass"
// "sean","VK3bOV.yYuXfw"

$cryptpass = "VK3bOV.yYuXfw";

$password = $_GET[p];
$salt = substr($cryptpass, 0, 2);  

if (crypt($_GET['p'], $salt) == $cryptpass) {
  echo "Password verified!";
   }
?>


Thanks,

Andras



-----Original Message-----
From: Satyam [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 30, 2007 3:00 PM
To: Andras Kende; [EMAIL PROTECTED]
Subject: Re: [PHP] crypt salt question

No chance.  Unless you have the salt stored along each password, your 
passwords are as good as random texts

Satyam



----- Original Message ----- 
From: "Andras Kende" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 30, 2007 11:42 PM
Subject: [PHP] crypt salt question


> Hello,
>
>
>
> I'm trying to move some app from postgresql to mysql but unable to find 
> out
> how to authenticate
>
> against the current crypted passwords with php..
>
>
>
> insert to database:
>
>
>
> $cset = 
> "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
> $salt = substr($cset, time() & 63, 1) . substr($cset, time()/64 & 63, 1);
> $password = crypt($password, $salt);   //pass crypted version of password
> for further processing
>
>
>
> $result = pg_query ("INSERT INTO users (username, password) VALUES
> ('$username', '$password')");
>
>
>
> I read the crypt is one way encryption but how to compare the password
> entered with the encrypted
>
> version if don't know the salt ??
>
>
>
>
>
> Thanks,
>
>
>
> Andras
>
>


----------------------------------------------------------------------------
----


No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.484 / Virus Database: 269.12.12/979 - Release Date: 29/08/2007 
20:21

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Hello,
         You can DATE_FORMAT MySQL Command in your SQL Query. For example:
select DATE_FORMAT(yourdatetimefield,'%Y-%m-%d') from yourtable

-- 
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

""Mike Ryan"" <[EMAIL PROTECTED]>, haber iletisinde þunlarý 
yazdý:[EMAIL PROTECTED]
>I would like to have my users input the date formate as mm-dd-yyyy mysql
> wants the data to come down as yyyy-mm-dd.
>
> The question I have is how do I convert from the mm-dd-yyyy to yyyy-mm-dd 
> so
> that I can write it out to the database? 

--- End Message ---

Reply via email to