php-general Digest 9 Nov 2009 12:51:17 -0000 Issue 6434

Topics (messages 299713 through 299736):

Re: Convert deprecated POSIX functions into wrappers for equivalent PCRE 
functions
        299713 by: Robert Cummings
        299717 by: Paul M Foster
        299721 by: Tony Marston
        299722 by: Tony Marston
        299724 by: Ashley Sheridan
        299727 by: Tony Marston
        299728 by: David Otton
        299735 by: Tim Thorburn

Checkbox in PHP form
        299714 by: Ernie Kemp
        299715 by: Manuel Lemos
        299718 by: Brian Hazelton

Connect to LDAP
        299716 by: Ashley M. Kirchner
        299720 by: Devendra Jadhav

Multilingual website, texts in external JavaScript problem
        299719 by: leledumbo
        299723 by: Ashley Sheridan
        299732 by: Peter Ford
        299736 by: Phpster

Hash function
        299725 by: Ali Asghar Toraby Parizy
        299729 by: John Black
        299731 by: Ashley Sheridan
        299733 by: Ali Asghar Toraby Parizy
        299734 by: Ashley Sheridan

Paypal transaction
        299726 by: Ali Asghar Toraby Parizy
        299730 by: John Black

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 ---
Tony Marston wrote:
"Robert Cummings" <[email protected]> wrote in message
Then you've got several options:
1) Don't upgrade PHP.
Not an acceptable option.

2) Pick a different hosting provider.
Not an acceptable optional.

3) Fix your scripts.
The scripts aren't broken. It's PHP 6 that's going to be broken.
I think you're missing the point of a full version increase. This is not a minor or micro version change... script breakage is *expected*.

But breakage should be kept to an absolute minimum, and developer laziness or incompetence is not an acceptable excuse.

Not quite true... major version moves are an opportunity to make a break for freedom. All there needs to be is an upgrade path... and that is clearly in play right now with the warning indicating that POSIX regex functions are being deprecated.

You don't think PHP should support legacy cruft in the core forever do you?

Widely use regex functions are not "legacy cruft". Besides, who decides what is "cruft" and should be removed from the language?

They most certainly are cruft... hence the reason they are being removed. The people who decide what is, and is not, cruft are the very same people who are writing the code. If you are not happy with this then there's the age old saying in open source... "put up or shut up".

If unicode support is slopped onto the current POSIX regex functions won't that then make them non-POSIX? Food for thought. Also, why support two libraries for which one is obviously inferior in speed and functionality?

That is why I suggested that instead of dropping the POSIX functions entirely and seriously annoying lots of users, that they should simply be rewritten as wrappers for the PCRE functions. In that way all the calls to ereg_* would still work, but all they would do is immediately call the relevant preg_* function. The small amount of effort that tghis would take would kill two birds with one stone:

(1) There would be only one regex engine to support, which would be PCRE.
(2) Lots of developers would be spared the hassle of modifying their code as all the calls to POSIX functions would still work as expected because the language would redirect to the PCRE function automatically.

This would probably be worse than removing the POSIX functions. POSIX and PCRE I daresay are not completely compatible. At least when you remove the POSIX functions then the problem space is well defined. Suddenly having POSIX regex functions that are really wrappers around PCRE functions may introduce subtle differences in output for the same horde of users but without the same explicability.

I am not suggesting that the POSIX functions be rewritten to deal with unicode as that would require a huge amount of effort, but by redirecting al POSIX calls to the equivalent PCRE function would have the same effect for far less effort.

The choice is simple - either a small amount of effort from a small number of developers, or a large amount of effort from a large number of seriously pissed-off users. Do the maths. It's not rocket science.

This isn't a mathematical problem. It's a question of correctness. I wasn't happy to hear POSIX regex functions were going either, but when I heard the reasoning I did the best thing I could... I fixed my code to prepare for the inevitable. There's no way I'd trust my code to "just work" with POSIX functions redirected through PCRE and so I'd still need to do the same legwork.

Wrapping the POSIX regex functions around PCRE will lead to more problems than it solves IMHO.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

--- End Message ---
--- Begin Message ---
On Sun, Nov 08, 2009 at 06:30:37PM -0500, Robert Cummings wrote:

> Also, why support
> two libraries for which one is obviously inferior in speed and
> functionality?
>

Because Tony's Radicore framework has a bunch of ereg* calls in it. ;-}

Paul

-- 
Paul M. Foster

