Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

OT: More about unique random passwords

LEGEND ,
Oct 03, 2006 Oct 03, 2006
I have a master list of passwords in a MySQL table.

I want to generate a new random password that is unique.

I am using this markup -

$passwords=array();
$rsPasswordList = mysql_query("SELECT contactPassword FROM
tblcontactdata",$selectData)
or die(mysql_errno()." : ".mysql_error());
for ($j=0; $rec=mysql_fetch_array($rsPasswordList); $j++){
$passwords[]=$rec;
}
$unique='false';
for ($i=0; $unique!='false'; $i++) {
$temp = randomkeys(8); // this is generating a random 8-character p/w
if(!array_key_exists($temp, $passwords)) {
$newPassword = $temp;
}
}

I want to make sure that this is going to produce a unique password. Can
you evaluate that for me, please?

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================



TOPICS
Server side applications
1.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 03, 2006 Oct 03, 2006

> I want to make sure that this is going to produce a unique password. Can
> you evaluate that for me, please?

Create the password, then query the DB using said password and see if it
returns a match. If not, it's unique.

-Darrel


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 03, 2006 Oct 03, 2006
A bit OT, but do you typically create your own select statements instead of
using the Recordsets from DW?

I've been trying to use the recordsets, but I find them increasingly awkward
for complex SQL. I'd like to still use them, though, for "maintainability"
of my sites (ie, I would like to say they're made with DW pieces).


"Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
news:eftqhk$4cd$1@forums.macromedia.com...
>I have a master list of passwords in a MySQL table.
>
> I want to generate a new random password that is unique.
>
> I am using this markup -
>
> $passwords=array();
> $rsPasswordList = mysql_query("SELECT contactPassword FROM
> tblcontactdata",$selectData)
> or die(mysql_errno()." : ".mysql_error());
> for ($j=0; $rec=mysql_fetch_array($rsPasswordList); $j++){
> $passwords[]=$rec;
> }
> $unique='false';
> for ($i=0; $unique!='false'; $i++) {
> $temp = randomkeys(8); // this is generating a random 8-character p/w
> if(!array_key_exists($temp, $passwords)) {
> $newPassword = $temp;
> }
> }
>
> I want to make sure that this is going to produce a unique password. Can
> you evaluate that for me, please?
>
> --
> Murray --- ICQ 71997575
> Adobe Community Expert
> (If you *MUST* email me, don't LAUGH when you do so!)
> ==================
> http://www.dreamweavermx-templates.com - Template Triage!
> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
> ==================
>
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 03, 2006 Oct 03, 2006
That's basically what I'm doing - except I am using an array function.

I just wanted to make sure that my implementation of it would verify
uniqueness.

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"darrel" <notreal@nowhere.com> wrote in message
news:eftrmm$5vj$1@forums.macromedia.com...
>
>> I want to make sure that this is going to produce a unique password. Can
>> you evaluate that for me, please?
>
> Create the password, then query the DB using said password and see if it
> returns a match. If not, it's unique.
>
> -Darrel
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 03, 2006 Oct 03, 2006
>A bit OT, but do you typically create your own select statements instead of
>using the Recordsets from DW?

Lately I have been - it's much easier to do it this way. But you eliminate
the Bindings panel when you do that.

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"crash" <crash@bcdcdigital.com> wrote in message
news:efu5po$i7f$1@forums.macromedia.com...
>A bit OT, but do you typically create your own select statements instead of
>using the Recordsets from DW?
>
> I've been trying to use the recordsets, but I find them increasingly
> awkward for complex SQL. I'd like to still use them, though, for
> "maintainability" of my sites (ie, I would like to say they're made with
> DW pieces).
>
>
> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
> news:eftqhk$4cd$1@forums.macromedia.com...
>>I have a master list of passwords in a MySQL table.
>>
>> I want to generate a new random password that is unique.
>>
>> I am using this markup -
>>
>> $passwords=array();
>> $rsPasswordList = mysql_query("SELECT contactPassword FROM
>> tblcontactdata",$selectData)
>> or die(mysql_errno()." : ".mysql_error());
>> for ($j=0; $rec=mysql_fetch_array($rsPasswordList); $j++){
>> $passwords[]=$rec;
>> }
>> $unique='false';
>> for ($i=0; $unique!='false'; $i++) {
>> $temp = randomkeys(8); // this is generating a random 8-character p/w
>> if(!array_key_exists($temp, $passwords)) {
>> $newPassword = $temp;
>> }
>> }
>>
>> I want to make sure that this is going to produce a unique password. Can
>> you evaluate that for me, please?
>>
>> --
>> Murray --- ICQ 71997575
>> Adobe Community Expert
>> (If you *MUST* email me, don't LAUGH when you do so!)
>> ==================
>> http://www.dreamweavermx-templates.com - Template Triage!
>> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
>> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
>> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
>> ==================
>>
>>
>>
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 03, 2006 Oct 03, 2006
I know, and, what's worse, is your server behaviors. Those are about the
only thing I use DW for, and the best part of taking over or handing over a
DW created site - you don't have to dig through custom code to see how data
is being parsed.

Is there any solution to that?

Thanks,

Jon
"Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
news:efu6pf$jaq$1@forums.macromedia.com...
> >A bit OT, but do you typically create your own select statements instead
> >of using the Recordsets from DW?
>
> Lately I have been - it's much easier to do it this way. But you
> eliminate the Bindings panel when you do that.
>
> --
> Murray --- ICQ 71997575
> Adobe Community Expert
> (If you *MUST* email me, don't LAUGH when you do so!)
> ==================
> http://www.dreamweavermx-templates.com - Template Triage!
> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
> ==================
>
>
> "crash" <crash@bcdcdigital.com> wrote in message
> news:efu5po$i7f$1@forums.macromedia.com...
>>A bit OT, but do you typically create your own select statements instead
>>of using the Recordsets from DW?
>>
>> I've been trying to use the recordsets, but I find them increasingly
>> awkward for complex SQL. I'd like to still use them, though, for
>> "maintainability" of my sites (ie, I would like to say they're made with
>> DW pieces).
>>
>>
>> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
>> news:eftqhk$4cd$1@forums.macromedia.com...
>>>I have a master list of passwords in a MySQL table.
>>>
>>> I want to generate a new random password that is unique.
>>>
>>> I am using this markup -
>>>
>>> $passwords=array();
>>> $rsPasswordList = mysql_query("SELECT contactPassword FROM
>>> tblcontactdata",$selectData)
>>> or die(mysql_errno()." : ".mysql_error());
>>> for ($j=0; $rec=mysql_fetch_array($rsPasswordList); $j++){
>>> $passwords[]=$rec;
>>> }
>>> $unique='false';
>>> for ($i=0; $unique!='false'; $i++) {
>>> $temp = randomkeys(8); // this is generating a random 8-character p/w
>>> if(!array_key_exists($temp, $passwords)) {
>>> $newPassword = $temp;
>>> }
>>> }
>>>
>>> I want to make sure that this is going to produce a unique password.
>>> Can you evaluate that for me, please?
>>>
>>> --
>>> Murray --- ICQ 71997575
>>> Adobe Community Expert
>>> (If you *MUST* email me, don't LAUGH when you do so!)
>>> ==================
>>> http://www.dreamweavermx-templates.com - Template Triage!
>>> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
>>> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
>>> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
>>> ==================
>>>
>>>
>>>
>>
>>
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 03, 2006 Oct 03, 2006
I don't think so - other than voluminous commenting.

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"crash" <crash@bcdcdigital.com> wrote in message
news:efu77o$jsu$1@forums.macromedia.com...
>I know, and, what's worse, is your server behaviors. Those are about the
>only thing I use DW for, and the best part of taking over or handing over a
>DW created site - you don't have to dig through custom code to see how data
>is being parsed.
>
> Is there any solution to that?
>
> Thanks,
>
> Jon
> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
> news:efu6pf$jaq$1@forums.macromedia.com...
>> >A bit OT, but do you typically create your own select statements instead
>> >of using the Recordsets from DW?
>>
>> Lately I have been - it's much easier to do it this way. But you
>> eliminate the Bindings panel when you do that.
>>
>> --
>> Murray --- ICQ 71997575
>> Adobe Community Expert
>> (If you *MUST* email me, don't LAUGH when you do so!)
>> ==================
>> http://www.dreamweavermx-templates.com - Template Triage!
>> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
>> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
>> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
>> ==================
>>
>>
>> "crash" <crash@bcdcdigital.com> wrote in message
>> news:efu5po$i7f$1@forums.macromedia.com...
>>>A bit OT, but do you typically create your own select statements instead
>>>of using the Recordsets from DW?
>>>
>>> I've been trying to use the recordsets, but I find them increasingly
>>> awkward for complex SQL. I'd like to still use them, though, for
>>> "maintainability" of my sites (ie, I would like to say they're made with
>>> DW pieces).
>>>
>>>
>>> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
>>> news:eftqhk$4cd$1@forums.macromedia.com...
>>>>I have a master list of passwords in a MySQL table.
>>>>
>>>> I want to generate a new random password that is unique.
>>>>
>>>> I am using this markup -
>>>>
>>>> $passwords=array();
>>>> $rsPasswordList = mysql_query("SELECT contactPassword FROM
>>>> tblcontactdata",$selectData)
>>>> or die(mysql_errno()." : ".mysql_error());
>>>> for ($j=0; $rec=mysql_fetch_array($rsPasswordList); $j++){
>>>> $passwords[]=$rec;
>>>> }
>>>> $unique='false';
>>>> for ($i=0; $unique!='false'; $i++) {
>>>> $temp = randomkeys(8); // this is generating a random 8-character p/w
>>>> if(!array_key_exists($temp, $passwords)) {
>>>> $newPassword = $temp;
>>>> }
>>>> }
>>>>
>>>> I want to make sure that this is going to produce a unique password.
>>>> Can you evaluate that for me, please?
>>>>
>>>> --
>>>> Murray --- ICQ 71997575
>>>> Adobe Community Expert
>>>> (If you *MUST* email me, don't LAUGH when you do so!)
>>>> ==================
>>>> http://www.dreamweavermx-templates.com - Template Triage!
>>>> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
>>>> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
>>>> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
>>>> ==================
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 03, 2006 Oct 03, 2006
which is great because communicating verbally is SO my strong suit....

;o)

>I don't think so - other than voluminous commenting.
>
> --
> Murray --- ICQ 71997575


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 03, 2006 Oct 03, 2006
We've noticed....

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"crash" <crash@bcdcdigital.com> wrote in message
news:efu9rn$muq$1@forums.macromedia.com...
> which is great because communicating verbally is SO my strong suit....
>
> ;o)
>
>>I don't think so - other than voluminous commenting.
>>
>> --
>> Murray --- ICQ 71997575
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 03, 2006 Oct 03, 2006
Murray *ACE* wrote:
> I want to make sure that this is going to produce a unique password. Can
> you evaluate that for me, please?

It won't work. You have several mistakes in there, the most important
ones being the use of quotes around false, which is a keyword (see page
138 of "Foundation PHP for DW 8" which I know you've got). Another
mistake is you're using mysql_fetch_array() to extract the database
results. Consequently, $rec will always be a two item array containing
the result both as an indexed array element and as an associative array
element. The actual password is held in $rec[0] and
$rec['contactPassword']. Also, you're using array_key_exists to check
the passwords, but the array keys will be 0, 1, 2, 3, etc. In effect,
$passwords will look like this:

$passwords[0] = array(0 => 12345678, 'contactPassword' => 12345678);
$passwords[1] = array(0 => 87654321, 'contactPassword' => 87654321);
and so on.

Finally, and perhaps most crucially, you never set $unique to true once
a unique password has been generated.

You need to rewrite it like this:

$passwords=array();
$rsPasswordList = mysql_query("SELECT contactPassword FROM
tblcontactdata",$selectData)
or die(mysql_errno()." : ".mysql_error());
while ($rec = mysql_fetch_row($rsPasswordList)){
$passwords[] = $rec[0];
}
$unique = false;
while ($unique === false) {
$temp = randomkeys(8); // this is generating a random 8-character p/w
if(!in_array($temp, $passwords)) {
$newPassword = $temp;
$unique = true;
}
}

I assume that randomkeys() is a custom function defined elsewhere.

--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 03, 2006 Oct 03, 2006
In the meantime, while I was waiting for the cavalry to arrive, I had found
and fixed some of those errors. Yeah, that's the ticket! 8)

Thanks, David....

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"David Powers" <david@example.com> wrote in message
news:efubo8$p28$1@forums.macromedia.com...
> Murray *ACE* wrote:
>> I want to make sure that this is going to produce a unique password. Can
>> you evaluate that for me, please?
>
> It won't work. You have several mistakes in there, the most important ones
> being the use of quotes around false, which is a keyword (see page 138 of
> "Foundation PHP for DW 8" which I know you've got). Another mistake is
> you're using mysql_fetch_array() to extract the database results.
> Consequently, $rec will always be a two item array containing the result
> both as an indexed array element and as an associative array element. The
> actual password is held in $rec[0] and $rec['contactPassword']. Also,
> you're using array_key_exists to check the passwords, but the array keys
> will be 0, 1, 2, 3, etc. In effect, $passwords will look like this:
>
> $passwords[0] = array(0 => 12345678, 'contactPassword' => 12345678);
> $passwords[1] = array(0 => 87654321, 'contactPassword' => 87654321);
> and so on.
>
> Finally, and perhaps most crucially, you never set $unique to true once a
> unique password has been generated.
>
> You need to rewrite it like this:
>
> $passwords=array();
> $rsPasswordList = mysql_query("SELECT contactPassword FROM
> tblcontactdata",$selectData)
> or die(mysql_errno()." : ".mysql_error());
> while ($rec = mysql_fetch_row($rsPasswordList)){
> $passwords[] = $rec[0];
> }
> $unique = false;
> while ($unique === false) {
> $temp = randomkeys(8); // this is generating a random 8-character p/w
> if(!in_array($temp, $passwords)) {
> $newPassword = $temp;
> $unique = true;
> }
> }
>
> I assume that randomkeys() is a custom function defined elsewhere.
>
> --
> David Powers
> Adobe Community Expert
> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
> http://foundationphp.com/


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 03, 2006 Oct 03, 2006
> Consequently, $rec will always be a two item array containing the result
> both as an indexed array element and as an associative array element. The
> actual password is held in $rec[0] and $rec['contactPassword']. Also,
> you're using array_key_exists to check the passwords, but the array keys
> will be 0, 1, 2, 3, etc. In effect, $passwords will look like this:
>
> $passwords[0] = array(0 => 12345678, 'contactPassword' => 12345678);
> $passwords[1] = array(0 => 87654321, 'contactPassword' => 87654321);
> and so on.

Hmm - so, should I not use this approach, then? What would be a better
method?

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"David Powers" <david@example.com> wrote in message
news:efubo8$p28$1@forums.macromedia.com...
> Murray *ACE* wrote:
>> I want to make sure that this is going to produce a unique password. Can
>> you evaluate that for me, please?
>
> It won't work. You have several mistakes in there, the most important ones
> being the use of quotes around false, which is a keyword (see page 138 of
> "Foundation PHP for DW 8" which I know you've got). Another mistake is
> you're using mysql_fetch_array() to extract the database results.
> Consequently, $rec will always be a two item array containing the result
> both as an indexed array element and as an associative array element. The
> actual password is held in $rec[0] and $rec['contactPassword']. Also,
> you're using array_key_exists to check the passwords, but the array keys
> will be 0, 1, 2, 3, etc. In effect, $passwords will look like this:
>
> $passwords[0] = array(0 => 12345678, 'contactPassword' => 12345678);
> $passwords[1] = array(0 => 87654321, 'contactPassword' => 87654321);
> and so on.
>
> Finally, and perhaps most crucially, you never set $unique to true once a
> unique password has been generated.
>
> You need to rewrite it like this:
>
> $passwords=array();
> $rsPasswordList = mysql_query("SELECT contactPassword FROM
> tblcontactdata",$selectData)
> or die(mysql_errno()." : ".mysql_error());
> while ($rec = mysql_fetch_row($rsPasswordList)){
> $passwords[] = $rec[0];
> }
> $unique = false;
> while ($unique === false) {
> $temp = randomkeys(8); // this is generating a random 8-character p/w
> if(!in_array($temp, $passwords)) {
> $newPassword = $temp;
> $unique = true;
> }
> }
>
> I assume that randomkeys() is a custom function defined elsewhere.
>
> --
> David Powers
> Adobe Community Expert
> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
> http://foundationphp.com/


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 03, 2006 Oct 03, 2006

> That's basically what I'm doing - except I am using an array function.

Why are you using an array?

-Darrel



Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 03, 2006 Oct 03, 2006
Murray *ACE* wrote:
> Hmm - so, should I not use this approach, then? What would be a better
> method?

The one I gave you. Read the code carefully. It has some important, but
subtle differences.

--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 03, 2006 Oct 03, 2006
Yes - have implemented them. Thanks, David!

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"David Powers" <david@example.com> wrote in message
news:efumg7$8ci$2@forums.macromedia.com...
> Murray *ACE* wrote:
>> Hmm - so, should I not use this approach, then? What would be a better
>> method?
>
> The one I gave you. Read the code carefully. It has some important, but
> subtle differences.
>
> --
> David Powers
> Adobe Community Expert
> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
> http://foundationphp.com/


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 03, 2006 Oct 03, 2006
Because I like them! 8)

Convince me otherwise, please.

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"darrel" <notreal@nowhere.com> wrote in message
news:efulp1$7o3$1@forums.macromedia.com...
>
>> That's basically what I'm doing - except I am using an array function.
>
> Why are you using an array?
>
> -Darrel
>
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 04, 2006 Oct 04, 2006
"Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
news:efup4c$bga$1@forums.macromedia.com...
> Yes - have implemented them. Thanks, David!

The code looks fine, but as a practical matter why are you reading sensitive
passwords into a web page when you can query the database to see if you have
a match?

Tom


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 04, 2006 Oct 04, 2006
Tom Muck wrote:
> The code looks fine, but as a practical matter why are you reading sensitive
> passwords into a web page when you can query the database to see if you have
> a match?

Unless the array of passwords is displayed somewhere in the page,
everything should remain on the server. I presume that Murray's logic --
now there's an oxymoron for you 😉 -- is that getting an array of
existing passwords makes just one database call, whereas querying for a
match could result in multiple calls. If the random generator is random
enough, it's probably more efficient to query the database to see if
there's a match. I was simply answering the question "Will this work?"
With Murray's original code, the answer was "No!".

--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 04, 2006 Oct 04, 2006
> Because I like them! 8)
>
> Convince me otherwise, please.

What are you storing in the array?

What I'd do:

- grab the pwd
- query the db to see if it exists
- if not, save it.

I don't see why an array is needed. But maybe I'm missing something.

-Darrel


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 04, 2006 Oct 04, 2006
darrel wrote:
> I don't see why an array is needed. But maybe I'm missing something.

I don't know exactly what Murray is doing, but it's a question of swings
and roundabouts. By gathering all existing passwords in an array, only
one call to the database is required. On the other hand, if you do it
the other way round, you need to query the database for each new
password. With a small number of registered passwords and a genuinely
random password generator, querying the database would be more
efficient. However, as the number of registered passwords grows, it
becomes (arguably) more efficient to query the database for each
password. PHP is very fast at working through arrays. MySQL is also very
fast at doing database queries, particularly if it's looking for a
single match. I suspect that on the type of installation Murray is
working with, the difference in time/processing power required would be
infinitessimal.

--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 04, 2006 Oct 04, 2006
LATEST
Yeah - I think we are counting the angels dancing on the head of a pin, so
to speak. I'm probably talking about fewer than 300 passwords....

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"David Powers" <david@example.com> wrote in message
news:eg1ae1$fdi$1@forums.macromedia.com...
> darrel wrote:
>> I don't see why an array is needed. But maybe I'm missing something.
>
> I don't know exactly what Murray is doing, but it's a question of swings
> and roundabouts. By gathering all existing passwords in an array, only one
> call to the database is required. On the other hand, if you do it the
> other way round, you need to query the database for each new password.
> With a small number of registered passwords and a genuinely random
> password generator, querying the database would be more efficient.
> However, as the number of registered passwords grows, it becomes
> (arguably) more efficient to query the database for each password. PHP is
> very fast at working through arrays. MySQL is also very fast at doing
> database queries, particularly if it's looking for a single match. I
> suspect that on the type of installation Murray is working with, the
> difference in time/processing power required would be infinitessimal.
>
> --
> David Powers
> Adobe Community Expert
> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
> http://foundationphp.com/


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines