php-general Digest 7 Sep 2006 01:46:48 -0000 Issue 4333
Topics (messages 241413 through 241432):
Form to subscribe a yahoo group
241413 by: Wagner Garcia Campagner
Excessive Php scripting?
241414 by: Justin Madru
241415 by: Miles Thompson
Re: Format of Encrypted Password
241416 by: Ray Hauge
241417 by: bruce
Formating a Double
241418 by: Phillip Baker
241419 by: Jay Blanchard
241421 by: Robert Cummings
241432 by: Rafael
sort() warning
241420 by: Ashley M. Kirchner
241422 by: Robert Cummings
241423 by: Ashley M. Kirchner
241424 by: Robert Cummings
Re: PHP Access Violations
241425 by: Christopher Watson
241428 by: Christopher Watson
need to generate fixed-length file
241426 by: Karen Goeller
241427 by: Robert Cummings
Sendmail_from
241429 by: D Sledge
241430 by: Chris
Re: php credit reporting API
241431 by: bruce
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 ---
Hello,
I have a web site and a yahoo group aswell.
I want to add a form in my site so that the visitor can put his/her e-mail
address and get subscribed in a yahoo group that i own.
I already have this form working... but the problem is that when the visitor
put his/her e-mail address and click the "Subscribe"
button he/she gets redirected to the yahoo web site stating that he/she is
subscribed to the group.
I wanted to avoid this... so that the visitor doesn't leave my site... i was
thinking that i could make a form requesting the e-mail
address and then send this information to another PHP script on my site... this
PHP script could send the information to the Yahoo
web site and get the answer from then... and finally i could print something
for the visitor like "you were subscribed in the
group"... so that he/she could stay in my web site and doesn't get redirected...
Is there a way to do this using PHP???
Does anybody have any example i could test??
Thanks in advance,
Wagner.
--- End Message ---
--- Begin Message ---
I'm creating a simple personal web server. On a few of the pages is a
html table. I was thinking of making it a php script, and the script
would just output the html code for _one_ row. I would be calling the
same very small php script maybe _30+_ times in the same page.
My server is only 500MHz and 160MB ram, so I want to know if I should
make it a php script or just html? Would calling the same function 30+
times _bog_down_ my server or would it actually _improve_performance_
(because of caching)?
an example script:
function print_table_row($name, $address, $os, $wiki)
{
echo '<tr>
<td class="t_program">
<a href="', $address, '">', $name, '</a>
</td>
<td class="t_program">', $os, '</td>
<td class="t_program">
<a href="http://en.wikipedia.org/wiki/', $wiki, '">(more info)</a>
</td>
</tr>';
}
--- End Message ---
--- Begin Message ---
At 02:02 AM 9/6/2006, Justin Madru wrote:
I'm creating a simple personal web server. On a few of the pages is a html
table. I was thinking of making it a php script, and the script would just
output the html code for _one_ row. I would be calling the same very small
php script maybe _30+_ times in the same page.
My server is only 500MHz and 160MB ram, so I want to know if I should make
it a php script or just html? Would calling the same function 30+ times
_bog_down_ my server or would it actually _improve_performance_ (because
of caching)?
an example script:
function print_table_row($name, $address, $os, $wiki)
{
echo '<tr>
<td class="t_program">
<a href="', $address, '">', $name, '</a>
</td>
<td class="t_program">', $os, '</td>
<td class="t_program">
<a href="http://en.wikipedia.org/wiki/', $wiki, '">(more
info)</a> </td>
</tr>';
}
Well, I'm a programmer, so even if the info was fairly static I'd stick it
in an array and the then loop through the array, calling your function. to
me, that's simpler.
OTH - just build am HTML table.
Either way, no big deal. I doubt you'll see much of a speed difference
Cheers - Miles
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.11.7/438 - Release Date: 9/5/2006
--- End Message ---
--- Begin Message ---
On Wednesday 06 September 2006 04:02, Mourad Boulahboub wrote:
> Hi Kevin,
>
> Kevin Murphy schrieb am 06.09.2006 00:27:
> > $_SERVER['PHP_AUTH_PW']
>
> this is needed if you run HTTP-Authentication for e.g. .htaccess/.htpasswd
>
> i think you will find a string like
>
> Header("WWW-Authenticate: Basic
>
> in your scripts also.
> I think the passwords are stored in MD5
It is possible that it's MD5, but the field in MySQL is only a varchar(16).
I've seen things like that before... I've also been in a place where they
offloaded creating passwords to htpasswd.
I would suggest looking at the code where new accounts are created (if there
is code to do that). That should tell you what's going on.
--
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099
--- End Message ---
--- Begin Message ---
hi kevin...
if you already received an answer to this email, feel free to disregard.
the "password" that you're questioning is from mysql.
---------------------------------------------------
[EMAIL PROTECTED] test]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 4.1.20-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> help password
Name: 'PASSWORD'
Description:
Syntax:
PASSWORD(str)
Calculates and returns a password string from the plaintext password
str and returns a binary string, or NULL if the argument was NULL. This
is the function that is used for encrypting MySQL passwords for storage
in the Password column of the user grant table.
Examples:
mysql> SELECT PASSWORD('badpwd');
-> '7f84554057dd964b'
-------------------------------------------------
hope this clarifies/helps!
-----Original Message-----
From: Kevin Murphy [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 05, 2006 4:53 PM
To: PHP
Subject: Re: [PHP] Format of Encrypted Password
The only thing I can find anywhere in the code is this:
$auth_user = $_SERVER['PHP_AUTH_USER'];
$auth_pw = $_SERVER['PHP_AUTH_PW'];
$query = "select name from table where name = '$authuser' and
password = password('$auth_pw')";
I've never seen that password('$auth_pw') part before. Is that a
mysql part that I am not familiar with and that I should know? I've
been known to miss obvious stuff before.....
--
Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada Community College
www.wncc.edu
775-445-3326
On Sep 5, 2006, at 4:25 PM, Chris W. Parker wrote:
> Kevin Murphy <mailto:[EMAIL PROTECTED]>
> on Tuesday, September 05, 2006 3:27 PM said:
>
>> The passwords are called in the application by:
>>
>> $_SERVER['PHP_AUTH_PW']
>
>> Is there any way to tell how these passwords were encrypted?
>
> Have you tried searching the entire codebase for that string? Might
> get
> you some clues.
>
> From the commandline (and at the root of the codebase):
>
> # grep -R PHP_AUTH_PW *
>
>
>
> Chris.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Greetings All,
I am trying to format a double to use thousands seperators and such.
number_format does not appear to be working properly for this.
My guess is cause I am trying to format a double rather than a string.
Is there anything out there that will allow me to format a double to include
a comma as a thousands seperator.
Thanks.
--
Blessed Be
Phillip
The House has passed a law that would abandon the Internet's First Amendment
-- a principle called Network Neutrality that prevents companies like AT&T,
Verizon and Comcast from deciding which Web sites work best for you -- based
on what site pays them the most. If the public doesn't speak up now, our
elected officials will cave to a multi-million dollar lobbying campaign.
Please contaxct your Senators to defeat this bill in the Senate.
http://www.savetheinternet.com
http://www.coanews.org/tiki-read_article.php?articleId=995
http://www.coanews.org/internetfreedom.html?page=netfreedom
http://www.gnn.tv/headlines/9484/
http://www.dearaol.com/
--- End Message ---
--- Begin Message ---
[snip]
I am trying to format a double to use thousands seperators and such.
number_format does not appear to be working properly for this.
My guess is cause I am trying to format a double rather than a string.
Is there anything out there that will allow me to format a double to
include
a comma as a thousands seperator.
Thanks.
[/snip]
http://www.php.net/printf
--- End Message ---
--- Begin Message ---
On Wed, 2006-09-06 at 11:21 -0500, Jay Blanchard wrote:
> [snip]
> I am trying to format a double to use thousands seperators and such.
> number_format does not appear to be working properly for this.
> My guess is cause I am trying to format a double rather than a string.
> Is there anything out there that will allow me to format a double to
> include
> a comma as a thousands seperator.
> Thanks.
> [/snip]
>
> http://www.php.net/printf
Printf() doesn't do thousands separation as the OP is requiring (unless
they've added that feature since I last read the manual -- and yes I'm
too lazy to go look right now ;)
>From the number_format doc though...
string number_format ( float number [, int decimals [, string
dec_point, string thousands_sep]] )
And if I'm not mistaken, PHP doesn't distinguish between floats and
doubles and treats them all as doubles. Number_format() should work fine
as follows:
<?php
$foo = 1000001.2342
echo number_format( $foo );
?>
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
number_format()
Now, why do you say it's not working properly?
Note: number_format() takes a float as an argument, not a string, and
even if it were, the double would be casted to string.
Phillip Baker wrote:
Greetings All,
I am trying to format a double to use thousands seperators and such.
number_format does not appear to be working properly for this.
My guess is cause I am trying to format a double rather than a string.
Is there anything out there that will allow me to format a double to
include
a comma as a thousands seperator.
Thanks.
--
Atentamente / Sincerely,
J. Rafael Salazar MagaƱa
--- End Message ---
--- Begin Message ---
Given this piece of code:
$i = 0;
if ($dir = opendir($path)) {
while ($dh = readdir($dir)) {
if ($dh != '.' && $dh != '..') {
$Dirs[$i] = $dh;
$i++;
}
}
}
closedir($dir);
sort($Dirs);
Why does sort() give me the following warning:
PHP Warning: sort() expects parameter 1 to be array, null given in ....
The array contents is as follows ( according to print_r($Dirs) )
Array
(
[0] => 1029
[1] => 1197
[2] => 1254
[3] => 1093
[4] => 1217
[5] => 1272
[6] => 1233
[7] => 1257
[8] => 1017
[9] => 1033
)
The end result I want is that it sorts out that array in ascending
order, thus 1017, 1029, 1033, 1042, etc., etc...
--- End Message ---
--- Begin Message ---
On Wed, 2006-09-06 at 10:47 -0600, Ashley M. Kirchner wrote:
> Given this piece of code:
>
> $i = 0;
> if ($dir = opendir($path)) {
> while ($dh = readdir($dir)) {
> if ($dh != '.' && $dh != '..') {
> $Dirs[$i] = $dh;
> $i++;
> }
> }
> }
> closedir($dir);
> sort($Dirs);
>
> Why does sort() give me the following warning:
>
> PHP Warning: sort() expects parameter 1 to be array, null given in ....
>
> The array contents is as follows ( according to print_r($Dirs) )
>
> Array
> (
> [0] => 1029
> [1] => 1197
> [2] => 1254
> [3] => 1093
> [4] => 1217
> [5] => 1272
> [6] => 1233
> [7] => 1257
> [8] => 1017
> [9] => 1033
> )
>
>
> The end result I want is that it sorts out that array in ascending
> order, thus 1017, 1029, 1033, 1042, etc., etc...
It's because you have written sloppy code and didn't bother to
initialize $Dirs to an array. So it's default value is null. You would
know this if you had notices enabled.
Also, the other problem is that you are either a) opening the wrong
path, b) the path you are opening has no files or directories.
Take note also that your variable is called $Dirs, but readdir() returns
all directory contents (including files, links, etc, etc). So either you
don't understand readdir() or you have a penchant for sloppy code as
denoted by your confusing variable nomenclature, lack of E_NOTICE, and
disregard for initializing variables. I would strongly suggest RTFM.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
Robert Cummings wrote:
It's because you have written sloppy code and didn't bother to
initialize $Dirs to an array. So it's default value is null. You would
know this if you had notices enabled.
Error fixed.
Also, the other problem is that you are either a) opening the wrong
path, b) the path you are opening has no files or directories.
Neither of those assumptions is correct.
Take note also that your variable is called $Dirs, but readdir() returns
all directory contents (including files, links, etc, etc).
I'm aware of what readdir() returns, and also aware that in my
particular application, it makes no difference what so ever since there
are only directories in there. If it also contained individual files, I
would've named it different. Variable names are exactly that, variable
names. Whether I called it $Dirs or $Robert_Cummings would make no
difference what so ever [to me]. But thank you for your opinion.
--- End Message ---
--- Begin Message ---
On Wed, 2006-09-06 at 11:03 -0600, Ashley M. Kirchner wrote:
> Robert Cummings wrote:
> > It's because you have written sloppy code and didn't bother to
> > initialize $Dirs to an array. So it's default value is null. You would
> > know this if you had notices enabled.
> >
> Error fixed.
>
> > Also, the other problem is that you are either a) opening the wrong
> > path, b) the path you are opening has no files or directories.
> >
> Neither of those assumptions is correct.
Well then, perhaps you should add some echos so you can see exactly how
your code is executing. I do know for certain that if $Dirs was nul when
passed to sort() that the following never saw the light of day with
respect to processor time:
<?php
$Dirs[$i] = $dh;
?>
While I'm looking at it btw, $i is completely pointless. You should use:
<?php
$Dirs[] = $dh;
?>
Since the index will be automatically incremented by 1 for each entry
added. But hey! Whadda I know?!
>
> > Take note also that your variable is called $Dirs, but readdir() returns
> > all directory contents (including files, links, etc, etc).
> >
> I'm aware of what readdir() returns, and also aware that in my
> particular application, it makes no difference what so ever since there
> are only directories in there. If it also contained individual files, I
> would've named it different. Variable names are exactly that, variable
> names. Whether I called it $Dirs or $Robert_Cummings would make no
> difference what so ever [to me]. But thank you for your opinion.
You're very welcome. I hope you're not writing code for a customer of
some sort. I'd hate to be the one maintaining it after you abandon it...
even if it does have variables named after me (thanks for that). I hope
you initialized $Robert_Cummings btw, I'm not sure I want to be an
implicit null.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
Thanks for the input, Jon. I'll get to the Apache and IIS restart
suggestions soon.
Meanwhile, I think I have a semi-repeatable recipe for getting the
access violation to happen. As far as I can tell, everything is cool
until I open up SQLyog and do some sort of database manipulation
within it. Almost immediately after that, switching back to the
browser and flying through the app a little more brings on the
violation. So far, my testing is indicating to me that the violation
does not occur without SQLyog having done some work in the database.
-Chris
On 9/6/06, Jon Anderson <[EMAIL PROTECTED]> wrote:
Christopher Watson wrote:
> memtest run over several hours, with 2000% coverage. No errors.
My impression of this is that it either has to be a software problem in
either PHP or the server (pretty much guaranteed your PHP code should
never be allowed to trigger an access violation) or a fundamental
hardware issue.
In this case, I would first eliminate software problems first - I gather
you've used different versions of PHP, so why not try using Apache
temporarily and see if that alleviates the problem. Also, what happens
after an access violation if you fully stop then restart the IIS service?
If you eliminate your web server and PHP as possibilities, I would look
to hardware (overheating CPU?), it's obviously not memory. ;-)
jon
--- End Message ---
--- Begin Message ---
Spoke too soon. After a reboot, I had only IE and Homesite open,
making changes to PHP code and running the app, and it hit an access
violation. So SQLyog ain't it.
-Chris
On 9/6/06, Christopher Watson <[EMAIL PROTECTED]> wrote:
Thanks for the input, Jon. I'll get to the Apache and IIS restart
suggestions soon.
Meanwhile, I think I have a semi-repeatable recipe for getting the
access violation to happen. As far as I can tell, everything is cool
until I open up SQLyog and do some sort of database manipulation
within it. Almost immediately after that, switching back to the
browser and flying through the app a little more brings on the
violation. So far, my testing is indicating to me that the violation
does not occur without SQLyog having done some work in the database.
-Chris
--- End Message ---
--- Begin Message ---
I'm having trouble generating a fixed-length (i.e., non-delimited) file
format out of PHP 4, based on queries out of MySQL. These files are
getting imported into a Unidata database and require a very specific
byte-mapping format. However, while the fopen used with length will
TRUNCATE to a specific length, it also won't pad to that length.
Is there a function I'm missing somewhere that will let you specify a
field length and pad accordingly? If not, any suggestions as to
approach will be greatly appreciated!
Many thanks,
Karen Goeller
--- End Message ---
--- Begin Message ---
On Wed, 2006-09-06 at 16:56 -0400, Karen Goeller wrote:
> I'm having trouble generating a fixed-length (i.e., non-delimited) file
> format out of PHP 4, based on queries out of MySQL. These files are
> getting imported into a Unidata database and require a very specific
> byte-mapping format. However, while the fopen used with length will
> TRUNCATE to a specific length, it also won't pad to that length.
>
> Is there a function I'm missing somewhere that will let you specify a
> field length and pad accordingly? If not, any suggestions as to
> approach will be greatly appreciated!
str_pad()
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
OS: Red Hat Enterprise Linux AS release 4 (Nahant Update 4)
web server: Apache 2.0
php version: 4.3.9
When I use the function mail(), the the from email address that is used is
apache@<hostname>. I
tried setting the sendmail_from directive in php.ini and the ServerAdmin
directive in httpd.conf
to something different but it still keeps using the same address. Is the a
different directive
I'm supposed to be setting to change the default from address?
Thanks,
DS
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--- End Message ---
--- Begin Message ---
D Sledge wrote:
OS: Red Hat Enterprise Linux AS release 4 (Nahant Update 4)
web server: Apache 2.0
php version: 4.3.9
When I use the function mail(), the the from email address that is used is
apache@<hostname>. I
tried setting the sendmail_from directive in php.ini and the ServerAdmin
directive in httpd.conf
to something different but it still keeps using the same address. Is the a
different directive
I'm supposed to be setting to change the default from address?
What mta is on the server?
If it's exim, you might need to adjust the 'trusted_user' line (see exim
documentation).
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
hi dan...
a couple of suggestions if you haven't already thought of them. keep in
mind, i haven't talked to any of the vendors or looked into any of the
myriad issues surrounding this area.
a quick google search came across a few companies, one of which is:
http://xml-creditreport.com/. they seem to have products/offerings/sdk/api
that might be used to get to the data for the credit scoring.
i cannot/don't vouch for these guys... just saw them during the search!! so
i don't know what their cost might be.
i would assume that there are plenty of ways to accomplish this. although i
gotta tell you. as a consumer, unless i know you as the website are rock
solid, with fort knox like security policies, i wouldn't want to deal with
the site. too many ways for this kind of information to be ripped off!!!
if you find out a good solution, let me know. i might eventually need to
solve the basic issue of accessing these kinds of services via a web
interface...
peace
-----Original Message-----
From: Dan Harrington [mailto:[EMAIL PROTECTED]
Sent: Saturday, September 02, 2006 10:19 PM
To: [email protected]
Subject: [PHP] php credit reporting API
Hello,
Anyone successfully implemented an online real-time credit reporting
scenario for consumer lending? We need to pull credit in the united states
for consumers before lending them money for school and I would like to use
PHP to connect to a credit vendor. I have been surprised at how little I
can find on google and all the major vendors (equifax, trans union,
experian) only talk in generalities on their website and seem to be geared
only for desktop software solutions.
I need to pull a score and based on that, provide a decision and offer. Has
anyone got this working, and would you recommend a vendor?
Thanks
Dan
--- End Message ---