--- End Message ---
--- Begin Message ---
"Paul M Foster" <[email protected]> wrote in message 
news:[email protected]...
> On Sun, Nov 08, 2009 at 06:30:37PM -0500, Robert Cummings wrote:
>
>> Also, why support
>> two libraries for which one is obviously inferior in speed and
>> functionality?
>>
>
> Because Tony's Radicore framework has a bunch of ereg* calls in it. ;-}

Just like a lot of other people's work.

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org

> Paul
>
> -- 
> Paul M. Foster 



--- End Message ---
--- Begin Message ---
"Robert Cummings" <[email protected]> wrote in message 
news:[email protected]...
> Tony Marston wrote:
>> "Robert Cummings" <[email protected]> wrote in message
>>>>> Then you've got several options:
>>>>> 1) Don't upgrade PHP.
>>>> Not an acceptable option.
>>>>
>>>>> 2) Pick a different hosting provider.
>>>> Not an acceptable optional.
>>>>
>>>>> 3) Fix your scripts.
>>>> The scripts aren't broken. It's PHP 6 that's going to be broken.
>>> I think you're missing the point of a full version increase. This is not 
>>> a minor or micro version change... script breakage is *expected*.
>>
>> But breakage should be kept to an absolute minimum, and developer 
>> laziness or incompetence is not an acceptable excuse.
>
> Not quite true... major version moves are an opportunity to make a break 
> for freedom. All there needs to be is an upgrade path... and that is 
> clearly in play right now with the warning indicating that POSIX regex 
> functions are being deprecated.

But a lot of people won't see those warnings until they run 5.3.0 for the 
first time. It is common practice, at least in all the other languages that 
I have used, that is something is going to be removed that it is marked as 
deprecated at the start of the previous release, not at the end. So marking 
the POIX functions as deprecated should have happened in 5.0, not 5.3.

>>> You don't think PHP should support legacy cruft in the core forever do 
>>> you?
>>
>> Widely use regex functions are not "legacy cruft". Besides, who decides 
>> what is "cruft" and should be removed from the language?
>
> They most certainly are cruft.

That is just your opinion. Other people think that PHP should be rewritten 
so that it appears more like their favourite language. Among the suggestions 
I have seen are:
- make all variables statically typed instead of dynamically typed.
- remove all procedural functions and make the language "pure" OO.

Who decides if they are right?

>.. hence the reason they are being removed. The people who decide what is, 
>and is not, cruft are the very same people who are writing the code. If you 
>are not happy with this then there's the age old saying in open source... 
>"put up or shut up".

I can't because I don't program in C. So I shall do the nextbest thing - 
complain at every opporunity.

>>> If unicode support is slopped onto the current POSIX regex functions 
>>> won't that then make them non-POSIX? Food for thought. Also, why support 
>>> two libraries for which one is obviously inferior in speed and 
>>> functionality?
>>
>> That is why I suggested that instead of dropping the POSIX functions 
>> entirely and seriously annoying lots of users, that they should simply be 
>> rewritten as wrappers for the PCRE functions. In that way all the calls 
>> to ereg_* would still work, but all they would do is immediately call the 
>> relevant preg_* function. The small amount of effort that tghis would 
>> take would kill two birds with one stone:
>>
>> (1) There would be only one regex engine to support, which would be PCRE.
>> (2) Lots of developers would be spared the hassle of modifying their code 
>> as all the calls to POSIX functions would still work as expected because 
>> the language would redirect to the PCRE function automatically.
>
> This would probably be worse than removing the POSIX functions.
> POSIX and PCRE I daresay are not completely compatible.

"probably" and "daresay" mean that you are just guessing. According to some 
people who know what they are talking about there is a one-for-one 
comparison between each POSIX and each PCRE function.

> At least when you remove the POSIX functions then the problem space is 
> well defined.

And lots of sers will be pissed off because they won'tbe able to upgrade to 
PHP 6 without major programmer intervention.

> Suddenly having POSIX regex functions that are really wrappers around PCRE 
> functions may introduce subtle differences in output for the same horde of 
> users but without the same explicability.

"may introduce"? There you go, guessng again. Can you point out *any* POSIX 
function that cannot be converted into PCRE?

>> I am not suggesting that the POSIX functions be rewritten to deal with 
>> unicode as that would require a huge amount of effort, but by redirecting 
>> al POSIX calls to the equivalent PCRE function would have the same effect 
>> for far less effort.
>>
>> The choice is simple - either a small amount of effort from a small 
>> number of developers, or a large amount of effort from a large number of 
>> seriously pissed-off users. Do the maths. It's not rocket science.
>
> This isn't a mathematical problem. It's a question of correctness.

Lot's of PHP users, myself included, do not think that it is "correct" to 
remove widely used functionality just beause the developers are too lazy to 
do a proper job.

> I wasn't happy to hear POSIX regex functions were going either, but when I 
> heard the reasoning I did the best thing I could... I fixed my code to 
> prepare for the inevitable.

So you had to fix what wasn't broken just to circumvent a stupid decision by 
the PHP developers.

> There's no way I'd trust my code to "just work" with POSIX functions 
> redirected through PCRE and so I'd still need to do the same legwork.

So you wouldn't trust the PHP developers to write simple code which takes 
each POSIX function and redirects it to a PCRE function? I have more faith 
in their ability than I do yours.

> Wrapping the POSIX regex functions around PCRE will lead to more problems 
> than it solves IMHO.

IMHO your opinion does not carry much weight.

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org

> Cheers,
> Rob.
> -- 
> http://www.interjinn.com
> Application and Templating Framework for PHP 



--- End Message ---
--- Begin Message ---
On Mon, 2009-11-09 at 00:23 +0000, Tony Marston wrote:

> developer laziness 
> or incompetence is not an acceptable excuse.


Exactly, so fix your scripts!

I do wonder though, what hosting company you use that would just upgrade
to PHP6 without warning on you and 'break' your scripts, yet at the same
time would not allow you to install what you call an 'amateur fudge'. I
can't think of any hosting company that would care so little about their
customers.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
"Ashley Sheridan" <[email protected]> wrote in message 
news:1257764339.1076.56.ca...@localhost...
> On Mon, 2009-11-09 at 00:23 +0000, Tony Marston wrote:
>
>> developer laziness
>> or incompetence is not an acceptable excuse.
>
>
> Exactly, so fix your scripts!

But my scripts aren't broken! It's PHP 6 that is broken.

> I do wonder though, what hosting company you use that would just upgrade
> to PHP6 without warning on you and 'break' your scripts,

How many hosting companies write to all their account holders to ask 
permission before upgrading PHP, not just from 4 to 5, but all the releases 
in between? Very few of them, if any, in my experience.

> yet at the same
> time would not allow you to install what you call an 'amateur fudge'. I
> can't think of any hosting company that would care so little about their
> customers.

Some hosting companies won't allow you to use htaccess files, refuse to 
install any optional extension, let alone one from the PECL or PEAR 
repositories. Some of them won't give you more than one MySQL database. 
Different companies provide different levels of service. The only thing that 
the DO have in common is that they charge you for it.

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org

> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
> 



--- End Message ---
--- Begin Message ---
2009/11/9 Tony Marston <[email protected]>:

> So you wouldn't trust the PHP developers to write simple code which takes
> each POSIX function and redirects it to a PCRE function? I have more faith
> in their ability than I do yours.

If it's as simple as you claim, why don't you mock-up your solution in
PHP, rather than C? You'll get taken more seriously if you have
working code that someone can write unit tests against.

If your solution doesn't get any traction with the core team, you'll
still be able to offer it to the community as a simple download, just
"include this at the top of your script to fix "ereg*() not found"
problems". That would be really useful to all those people whose cause
you are championing.

(BTW, the reference implementation for PHP is... PHP. There isn't an
ISO standard or anything here. How PHP6 behaves is correct, because
it's PHP6).

(BTW^2 - you're on the wrong list for this. If you want to influence
the guys who make the decisions you need to take this to
php-internals, where the heavyweights hang out).

--- End Message ---
--- Begin Message ---
Tony Marston wrote:
How many hosting companies write to all their account holders to ask permission before upgrading PHP, not just from 4 to 5, but all the releases in between? Very few of them, if any, in my experience.
I've no idea what horrible hosting companies you've had experiences with, however all of the companies I've used in the last few years have had an option to move back and forth between PHP4 and PHP5 in the event that certain scrips/frameworks/apps/whatever required one version over the other. What makes you think these companies won't do the same thing when they finally decide to add PHP6 to their servers? I doubt very many reputable hosting companies would simply upgrade to the latest flavor of PHP/Apache/MySQL/anything simply because it was released this morning without doing ample internal testing; if you or your clients are using one that does this - I'd advise you look elsewhere.

Whenever PHP6 reaches a stable release build, it will still be quite some time before its offered as an option to any mainstream shared hosting service - this should leave you ample time to adapt to incoming changes. Failing that, you always have the option of purchasing your own server or VPS from any number of hosts to configure as you see fit. Or you can explain your moral outrage to potential clients detailing your refusal to work because you disagree with a proposed change that won't see the light of day for years to come; your call.

Incessant whining under the guise of expressing your own opinion isn't going to make everything better. Sorry.
--- End Message ---
--- Begin Message ---
 

Need some help here with checkboxes in an html form.

 

My issue is I have a form that needs to be viewed with checkboxes filled in
depending on the values in the table.

 

I tried:

<INPUT class=text id="myCheck1" type=checkbox <?php if ( $row[33] = 'no') {
echo "checked=yes";  } else { echo '';  } ?> value="PFDs"
name=f_sequipment1></b><font size="2">PFDs<b>

but the checkbox field is always checked.

 

I thought of JavaScript also but it would have to be a "if $row[33] then run
a JavaScript function" .  This is not working for me neither.

 

Sorry if this seems trivial but I need your help.

 

Thanks in advance..... 

 

 

 

 


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

on 11/08/2009 11:39 PM Ernie Kemp said the following:
> Need some help here with checkboxes in an html form.
> 
>  
> 
> My issue is I have a form that needs to be viewed with checkboxes filled
> in depending on the values in the table.
> 
>  
> 
> I tried:
> 
> <INPUT class=text id="myCheck1" type=checkbox <?php if ( $row[33] =
> 'no') { echo "checked=yes";  } else { echo '';  } ?> value="PFDs"
> name=f_sequipment1></b><font size="2">PFDs<b>
> 
> but the checkbox field is always checked.

It should be $row[33] == 'no'

-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

--- End Message ---
--- Begin Message ---
<input class=text id="myCheck1" type="checkbox" <?php if ( $row[33] ==
'no') { echo "checked="checked";  } ?> value="PFDs"
name=f_sequipment1></b><font size="2">PFDs<b>


--- End Message ---
--- Begin Message ---

   Hi folks,

I've never done any PHP->LDAP code writing (nor have I ever dealt with an LDAP server to begin with.) However I'm writing an app which requires verifying a user's credentials against an LDAP server. The admin of the server sent me the following snippet, however also made it clear that he is not 100% whether it's accurate (he's not a PHP coder). And I don't have remote access to the server (the app is going to sit on the internal network and the LDAP server doesn't accept outside connections.)

So, asking the wise folks on here, does the following piece look semantically correct?

        /* Check against LDAP server */
        $adServer = "server.address.hidden";
$ldapconn = ldap_connect($adServer) or die("Connection to the AD server failed.");
        $ldapuser = $_POST["uname"];
        $ldappass = $_POST["pword"];
        $ldapbind = ldap_bind($ldapconn, $ldapuser, $ldappass);

        if ($ldapbind) {
          $msg = "User Authenticated Successfully!";
          $_SESSION['username'] = $ldapuser;
          $_SESSION['password'] = $ldappass;
          return true;
        } else {
          $msg = "Invalid username / password";
          return false;
        }

   Thanks.

   -- A

--- End Message ---
--- Begin Message ---
Yes. Correct

On Mon, Nov 9, 2009 at 7:30 AM, Ashley M. Kirchner <[email protected]>wrote:

>
>   Hi folks,
>
>   I've never done any PHP->LDAP code writing (nor have I ever dealt with an
> LDAP server to begin with.)  However I'm writing an app which requires
> verifying a user's credentials against an LDAP server.  The admin of the
> server sent me the following snippet, however also made it clear that he is
> not 100% whether it's accurate (he's not a PHP coder).  And I don't have
> remote access to the server (the app is going to sit on the internal network
> and the LDAP server doesn't accept outside connections.)
>
>   So, asking the wise folks on here, does the following piece look
> semantically correct?
>
>        /* Check against LDAP server */
>        $adServer = "server.address.hidden";
>        $ldapconn = ldap_connect($adServer) or die("Connection to the AD
> server failed.");
>        $ldapuser = $_POST["uname"];
>        $ldappass = $_POST["pword"];
>        $ldapbind = ldap_bind($ldapconn, $ldapuser, $ldappass);
>
>        if ($ldapbind) {
>          $msg = "User Authenticated Successfully!";
>          $_SESSION['username'] = $ldapuser;
>          $_SESSION['password'] = $ldappass;
>          return true;
>        } else {
>          $msg = "Invalid username / password";
>          return false;
>        }
>
>   Thanks.
>
>   -- A
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Devendra Jadhav
देवेंद्र जाधव

--- End Message ---
--- Begin Message ---
I need to create a multilingual website and my framework already gives me
that facility. However, I also use JavaScript quite extensively and since
XHTML 1.0 Strict doesn't allow inline script, I must use external .js file.
The problem is in these scripts, there are strings that needs to be
translated as well. How can I make PHP parse these scripts as well? Or are
there alternative approaches?

-- 
View this message in context: 
http://old.nabble.com/Multilingual-website%2C-texts-in-external-JavaScript-problem-tp26261666p26261666.html
Sent from the PHP - General mailing list archive at Nabble.com.


--- End Message ---
--- Begin Message ---
On Sun, 2009-11-08 at 22:04 -0800, leledumbo wrote:

> I need to create a multilingual website and my framework already gives me
> that facility. However, I also use JavaScript quite extensively and since
> XHTML 1.0 Strict doesn't allow inline script, I must use external .js file.
> The problem is in these scripts, there are strings that needs to be
> translated as well. How can I make PHP parse these scripts as well? Or are
> there alternative approaches?
> 
> -- 
> View this message in context: 
> http://old.nabble.com/Multilingual-website%2C-texts-in-external-JavaScript-problem-tp26261666p26261666.html
> Sent from the PHP - General mailing list archive at Nabble.com.
> 
> 


You could either use several different Javascript files to hold the
language translations and just those as variables, and then in the main
Javascript use the variables rather than the actual words. Or you could
store all the translations into a Javascript array and refer to the
specific array element you need to output

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
leledumbo wrote:
> I need to create a multilingual website and my framework already gives me
> that facility. However, I also use JavaScript quite extensively and since
> XHTML 1.0 Strict doesn't allow inline script, I must use external .js file.
> The problem is in these scripts, there are strings that needs to be
> translated as well. How can I make PHP parse these scripts as well? Or are
> there alternative approaches?
> 

I don't see why you can't use inline script in XHTML 1.0 Strict: just put the
script in CDATA sections, like

<script type="text/javascript">
/*<![CDATA[*/

// Inline javascript here

/*]]>*/
</script>

That seems to validate fine in XHTML 1.0 Strict for me...


-- 
Peter Ford                              phone: 01580 893333
Developer                               fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

--- End Message ---
--- Begin Message ---


On Nov 9, 2009, at 1:04 AM, leledumbo <[email protected]> wrote:


I need to create a multilingual website and my framework already gives me that facility. However, I also use JavaScript quite extensively and since XHTML 1.0 Strict doesn't allow inline script, I must use external .js file.
The problem is in these scripts, there are strings that needs to be
translated as well. How can I make PHP parse these scripts as well? Or are
there alternative approaches?

--
View this message in context: 
http://old.nabble.com/Multilingual-website%2C-texts-in-external-JavaScript-problem-tp26261666p26261666.html
Sent from the PHP - General mailing list archive at Nabble.com.


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


I use a standard error code ( error.2510 ) treating it as the js array key, and then call the correct language file with translated value

Bastien

--- End Message ---
--- Begin Message ---
hi friends
I need a hash function to build a Unique serial number by mixing a request
code and a user name
request codes are strings like this: They are literally HEX codes of MAC mac
addresses.
"002314EFD000544AB05345300045675609782123C3254B312123D12312EE13123F123D123123E00000000E00000000E0000000E0000000E0000000E00000000E00000000"
i want to create a function that mix together this request code with user
name that user entered and create new serial number.
What implications i have to satisfy to create such hash function in php?
Thanks for any suggestion

--- End Message ---
--- Begin Message ---
Ali Asghar Toraby Parizy wrote:
hi friends
I need a hash function to build a Unique serial number by mixing a request
code and a user name
request codes are strings like this: They are literally HEX codes of MAC mac
addresses.
"002314EFD000544AB05345300045675609782123C3254B312123D12312EE13123F123D123123E00000000E00000000E0000000E0000000E0000000E00000000E00000000"
i want to create a function that mix together this request code with user
name that user entered and create new serial number.
What implications i have to satisfy to create such hash function in php?
Thanks for any suggestion

How about using sha1 to hash your string. If the data is unique then the hash will be unique as well.

$string = $request_code.$user_name;
$hash = sha1($string);

--
John
Jeder hat soviel Recht, wie er Macht hat.
[Spinoza]


--- End Message ---
--- Begin Message ---
On Mon, 2009-11-09 at 12:39 +0100, John Black wrote:

> Ali Asghar Toraby Parizy wrote:
> > hi friends
> > I need a hash function to build a Unique serial number by mixing a request
> > code and a user name
> > request codes are strings like this: They are literally HEX codes of MAC mac
> > addresses.
> > "002314EFD000544AB05345300045675609782123C3254B312123D12312EE13123F123D123123E00000000E00000000E0000000E0000000E0000000E00000000E00000000"
> > i want to create a function that mix together this request code with user
> > name that user entered and create new serial number.
> > What implications i have to satisfy to create such hash function in php?
> > Thanks for any suggestion
> 
> How about using sha1 to hash your string. If the data is unique then the 
> hash will be unique as well.
> 
> $string = $request_code.$user_name;
> $hash = sha1($string);
> 
> -- 
> John
> Jeder hat soviel Recht, wie er Macht hat.
> [Spinoza]
> 
> 


I'm not sure you can guarantee uniqueness, but you can say with a high
degree of certainty that it's extremely unlikely to not be unique! 

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
Ok, thanks
but how can i create serial number that nobody can guess it. for example
when i use sha1() every body can examine it too! and so they can create it
themselves!
what strategy is useful to protect license?
I think it is better to add a specific hidden string to request code,
instead of user name that is known for a probable jobber user.
what do you think about it?

On Mon, Nov 9, 2009 at 3:09 PM, John Black <[email protected]>wrote:

> Ali Asghar Toraby Parizy wrote:
>
>> hi friends
>> I need a hash function to build a Unique serial number by mixing a request
>> code and a user name
>> request codes are strings like this: They are literally HEX codes of MAC
>> mac
>> addresses.
>>
>> "002314EFD000544AB05345300045675609782123C3254B312123D12312EE13123F123D123123E00000000E00000000E0000000E0000000E0000000E00000000E00000000"
>> i want to create a function that mix together this request code with user
>> name that user entered and create new serial number.
>> What implications i have to satisfy to create such hash function in php?
>> Thanks for any suggestion
>>
>
> How about using sha1 to hash your string. If the data is unique then the
> hash will be unique as well.
>
> $string = $request_code.$user_name;
> $hash = sha1($string);
>
> --
> John
> Jeder hat soviel Recht, wie er Macht hat.
> [Spinoza]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
On Mon, 2009-11-09 at 15:35 +0330, Ali Asghar Toraby Parizy wrote:

> Ok, thanks
> but how can i create serial number that nobody can guess it. for example
> when i use sha1() every body can examine it too! and so they can create it
> themselves!
> what strategy is useful to protect license?
> I think it is better to add a specific hidden string to request code,
> instead of user name that is known for a probable jobber user.
> what do you think about it?
> 
> On Mon, Nov 9, 2009 at 3:09 PM, John Black 
> <[email protected]>wrote:
> 
> > Ali Asghar Toraby Parizy wrote:
> >
> >> hi friends
> >> I need a hash function to build a Unique serial number by mixing a request
> >> code and a user name
> >> request codes are strings like this: They are literally HEX codes of MAC
> >> mac
> >> addresses.
> >>
> >> "002314EFD000544AB05345300045675609782123C3254B312123D12312EE13123F123D123123E00000000E00000000E0000000E0000000E0000000E00000000E00000000"
> >> i want to create a function that mix together this request code with user
> >> name that user entered and create new serial number.
> >> What implications i have to satisfy to create such hash function in php?
> >> Thanks for any suggestion
> >>
> >
> > How about using sha1 to hash your string. If the data is unique then the
> > hash will be unique as well.
> >
> > $string = $request_code.$user_name;
> > $hash = sha1($string);
> >
> > --
> > John
> > Jeder hat soviel Recht, wie er Macht hat.
> > [Spinoza]
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >


The crypt() function in PHP offers a one-way encryption, so
theoretically, it would be too difficult to work out backwards (not
impossible, but would need a fair bit of computing power to figure it
out!)

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
Hi friends
I have an application I want to sell it in my website
How can i use PayPal to marketing? i understand php so i am eager to write
some php code, myself.
How can i implement a php code to use PayPal gateway
Thanks for any help

--- End Message ---
--- Begin Message ---
Ali Asghar Toraby Parizy wrote:
Hi friends
I have an application I want to sell it in my website
How can i use PayPal to marketing? i understand php so i am eager to write
some php code, myself.
How can i implement a php code to use PayPal gateway
Thanks for any help

Create a PayPal developer account here https://developer.paypal.com/
They will provide you with sample code and access to the sandbox so you can test your payment scripts without risking real money.

--
John
No Victim, No Crime

--- End Message ---

Reply via email to