|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: php-general-digest-help
lists.php.netDate: Wed Aug 29 2001 - 04:16:00 CDT
php-general Digest 29 Aug 2001 09:16:00 -0000 Issue 844
Topics (messages 64863 through 64963):
LONGINT... ? to be or not to be?...
64863 by: Alexey Prohorenko
64872 by: Sheridan Saint-Michel
64914 by: Papp Gyozo
exec() major probs
64864 by: Terry Reynolds
64898 by: Dell Coleman
instalando o php
64865 by: Daniel Janzen
64868 by: Nuno Silva
mkdir failed
64866 by: Christian Darsow
PHP and MySQL auth?
64867 by: Alex Sofronie
64873 by: B. van Ouwerkerk
htaccess and $PHP_AUTH_USER
64869 by: Rene Fournier
64919 by: Papp Gyozo
two dimensional array or two arrays?
64870 by: Tom Beidler
64871 by: Anton Stroganov
64891 by: Philip Olson
fix my query please
64874 by: Jeremy Morano
64876 by: Martín Marqués
64878 by: Sam Masiello
ODBC32.DLL
64875 by: Daniel Janzen
Re: The future of PHP - accessory libraries
64877 by: Heiko Maiwald
64913 by: Rasmus Lerdorf
64956 by: Geoff Caplan
64961 by: Rasmus Lerdorf
Re: What does PHP stand for?
64879 by: J Smith
64884 by: John Meyer
64892 by: Martín Marqués
64895 by: Rob Hardowa
64896 by: Adam Plocher
Data duplication in databases
64880 by: Julian Wood
Last Modified question..
64881 by: Jay Paulson
64885 by: Julio Nobrega Trabalhando
64888 by: scott [gts]
PHP cURL problem
64882 by: SDowell
is_numeric for php3
64883 by: Philip Olson
64887 by: daniel james
64894 by: Philip Olson
64897 by: daniel james
64899 by: scott [gts]
64905 by: daniel james
64907 by: scott [gts]
64908 by: scott [gts]
64915 by: Prottoss
64921 by: Seb Frost
64924 by: Steve Edberg
Check if a word is in my string.
64886 by: Brandon Orther
64890 by: Philip Olson
64893 by: daniel james
64904 by: scott [gts]
64923 by: Papp Gyozo
64925 by: Jason Murray
Link Checker
64889 by: Adam Plocher
64901 by: scott [gts]
wrapping blobbed fields
64900 by: freshNet
64927 by: David Robley
double check query statement??
64902 by: Gerard Samuel
64909 by: Hugh Bothwell
64910 by: ERISEN, Mehmet Kamil
64912 by: Gerard Samuel
Developer
64903 by: Vincent - D. Ertner
64906 by: Hugh Bothwell
Exclamation point appearing from nowhere
64911 by: Saul Ishida
Re: Putting variables in a string
64916 by: Papp Gyozo
Re: Need help on putting variable into <form>
64917 by: Hugh Danaher
Re: How do I read the first n lines from a file?
64918 by: Hugh Danaher
64947 by: _lallous
suggestions
64920 by: Glyndower
Re: subscription
64922 by: Chris Fry
Re: Pulling webpages - may be a weird question :)
64926 by: Dan Harrington
64940 by: Lawrence.Sheed.dfait-maeci.gc.ca
Start Accepting Credit Cards NOW#
64928 by: peter.excite.com
Database Preference?
64929 by: james
64934 by: Manuel Lemos
perl-esque data parsing for hex post variables
64930 by: Jason Mercer
Re: The future of PHP
64931 by: Manuel Lemos
64933 by: Manuel Lemos
64938 by: Rasmus Lerdorf
64939 by: mike cullerton
cant connect to mysql
64932 by: Sagar N Chand
64935 by: Peter Houchin Sun Rentals STR Manager
Writing to file with user as owner
64936 by: Anton Stroganov
mailto function to attach a photo
64937 by: Mark Lo
64941 by: Lawrence.Sheed.dfait-maeci.gc.ca
64942 by: Jason Murray
64949 by: _lallous
I beleive I have found a bug.....
64943 by: Brian White
64951 by: * R&zE:
64955 by: Brian White
64958 by: * R&zE:
Dc /Ac motor sale
64944 by: hinglungmotor.yahoo.com.hk
Re: virtual() call to CGI script
64945 by: Egan
Suse Apache
64946 by: Keith
Re: haX0Ring exercise :)
64948 by: _lallous
DOM
64950 by: Jean-Charles Preaux
php running and installing problem
64952 by: rayn .
multiple submit buttons
64953 by: Justin French
bugroff licensed tree converter
64954 by: alvarez.sto13.st-oneline.de
64959 by: alvarez.sto13.st-oneline.de
Re: The future of PHP - object model
64957 by: Geoff Caplan
comparing scripts performance
64960 by: Ben-Nes Michael
reading from a file and parsing variables??
64962 by: Derick Dorner
Update form objects before submit
64963 by: Stephane Pinel
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
Hello,
I have one question. How can PHP work with longint (in C we call
them "unsigned long") variables?
F.e., I want to do next thing:
65536 & 4096 = 0 (this is right)
65536 & 65536 = 65536 (again, everything is okay)
196608 & 65536 = 65536 (perfect, it works great)
but,
3221225472 & 1073741824 = 0 (this is wrong, right answer isn't 0
but 2147483648)
So, can anybody help me with this? Any suggestions?
Thanks, anyway. Looking forward your answers.
Will check my mailbox every 5 minutes. :-)
-- green [http://www.extrasy.net] [http://www.unix-how-to.net]
attached mail follows:
A couple of points here... First, 0 is obviously wrong for 3221225472 & 1073741824 But I don't know how you got 2147483648 either. I get 1073741824 as 3221225472 = 11000000000000000000000000000000 1073741824 = 01000000000000000000000000000000
11000000000000000000000000000000 & 01000000000000000000000000000000 = 01000000000000000000000000000000
right?
Anyways, to your question =P
First, if you check here: http://www.php.net/manual/en/language.types.integer.php
you will see that int's in PHP are always signed and that if they exceed the max size for an int they are converted to a float.
Try running this on your server
<?php $x = 3221225472; $y = 1073741824; echo "x = "; var_dump($x); echo "<BR>"; echo "y = "; var_dump($y); ?>
I would be willing to bet that $x is a float and $y is an int, so the bitwise operator can't compare them. The only workaround I can offer you is this
<?php $x = 3221225472; $y = 1073741824; $x = decbin($x); $y = decbin($y); $bitand = bindec($x & $y); echo "Bitwise and gives $bitand"; ?>
It's a bit kludgy but it forces both $x and $y to be compared as binary numbers, which is what you want =)
Sheridan Saint-Michel Website Administrator FoxJet, an ITW Company www.foxjet.com
----- Original Message -----
From: "Alexey Prohorenko" <green
usa.dp.ua>
To: <php-general
lists.php.net>
Sent: Tuesday, August 28, 2001 1:47 PM
Subject: [PHP] LONGINT... ? to be or not to be?...
> Hello,
>
> I have one question. How can PHP work with longint (in C we call
> them "unsigned long") variables?
> F.e., I want to do next thing:
>
> 65536 & 4096 = 0 (this is right)
> 65536 & 65536 = 65536 (again, everything is okay)
> 196608 & 65536 = 65536 (perfect, it works great)
>
> but,
>
> 3221225472 & 1073741824 = 0 (this is wrong, right answer isn't 0
> but 2147483648)
>
> So, can anybody help me with this? Any suggestions?
>
> Thanks, anyway. Looking forward your answers.
> Will check my mailbox every 5 minutes. :-)
>
> --
> green
> [http://www.extrasy.net]
> [http://www.unix-how-to.net]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
Hello,
you should check the latest version of the manual: http://www.php.net/manual/en/language.types.integer.php
more precisely and specifically the "integer overflow" section.
I think, you should use the arbitrary precision integer extension. http://www.php.net/manual/en/ref.gmp.php
hth
----- Original Message -----
From: Alexey Prohorenko <green
usa.dp.ua>
To: <php-general
lists.php.net>
Sent: Tuesday, August 28, 2001 8:47 PM
Subject: [PHP] LONGINT... ? to be or not to be?...
> Hello,
>
> I have one question. How can PHP work with longint (in C we call
> them "unsigned long") variables?
> F.e., I want to do next thing:
>
> 65536 & 4096 = 0 (this is right)
> 65536 & 65536 = 65536 (again, everything is okay)
> 196608 & 65536 = 65536 (perfect, it works great)
>
> but,
>
> 3221225472 & 1073741824 = 0 (this is wrong, right answer isn't 0
> but 2147483648)
>
> So, can anybody help me with this? Any suggestions?
>
> Thanks, anyway. Looking forward your answers.
> Will check my mailbox every 5 minutes. :-)
>
> --
> green
> [http://www.extrasy.net]
> [http://www.unix-how-to.net]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
Hi
I am having major probs trying to exec a command in PHP. All i want to do is fill a table from a tab delimited file from within PHP. I have set up a file called fillit which consists of: mysqlimport -u user -ppassword database list.txt This works from the command line perfectly. I made this executable & it runs perfectly with .fillit It will not run with exec, system or passthru. I have tried nearly all possible combinations with and without backticks, single, double and no quotes. I have rw access to the dir I am running from and have read the manual until I'm blue in the face! Has anyone out there used the xece command successfully?? Ps if I exec("ls -l"), it works fine !
Linux box Using PHP 4.0.??. latest version MySql, Apache Slackware TIA Terry
attached mail follows:
Hi try shell_exec() --- it seems to work better for some things
HTH
Terry Reynolds wrote:
> Hi > > I am having major probs trying to exec a command in PHP. > All i want to do is fill a table from a tab delimited file from within PHP. > I have set up a file called fillit which consists of: > mysqlimport -u user -ppassword database list.txt > This works from the command line perfectly. > I made this executable & it runs perfectly with .fillit > It will not run with exec, system or passthru. > I have tried nearly all possible combinations with and without backticks, single, double and no quotes. > I have rw access to the dir I am running from and have read the manual until I'm blue in the face! > Has anyone out there used the xece command successfully?? > Ps if I exec("ls -l"), it works fine ! > > Linux box Using PHP 4.0.??. latest version MySql, Apache Slackware > TIA > Terry
-- Dell Coleman, Principal PICO Technology Corp. Victoria, BC Email decolemanhome.com Web http://members.home.com/pico/
attached mail follows:
Instalei o servidor apache e agora estou configurando o php alguém sabe de algum lugar que tenha a instalação passo-a-passo?
Obrigado...
attached mail follows:
Viva,
no ficheiro INSTALL da distribuição do php tens instruções passo-a-passo. Basta segui-las, mas para quem não tem prática pode parecer estranho. Aconselho a ler o ficheiro várias vezes ;)
http://php.net/manual/pt_BR/installation.php
é outra hipotese.. nem tudo está em português.
Boa sorte, Nuno Silva
Daniel Janzen wrote: > Instalei o servidor apache e agora estou configurando o php alguém sabe de algum lugar que tenha a instalação passo-a-passo? > > Obrigado... > >
attached mail follows:
hi everybody!
i have an account at strato (german provider) who hosts my php-scripts. now i want to make a dir with mkdir("../tmp/$id", 0777).... it doesn't work at all eventhough the rights of tmp are set to 777..... the script also doesn't alert anything, not a failed or anything......
does anybody know where the problem may be????
thank you so much.
christian
attached mail follows:
Hello, all. What is the difference between: Case 1: I auth with header('WWW-Auth.......') and validate the user from a plain file. Next, i do something like mysql_connect($the_db_host,$the_db_username,$the_db_pass); mysql_select_db($the_db_name); mysql_query("select * from table"); ----- and it works fine.
Case 2. Without any form of auth, I read the text file and do mysql_connect($the_db_host,$the_db_username,$the_db_pass); mysql_select_db($the_db_name); mysql_query("select * from table");
and the server response is: Error 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock; (111)
What does this auth do with the rights on mysql? Thanks.
Alex Sofronie
maxx
mail.dntis.ro
attached mail follows:
>Case 2. Without any form of auth, I read the text file and do > mysql_connect($the_db_host,$the_db_username,$the_db_pass); > mysql_select_db($the_db_name); > mysql_query("select * from table"); > >and the server response is: >Error 2002: Can't connect to local MySQL server through socket >'/var/lib/mysql/mysql.sock; (111)
This really is a faq.
Mysql.sock normally lives in /tmp think RH puts it in /var/lib PHP can't find it. Might be php.ini looks in /var/lib change it there to match the location of you mysql.sock .. also .. check if mysql is running (ps ax | grep mysql). If it isn't you can't connect to it.
Bye,
B.
attached mail follows:
Please, someone, help me...
What I want to do: Have a user prompted for an ID/password, both of which (if valid), get passed to a PHP script, which then uses the ID/password to selectively display certain fields of a table. (For example, if the user logs in as "Sales", he would only see the sales-related fields of the tables. Whereas, if the user logs in as "Production", she would see the production-related fields. Pretty simple.)
I've read the PHP docs on $PHP_AUTH_USER. One stupid question: Must I use the htaccess directory-protection feature of Apache in order for this to work (or is$PHP_AUTH_USER not dependent on Apache (or any web server) at all)? I mean, from reading the docs, it seems as if the value stored in $PHP_AUTH_USER comes what the user types into the Apache-spawned dialog box (when the user types the URL containing that password-protected directory.)?? The thing is, when I turn password protection on for the directory in question, and add the users and passwords to the htaccess file, then go to the URL in the browser, I get prompted several times for a user and password--first, it seems, by Apache, then by the PHP code I copied from the docs.
If anyone can help, I'd greatly appreciate it. Best would be some real code running in a similar server environment. (The site in question is running on www.fatcow.com servers--they're running PHP3 (shouldn't matter, right) and Apache.)
MUCH thanks in advance...
...Rene
--- Rene Fournier, PLEASErenefournierNOyahooSPAM.com
attached mail follows:
Hi,
There is a few scripts on Zend pages.
I'm sure, this one of them will be very helpful: http://www.zend.com/zend/tut/authentication.php
----- Original Message -----
From: Rene Fournier <rene.fournier
markada.com>
To: <php-general
lists.php.net>
Sent: Tuesday, August 28, 2001 9:24 PM
Subject: [PHP] htaccess and $PHP_AUTH_USER
> Please, someone, help me...
>
> What I want to do: Have a user prompted for an ID/password, both of which
> (if valid), get passed to a PHP script, which then uses the ID/password to
> selectively display certain fields of a table. (For example, if the user
> logs in as "Sales", he would only see the sales-related fields of the
> tables. Whereas, if the user logs in as "Production", she would see the
> production-related fields. Pretty simple.)
>
> I've read the PHP docs on $PHP_AUTH_USER. One stupid question: Must I
use
> the htaccess directory-protection feature of Apache in order for this to
> work (or is$PHP_AUTH_USER not dependent on Apache (or any web server) at
> all)? I mean, from reading the docs, it seems as if the value stored in
> $PHP_AUTH_USER comes what the user types into the Apache-spawned dialog
box
> (when the user types the URL containing that password-protected
> directory.)?? The thing is, when I turn password protection on for the
> directory in question, and add the users and passwords to the htaccess
file,
> then go to the URL in the browser, I get prompted several times for a user
> and password--first, it seems, by Apache, then by the PHP code I copied
from
> the docs.
>
> If anyone can help, I'd greatly appreciate it. Best would be some real
code
> running in a similar server environment. (The site in question is running
> on www.fatcow.com servers--they're running PHP3 (shouldn't matter, right)
> and Apache.)
>
> MUCH thanks in advance...
>
> ...Rene
>
> ---
> Rene Fournier,
> PLEASErenefournierNO
yahooSPAM.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
I have some code I use to create pulldown menus. It's as follows;
$categoryarry = array("","1","2","3","4","5"); while (list($key,$value) = each($categoryarry)) { if ($value == $srch_cat) { $cat_option .= "<option value=\"$value\"selected>$value</option>\n"; } else { $cat_option .= "<option value=\"$value\">$value</option>\n"; } }
It works fine when the pulldown value and displayed text are the same, ie.
<option value="John">John</option>
But now I would like to change so the value is different then what's displayed in the menu, ie.
<option value="1">John</option>
I've never used two dimensional arrays but I thought it might be what I need to look into. Or should I have to arrays and use one for the value and the other for the item displayed in the pulldown menu.
Any help appreciated.
Thanks, Tom
attached mail follows:
this should do it for you.
$categoryarry = array(array("","none"),array("1","John"),array("2","Jim")); foreach($categoryarray as $value) { if($value[0] == $srch_cat) { $cat_option .= "<option value=\"$value[0]\"selected>$value[1]</option>\n"; } else { $cat_option .= "<option value=\"$value[0]\">$value[1]</option>\n"; } }
----- Original Message -----
From: Tom Beidler <tom
orbittechservices.com>
To: php list <php-general
lists.php.net>
Sent: Tuesday, August 28, 2001 12:23
Subject: [PHP] two dimensional array or two arrays?
> I have some code I use to create pulldown menus. It's as follows;
>
> $categoryarry = array("","1","2","3","4","5");
> while (list($key,$value) = each($categoryarry)) {
> if ($value == $srch_cat) {
> $cat_option .= "<option value=\"$value\"selected>$value</option>\n";
> } else {
> $cat_option .= "<option value=\"$value\">$value</option>\n";
> }
> }
>
> It works fine when the pulldown value and displayed text are the same, ie.
>
> <option value="John">John</option>
>
> But now I would like to change so the value is different then what's
> displayed in the menu, ie.
>
> <option value="1">John</option>
>
> I've never used two dimensional arrays but I thought it might be what I
need
> to look into. Or should I have to arrays and use one for the value and the
> other for the item displayed in the pulldown menu.
>
> Any help appreciated.
>
> Thanks,
> Tom
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
>
attached mail follows:
Your $categoryarry is a 2d array, try :
print_r($categoryarry);
But, I think you want to do :
$categories = array('Sasheen','Tom','Fred');
Now, if you do this :
while(list($key,$value) = each($categories)) { print "$key : $value\n"; }
You'll get :
0 : Sasheen 1 : Tom 2 : Fred
Could also define your array like so :
$categories = array('a' => 'foo', 'b' => 'bar');
Which, if run through our loop above, will give us :
a : foo b : bar
See? Play with it a bit, it'll start to make more and more sense.
Regards, Philip
On Tue, 28 Aug 2001, Tom Beidler wrote:
> I have some code I use to create pulldown menus. It's as follows;
>
> $categoryarry = array("","1","2","3","4","5");
> while (list($key,$value) = each($categoryarry)) {
> if ($value == $srch_cat) {
> $cat_option .= "<option value=\"$value\"selected>$value</option>\n";
> } else {
> $cat_option .= "<option value=\"$value\">$value</option>\n";
> }
> }
>
> It works fine when the pulldown value and displayed text are the same, ie.
>
> <option value="John">John</option>
>
> But now I would like to change so the value is different then what's
> displayed in the menu, ie.
>
> <option value="1">John</option>
>
> I've never used two dimensional arrays but I thought it might be what I need
> to look into. Or should I have to arrays and use one for the value and the
> other for the item displayed in the pulldown menu.
>
> Any help appreciated.
>
> Thanks,
> Tom
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
an somebody please fix up my query.
$connection =
mysql_connect("l", "c", "c") or die("Couldn't connect.");
$db =
mysql_select_db($db_name, $connection) or die("Couldn't select
database.");
$sql = "SELECT distinct users.uid , users.username FROM users LEFT OUTER JOIN picks using(id) Where users.uid <> picks.user_id ";
$result =
mysql_query($sql,$connection) or die("Couldn't execute query.");
while ($row = mysql_fetch_array($result)) { $usersleft = $row['username']; $uid = $row['uid'];
$my_string="$usersleft<br>";
echo $my_string; }
attached mail follows:
On Mar 28 Ago 2001 17:29, Jeremy Morano wrote:
> an somebody please fix up my query.
>
>
>
>
> $connection =
mysql_connect("l", "c", "c") or die("Couldn't connect.");
>
> $db =
mysql_select_db($db_name, $connection) or die("Couldn't select
> database.");
>
>
>
> $sql = "SELECT distinct users.uid , users.username
> FROM users LEFT OUTER JOIN picks using(id)
Am I an ignorant, or MySQL doesn't have OUTER JOINs!!!!
> Where users.uid <> picks.user_id > "; [snip]
Saludos... :-)
-- Porqué usar una base de datos relacional cualquiera, si podés usar PostgreSQL? ----------------------------------------------------------------- Martín Marqués | mmarquesunl.edu.ar Programador, Administrador, DBA | Centro de Telematica Universidad Nacional del Litoral -----------------------------------------------------------------
attached mail follows:
It has outer joins:
http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#JOI N
HTH
Sam Masiello
Software Quality Assurance Engineer
Synacor
(716) 853-1362 x289
smasiello
synacor.com
-----Original Message-----
From: Martín Marqués [mailto:martin
bugs.unl.edu.ar]
Sent: Tuesday, August 28, 2001 4:35 PM
To: jeremy
prepresshelp.com; php-general
lists.php.net
Subject: Re: [PHP] fix my query please
On Mar 28 Ago 2001 17:29, Jeremy Morano wrote:
> an somebody please fix up my query.
>
>
>
>
> $connection =
mysql_connect("l", "c", "c") or die("Couldn't connect.");
>
> $db =
mysql_select_db($db_name, $connection) or die("Couldn't select
> database.");
>
>
>
> $sql = "SELECT distinct users.uid , users.username
> FROM users LEFT OUTER JOIN picks using(id)
Am I an ignorant, or MySQL doesn't have OUTER JOINs!!!!
> Where users.uid <> picks.user_id > "; [snip]
Saludos... :-)
-- Porqué usar una base de datos relacional cualquiera, si podés usar PostgreSQL? ----------------------------------------------------------------- Martín Marqués | mmarquesunl.edu.ar Programador, Administrador, DBA | Centro de Telematica Universidad Nacional del Litoral -----------------------------------------------------------------
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
Prezados,
Estou recebendo mensagem de erro ODBC32.DLL
O que está errado ?
Obrigado...
attached mail follows:
Rasmus Lerdorf wrote: > > That's not allowing me to simply dl() an SO file, because I don't have the > > SO file to start with - that's what I was trying to get at. If I have > > to reconfigure > > everything, there's not much point, I don't think. Unless I'm missing > > something > > obvious. I'd like to be able to simply have an SO file I can dl() > > without recompiling. > > Or are you saying that that configure statement WILL create an SO file > > that can > > be dl()ed later, without recompiling PHP? > > Exactly. When you do ./configure --with-foo=shared; make > then modules/foo.so will appear magically and you can dl() that or load it > using "extension=foo.so" in your php.ini. You don't have to recompile > PHP. > > -Rasmus I am afraid that is only theory. I tried that for the snmp module and all I get is a linker error about unreferenced symbols, when I try to load it. Heiko
attached mail follows:
> > Exactly. When you do ./configure --with-foo=shared; make > > then modules/foo.so will appear magically and you can dl() that or load it > > using "extension=foo.so" in your php.ini. You don't have to recompile > > PHP. > > > > -Rasmus > > I am afraid that is only theory. I tried that for the snmp module and all I get > > is a linker error about unreferenced symbols, when I try to load it.
Which symbols?
-Rasmus
attached mail follows:
Rasmus
Thanks for your very full and thoughtful reply
> Surely there are things we can improve upon, but the current statement of > the problem whichs assumes that Perl and Java are lightyears ahead of PHP > when it comes to extending their functionality just isn't true.
I am not very technical, as you will have gathered. But all I can do is pass on the view of my (rather good) ISP. They offer Java, Perl and PHP, and say that they find PHP much the most difficult to extend. As other responses have pointed out, Perl and Java, while not perfect in this area, do seem to offer a number of advantages.
You ask for practical suggestions. Well, it is clearly a fair comment to say that you can't offer 200 certified libraries on every platform that compiles PHP. But you could surely make a very large dent in the problem with a very much smaller initiative.
Being practical, the vast majority of serious PHP applications will be running on Linux. If you were to cover RedHat, and .rpm compatible distros such as SuSE, you would cover the requirements of perhaps the majority of users.
You could also prioritise the libraries. I would suggest that there are a number that are clearly of strategic importance for using PHP in mission critical settings: XML, encryption, graphics etc. I would guess that perhaps 20 or 30 libraries would cover 80% of user needs. The development team would have a pretty good idea of the priorities, I would imagine, or you could run a poll through this list.
So if you define the initial task as providing a practical way to add around 25 certified libraries to RedHat and compatible distros (ideally on the fly), the issue would surely be more managable, yet any solution would make a big impact on the problem. I guess that something as convenient as the Apache module system would be the ideal for ISPs. I am not qualified to comment on the best technical solution, but I suspect the mechanisms are already in place in the current version of PHP.
I have no direct experience of this field, but I suspect that companies like RedHat and SuSE might be open to some kind of partnership here and sponsor the project. Or Zend ( or RedHat or SuSE) could develop an extended distro as a commercial product - I don't see that ISPs and corporates would object to paying a modest sum for a tested and certified distro with extended functionality.
Obviously, coders like to code. The other stuff is just an unwelcome distraction. But there are two other issues that contribute greatly to the viability of any application - documentation and installation/configuration. With documentation, I am sure that the whole community would congratulate the PHP team on what they have achieved. It would be great if you could make similar progress with installation/configuration.
What do you think? Does any of this suggest a practical way forward?
Geoff Caplan
attached mail follows:
> Being practical, the vast majority of serious PHP applications will be > running on Linux. If you were to cover RedHat, and .rpm compatible distros > such as SuSE, you would cover the requirements of perhaps the majority of > users.
But RedHat, SuSE, Mandrake, Debian and FreeBSD already have designated people who do exactly this. For example, have a look here:
http://rpmfind.net/linux/RPM/rawhide/1.0/i386/PByName.html
Note the php-* rpms:
php-4.0.6-6 php-devel-4.0.6-6 php-imap-4.0.6-6 php-ldap-4.0.6-6 php-manual-4.0.6-6 php-mysql-4.0.6-6 php-odbc-4.0.6-6 php-pgsql-4.0.6-6
And before you go off and complain about all the missing ones, take a look at all the dependencies for the base php rpm:
libbz2.so.1 libcrypto.so.2 libcrypt.so.1 libc.so.6 libcurl.so.1 libdb-3.2.so libdl.so.2 libfreetype.so.6 libgdbm.so.2 libgd.so.1.8 libjpeg.so.62 libltdl.so.3 libmm.so.11 libm.so.6 libnsl.so.1 libpam.so.0 libpng.so.2 libpspell-modules.so.1 libpspell.so.4 libresolv.so.2 libssl.so.2 libstdc++-libc6.2-2.so.3 libttf.so.2 libxml2.so.2 libz.so.1
That's a pretty good list. And the Mandrake and Debian packages are every bit as complete. I am not as familiar with SuSE nor the fbsd port, but I would be very surprised if they were not very close to, if not better than, the current RedHat rpms.
I don't agree that we should take away the responsibility of creating these binary distributions of PHP from the distribution maintainers out there. If they are not doing a good job, or if there are specific problems with their packaging of PHP, submit a bug report to them. If they determine that something in PHP itself it preventing them from packaging it nicely, they will hopefully let us know and we can address it.
> What do you think? Does any of this suggest a practical way forward?
Not really no, since I still don't have anything concrete to go on. "I have heard that ...", "someone said that it didn't work..." Stuff like this doesn't really give us anything to sink out teeth into. What exactly is the ISP having trouble with? What is the error message? What sort of setup do they have? Or, is the problem really that they are just more familiar with other technologies and are just feeding you a line to get you to go away?
-Rasmus
attached mail follows:
It's actually a recursive acronym, like GNU:
From the manual:
"PHP, which stands for 'PHP: Hypertext Preprocessor', is an HTML-embedded scripting language."
J
Jon wrote:
> Hmm although the answer was "Personal Home Page Tools" and is now > "Hypertext Preprocessor" when people ask me, I say "Pre-Hypertext > Processor" > > Its the same meaning, and puts the letters in the correct order, so as not > to confuse people.
attached mail follows:
At 05:15 PM 8/28/01 +0228, you wrote: >It's actually a recursive acronym, like GNU: > > From the manual: > >"PHP, which stands for 'PHP: Hypertext Preprocessor', is an HTML-embedded >scripting language." > >J
Am I making things up, or Did it stand for Perl Hypertext Preprocessor at one time?
attached mail follows:
On Mar 28 Ago 2001 19:52, John Meyer wrote: > At 05:15 PM 8/28/01 +0228, you wrote: > >It's actually a recursive acronym, like GNU: > > > > From the manual: > > > >"PHP, which stands for 'PHP: Hypertext Preprocessor', is an HTML-embedded > >scripting language." > > > >J > > Am I making things up, or Did it stand for Perl Hypertext Preprocessor at > one time?
I always thought it meant Personal Home Page (isn't this right?)
Saludos.... :-)
-- Porqué usar una base de datos relacional cualquiera, si podés usar PostgreSQL? ----------------------------------------------------------------- Martín Marqués | mmarquesunl.edu.ar Programador, Administrador, DBA | Centro de Telematica Universidad Nacional del Litoral -----------------------------------------------------------------
attached mail follows:
I believe that it was called Personal Home Page during version 2, and if I'm not mistaken, there was a contest (sorta) around the time 3 was released to find a new name.
On Tuesday 28 August 2001 03:08 pm, you wrote: > On Mar 28 Ago 2001 19:52, John Meyer wrote: > > At 05:15 PM 8/28/01 +0228, you wrote: > > >It's actually a recursive acronym, like GNU: > > > > > > From the manual: > > > > > >"PHP, which stands for 'PHP: Hypertext Preprocessor', is an > > > HTML-embedded scripting language." > > > > > >J > > > > Am I making things up, or Did it stand for Perl Hypertext Preprocessor at > > one time? > > I always thought it meant Personal Home Page (isn't this right?) > > Saludos.... :-)
-- Lactomangulation, n.: Manhandling the "open here" spout on a milk carton so badly that one has to resort to using the "illegal" side. -- Rich Hall, "Sniglets"
attached mail follows:
From what I heard, the acronym originally stood for Personal Home Page, but it kind of changed (unofficially?) to Hypertext Preprocessor.
I could be wrong
-----Original Message-----
From: Martín Marqués [mailto:martin
bugs.unl.edu.ar]
Sent: Tuesday, August 28, 2001 3:08 PM
To: John Meyer; php-general
lists.php.net
Subject: Re: [PHP] What does PHP stand for?
On Mar 28 Ago 2001 19:52, John Meyer wrote: > At 05:15 PM 8/28/01 +0228, you wrote: > >It's actually a recursive acronym, like GNU: > > > > From the manual: > > > >"PHP, which stands for 'PHP: Hypertext Preprocessor', is an > >HTML-embedded scripting language." > > > >J > > Am I making things up, or Did it stand for Perl Hypertext Preprocessor > at one time?
I always thought it meant Personal Home Page (isn't this right?)
Saludos.... :-)
-- Porqué usar una base de datos relacional cualquiera, si podés usar PostgreSQL? ----------------------------------------------------------------- Martín Marqués | mmarquesunl.edu.ar Programador, Administrador, DBA | Centro de Telematica Universidad Nacional del Litoral -----------------------------------------------------------------
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
Hi,
Don't know if this is the best place to ask, but I thought I would give it a try.
I was just wondering if anyone knows of any databases which deal with data duplication (at a low level). Say I have two (or ten) identical records, does anyone know of any databases which would only keep one copy of the data and use references for the other records? Does this work if 7 out of the 8 columns (for instance) are identical (ie the primary key is different but everything else is identical). Do such db's exist? Or do they all do this? Or am I just dreaming?
J
-- Julian WoodProgrammer/Analyst University of Calgary
attached mail follows:
I have a problem... I want to check the last modified time that a file was changed/updated. Actually, it's an employee database that I'm working on and I thought about just checking the last modified date on the file that the information was stored on. However, I get a permission denied error and I don't want to change the permissions of the file. Is there an easy way to check to see when the last time anyone logged in and updated their 'employee' information?
Thanks, jay
attached mail follows:
Well, you could change just to look at this.
Use php's functions to change, check the last modified, and change it back. Should take a few micro-seconds ;-) and it only uses php.
--Julio Nobrega
A hora está chegando: http://toca.sourceforge.net "Jay Paulson" <jpaulson
lbjs.com> wrote in message news:008001c13008$5c766860$3c00a8c0
webdesign... > I have a problem... I want to check the last modified time that a file was > changed/updated. Actually, it's an employee database that I'm working on > and I thought about just checking the last modified date on the file that > the information was stored on. However, I get a permission denied error and > I don't want to change the permissions of the file. Is there an easy way to > check to see when the last time anyone logged in and updated their > 'employee' information? > > Thanks, > jay >
attached mail follows:
did you try stat()'ing the file?
as long as you have read permission to the file, you should be able to run a stat() on the file with no problems
> -----Original Message-----
> From: Jay Paulson [mailto:jpaulson
lbjs.com]
> Subject: [PHP] Last Modified question..
>
> I have a problem... I want to check the last modified time that a file was
> changed/updated. Actually, it's an employee database that I'm working on
> and I thought about just checking the last modified date on the file that
> the information was stored on. However, I get a permission denied error and
> I don't want to change the permissions of the file. Is there an easy way to
> check to see when the last time anyone logged in and updated their
> 'employee' information?
>
> Thanks,
> jay
attached mail follows:
I am using PHP 4.0.6 and when I run the following code I get nothing back except the error code 27 and a message saying SSL: couldn't create a context I can run the same thing from the command line and it works perfectly does anyone have any ideas on this? Thanks in advance for any help, Steve Dowell $q_auth = $login.":".$pw; $fp = fopen("c:Scan_files/test_10.xml","w"); $ch = curl_init("https://www.foo.com/msp/some_report_list.php"); curl_setopt($ch, CURLOPT_USERPWD,$q_auth); curl_setopt($ch, CURLOPT_FAILONERROR, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_FILE,$fp); curl_setopt($ch, CURLOPT_NOPROGRESS,0); curl_setopt($ch, CURLOPT_VERBOSE,1); $result=curl_exec ($ch); echo curl_errno($ch)."<br>"; echo curl_error($ch); curl_close ($ch); echo "result=".$result; $fp = fclose;
attached mail follows:
hi friends,
Can someone post here "the" most efficient method to validate a variable as numeric? I see a ton of hacks/ways in the manual user comments under is_int, is_integer and is_numeric and would like to see just one or two good solid ones. And please, no regular expressions :)
Regards, Philip
attached mail follows:
do you mean, as in,
if !is_integer($var) { print("$var is not an integer"); }
--- Philip Olson <philip
cornado.com> wrote:
> hi friends,
>
> Can someone post here "the" most efficient method to
> validate a variable
> as numeric? I see a ton of hacks/ways in the manual
> user comments under
> is_int, is_integer and is_numeric and would like to
> see just one or two
> good solid ones. And please, no regular expressions
> :)
>
> Regards,
> Philip
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> php-general-unsubscribe
lists.php.net
> For additional commands, e-mail:
> php-general-help
lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin
lists.php.net
>
__________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
attached mail follows:
Hi Daniel,
No, I mean if it's numeric, not neccesarily an integer. As the following is numeric and not an integer but rather, a string :
$num = '123';
Anyone have an authoritative answer on this? Like, something that would go in the manual as the official php3 is_numeric check?
Regards, Philip
On Tue, 28 Aug 2001, daniel james wrote:
> do you mean, as in,
>
> if !is_integer($var) {
> print("$var is not an integer");
> }
>
> --- Philip Olson <philip
cornado.com> wrote:
> > hi friends,
> >
> > Can someone post here "the" most efficient method to
> > validate a variable
> > as numeric? I see a ton of hacks/ways in the manual
> > user comments under
> > is_int, is_integer and is_numeric and would like to
> > see just one or two
> > good solid ones. And please, no regular expressions
> > :)
> >
> > Regards,
> > Philip
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail:
> > php-general-unsubscribe
lists.php.net
> > For additional commands, e-mail:
> > php-general-help
lists.php.net
> > To contact the list administrators, e-mail:
> > php-list-admin
lists.php.net
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/
>
attached mail follows:
Hi Philip,
By definition, any string that does not contain alpha-characters is numeric. I mean, '123' is an integer, if only because it isn't 'onetwothree', you know?
Because if I do this:
$num1 = '123'; $num2 = '456'; $total = $num1 + $num2; print($total);
the total is going to be 579. You know?
I guess I'm not following you. Maybe if you give me the problem in context I can help.
-dj
--- Philip Olson <philip
cornado.com> wrote:
>
> Hi Daniel,
>
> No, I mean if it's numeric, not neccesarily an
> integer. As the following
> is numeric and not an integer but rather, a string :
>
>
> $num = '123';
>
> Anyone have an authoritative answer on this? Like,
> something that would
> go in the manual as the official php3 is_numeric
> check?
>
> Regards,
> Philip
>
>
> On Tue, 28 Aug 2001, daniel james wrote:
>
> > do you mean, as in,
> >
> > if !is_integer($var) {
> > print("$var is not an integer");
> > }
> >
> > --- Philip Olson <philip
cornado.com> wrote:
> > > hi friends,
> > >
> > > Can someone post here "the" most efficient
> method to
> > > validate a variable
> > > as numeric? I see a ton of hacks/ways in the
> manual
> > > user comments under
> > > is_int, is_integer and is_numeric and would like
> to
> > > see just one or two
> > > good solid ones. And please, no regular
> expressions
> > > :)
> > >
> > > Regards,
> > > Philip
> > >
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail:
> > > php-general-unsubscribe
lists.php.net
> > > For additional commands, e-mail:
> > > php-general-help
lists.php.net
> > > To contact the list administrators, e-mail:
> > > php-list-admin
lists.php.net
> > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Make international calls for as low as $.04/minute
> with Yahoo! Messenger
> > http://phonecard.yahoo.com/
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> php-general-unsubscribe
lists.php.net
> For additional commands, e-mail:
> php-general-help
lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin
lists.php.net
>
__________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
attached mail follows:
i think he's asking for a numeric test, not an integer test.
your example looks like it should fail "3.50" (for example), even though "3.50" is a perfectly valid numeric value.
personally, i think you should just use regexps. ;-)
i tried to write a little is_num() type function, but i kept getting caught on split(); it seems that split() converts everything to string, no matter what. so if you try to split on the decimal point of 45.67 ... you get two strings, "45" and "67" not 45 and 67, so subsequent is_integer() calls fail (since is_integer() checks the *type* of the variable, not the *value* -- very important to keep in mind)
here's what i came up with... perhaps it will be of some help to you (even though it doesnt work)
function is_num($number) {
// $x contains number, $y contains any decimal value list ($x, $y) = split("\.", $number);
// if there's no decimal value if ( empty($y) ) { return is_int($x); } else { return ( is_int($x) && is_int($y) ); }
}
> -----Original Message-----
> From: daniel james [mailto:cgi_guy1313
yahoo.com]
> Subject: Re: [PHP] is_numeric for php3
>
> do you mean, as in,
>
> if !is_integer($var) {
> print("$var is not an integer");
> }
>
attached mail follows:
Ahhh, in that context, with is_integer(), i think you're partially right. however, i looked it up, and is_numeric() will work fine.
http://www.php.net/manual/en/function.is-numeric.php
btw-- as for the regexps, none for me, thanks ;) those things give me the heebie-jeebies.
--- "scott [gts]" <scott
graphictype.com> wrote:
> i think he's asking for a numeric test, not an
> integer test.
>
> your example looks like it should fail "3.50" (for
> example),
> even though "3.50" is a perfectly valid numeric
> value.
>
> personally, i think you should just use regexps. ;-)
>
> i tried to write a little is_num() type function,
> but i kept
> getting caught on split(); it seems that split()
> converts
> everything to string, no matter what. so if you try
> to split
> on the decimal point of 45.67 ... you get two
> strings, "45" and "67"
> not 45 and 67, so subsequent is_integer() calls fail
>
> (since is_integer() checks the *type* of the
> variable,
> not the *value* -- very important to keep in mind)
>
> here's what i came up with... perhaps it will be of
> some
> help to you (even though it doesnt work)
>
>
> function is_num($number) {
>
> // $x contains number, $y contains any decimal
> value
> list ($x, $y) = split("\.", $number);
>
> // if there's no decimal value
> if ( empty($y) ) {
> return is_int($x);
> }
> else {
> return ( is_int($x) && is_int($y) );
> }
>
> }
>
>
> > -----Original Message-----
> > From: daniel james [mailto:cgi_guy1313
yahoo.com]
> > Subject: Re: [PHP] is_numeric for php3
> >
> > do you mean, as in,
> >
> > if !is_integer($var) {
> > print("$var is not an integer");
> > }
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> php-general-unsubscribe
lists.php.net
> For additional commands, e-mail:
> php-general-help
lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin
lists.php.net
>
__________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
attached mail follows:
well. sure, is_numeric() will work, but the point of the exercise is to try and determine if a number is numeric without actually calling is_numeric() or regexps.
personally, i think that regexps are swiss-army knives, they can do almost anything -- i use them all the time, although it took me a few months to fully understand them and get over regexp-heebie-jeebies of my own.
> -----Original Message-----
> From: daniel james [mailto:cgi_guy1313
yahoo.com]
> Sent: Tuesday, August 28, 2001 6:42 PM
> To: scott [gts]; php
> Subject: RE: [PHP] is_numeric for php3
>
>
> Ahhh, in that context, with is_integer(), i think
> you're partially right. however, i looked it up, and
> is_numeric() will work fine.
>
> http://www.php.net/manual/en/function.is-numeric.php
>
> btw-- as for the regexps, none for me, thanks ;)
> those things give me the heebie-jeebies.
>
> --- "scott [gts]" <scott
graphictype.com> wrote:
> > i think he's asking for a numeric test, not an
> > integer test.
> >
> > your example looks like it should fail "3.50" (for
> > example),
> > even though "3.50" is a perfectly valid numeric
> > value.
> >
> > personally, i think you should just use regexps. ;-)
> >
> > i tried to write a little is_num() type function,
> > but i kept
> > getting caught on split(); it seems that split()
> > converts
> > everything to string, no matter what. so if you try
> > to split
> > on the decimal point of 45.67 ... you get two
> > strings, "45" and "67"
> > not 45 and 67, so subsequent is_integer() calls fail
> >
> > (since is_integer() checks the *type* of the
> > variable,
> > not the *value* -- very important to keep in mind)
> >
> > here's what i came up with... perhaps it will be of
> > some
> > help to you (even though it doesnt work)
> >
> >
> > function is_num($number) {
> >
> > // $x contains number, $y contains any decimal
> > value
> > list ($x, $y) = split("\.", $number);
> >
> > // if there's no decimal value
> > if ( empty($y) ) {
> > return is_int($x);
> > }
> > else {
> > return ( is_int($x) && is_int($y) );
> > }
> >
> > }
> >
> >
> > > -----Original Message-----
> > > From: daniel james [mailto:cgi_guy1313
yahoo.com]
> > > Subject: Re: [PHP] is_numeric for php3
> > >
> > > do you mean, as in,
> > >
> > > if !is_integer($var) {
> > > print("$var is not an integer");
> > > }
> > >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail:
> > php-general-unsubscribe
lists.php.net
> > For additional commands, e-mail:
> > php-general-help
lists.php.net
> > To contact the list administrators, e-mail:
> > php-list-admin
lists.php.net
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/
>
attached mail follows:
my understanding is that numeric is a broad term for number values (any value with only numbers and a decimal point) like 1, 5.6, 332, 0.5532, for example.
integers are a sub-set of numerics, so any integer is a numeric value, but any numeric value is not necessarily an integer.
$num=123 is an integer *and* numeric value.
$num='123' might not be an integer, but it is a numeric.
now the problem of how to devise a proper test for numeric values (without using regexps) is what i'd like to see.
> -----Original Message-----
> From: daniel james [mailto:cgi_guy1313
yahoo.com]
> Subject: Re: [PHP] is_numeric for php3
>
> Hi Philip,
>
> By definition, any string that does not contain
> alpha-characters is numeric. I mean, '123' is an
> integer, if only because it isn't 'onetwothree', you
> know?
attached mail follows:
You can use sprintf() to determine if a number is numeric or not. /* Return TRUE if numeric and FALSE if not. */ function is_numeric_php3($var) { if( !isset($var) ) return FALSE; if( $var==0 ) return TRUE;
if( sprintf("%f", $var) ) return TRUE; else return FALSE: }
This code seems to work and runs faster then a regex.
On Tuesday 28 August 2001 18:42, daniel james wrote:
> Ahhh, in that context, with is_integer(), i think
> you're partially right. however, i looked it up, and
> is_numeric() will work fine.
>
> http://www.php.net/manual/en/function.is-numeric.php
>
> btw-- as for the regexps, none for me, thanks ;)
> those things give me the heebie-jeebies.
>
> --- "scott [gts]" <scott
graphictype.com> wrote:
> > i think he's asking for a numeric test, not an
> > integer test.
> >
> > your example looks like it should fail "3.50" (for
> > example),
> > even though "3.50" is a perfectly valid numeric
> > value.
> >
> > personally, i think you should just use regexps. ;-)
> >
> > i tried to write a little is_num() type function,
> > but i kept
> > getting caught on split(); it seems that split()
> > converts
> > everything to string, no matter what. so if you try
> > to split
> > on the decimal point of 45.67 ... you get two
> > strings, "45" and "67"
> > not 45 and 67, so subsequent is_integer() calls fail
> >
> > (since is_integer() checks the *type* of the
> > variable,
> > not the *value* -- very important to keep in mind)
> >
> > here's what i came up with... perhaps it will be of
> > some
> > help to you (even though it doesnt work)
> >
> >
> > function is_num($number) {
> >
> > // $x contains number, $y contains any decimal
> > value
> > list ($x, $y) = split("\.", $number);
> >
> > // if there's no decimal value
> > if ( empty($y) ) {
> > return is_int($x);
> > }
> > else {
> > return ( is_int($x) && is_int($y) );
> > }
> >
> > }
> >
> > > -----Original Message-----
> > > From: daniel james [mailto:cgi_guy1313
yahoo.com]
> > > Subject: Re: [PHP] is_numeric for php3
> > >
> > > do you mean, as in,
> > >
> > > if !is_integer($var) {
> > > print("$var is not an integer");
> > > }
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail:
> > php-general-unsubscribe
lists.php.net
> > For additional commands, e-mail:
> > php-general-help
lists.php.net
> > To contact the list administrators, e-mail:
> > php-list-admin
lists.php.net
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/
attached mail follows:
if (($var!=0) && ($var*1!=0) && is_int($var*1)) { echo "is int"; $var=$var*1; } else { echo "is not int"; $var=1; }
Works for me because I need an integer greater than 0. Try it out and let me know any problems with it.
- seb
-----Original Message-----
From: Philip Olson [mailto:philip
cornado.com]
Sent: 28 August 2001 22:44
To: php-general
lists.php.net
Subject: [PHP] is_numeric for php3
hi friends,
Can someone post here "the" most efficient method to validate a variable as numeric? I see a ton of hacks/ways in the manual user comments under is_int, is_integer and is_numeric and would like to see just one or two good solid ones. And please, no regular expressions :)
Regards, Philip
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
--- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001
attached mail follows:
At 03:41 PM 8/28/01 , scott [gts] wrote: >my understanding is that numeric is a broad term for >number values (any value with only numbers and a >decimal point) like 1, 5.6, 332, 0.5532, for example. > >integers are a sub-set of numerics, so any integer is >a numeric value, but any numeric value is not >necessarily an integer. > >$num=123 is an integer *and* numeric value. > >$num='123' might not be an integer, but it is >a numeric. > >now the problem of how to devise a proper test for >numeric values (without using regexps) is what i'd >like to see.
function is_numeric($Something) { return (string)(1.0*$Something) == $Something; }
should work.
-steve
+------------------------------------------------------------------------+
| Steve Edberg University of California, Davis |
| sbedberg
ucdavis.edu (530)754-9127 |
| http://aesric.ucdavis.edu/ http://pgfsun.ucdavis.edu/ |
+---------------------- Gort, Klaatu barada nikto! ----------------------+
attached mail follows:
Hello, I have a variable with a string in it. I want to check if in that string a certain word is in it. Example $var = "This is a good sentence"; $check = look("good", $var); and $check would equal 1 since "good" is in that string does anyone know how to do this?
attached mail follows:
see :
http://www.php.net/strstr http://www.php.net/stristr
Regards, Philip
On Tue, 28 Aug 2001, Brandon Orther wrote:
> Hello, > > I have a variable with a string in it. I want to check if in that > string a certain word is in it. Example > > $var = "This is a good sentence"; > > $check = look("good", $var); > > > and $check would equal 1 since "good" is in that string > > > > > does anyone know how to do this? >
attached mail follows:
if you're just looking for the 1st occurrence of the string, it's--
$check = "good"; $var = "This is a good...";
if (!strstr($var, $check)) { print("$check not found"); }
also, i think strstr() is case-insensitive, so it won't be able to differentiate between 'Good' and 'good', and will NOT return FALSE if 'Good' precedes 'good' in the string...
-dj
--- Brandon Orther <orther
webintellects.com> wrote:
> Hello,
>
> I have a variable with a string in it. I want to
> check if in that
> string a certain word is in it. Example
>
> $var = "This is a good sentence";
>
> $check = look("good", $var);
>
>
> and $check would equal 1 since "good" is in that
> string
>
>
>
>
> does anyone know how to do this?
>
__________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
attached mail follows:
use regexps. that's what their specialty is ;-)
// case insensitive if ( preg_match("/$text/i", $string) ) { print "$text is in $string"; }
// case sensitive if ( preg_match("/$text/", $string) ) { print "$text is in $string"; }
> -----Original Message-----
> From: daniel james [mailto:cgi_guy1313
yahoo.com]
> Sent: Tuesday, August 28, 2001 6:11 PM
> To: Brandon Orther; PHP User Group
> Subject: Re: [PHP] Check if a word is in my string.
>
>
> if you're just looking for the 1st occurrence of the
> string, it's--
>
> $check = "good";
> $var = "This is a good...";
>
> if (!strstr($var, $check)) {
> print("$check not found");
> }
>
> also, i think strstr() is case-insensitive, so it
> won't be able to differentiate between 'Good' and
> 'good', and will NOT return FALSE if 'Good' precedes
> 'good' in the string...
>
> -dj
>
>
> --- Brandon Orther <orther
webintellects.com> wrote:
> > Hello,
> >
> > I have a variable with a string in it. I want to
> > check if in that
> > string a certain word is in it. Example
> >
> > $var = "This is a good sentence";
> >
> > $check = look("good", $var);
> >
> >
> > and $check would equal 1 since "good" is in that
> > string
> >
> >
> >
> >
> > does anyone know how to do this?
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
Hi,
use: preg_match('/\Wgood\W/',$var); or preg_match('/\bgood\b/',$var);
I don't know exactly.
----- Original Message -----
From: Brandon Orther <orther
webintellects.com>
To: PHP User Group <php-general
lists.php.net>
Sent: Wednesday, August 29, 2001 12:02 AM
Subject: [PHP] Check if a word is in my string.
> Hello, > > I have a variable with a string in it. I want to check if in that > string a certain word is in it. Example > > $var = "This is a good sentence"; > > $check = look("good", $var); > > > and $check would equal 1 since "good" is in that string > > > > > does anyone know how to do this? >
attached mail follows:
> use: > preg_match('/\Wgood\W/',$var); > or > preg_match('/\bgood\b/',$var);
Or, you could just try strstr($haystack, $needle) ...
Jason
-- Jason Murray jasonmmelbourneit.com.au Web Developer, Melbourne IT "Work now, freak later!"
attached mail follows:
Is there any function that will allow me to check to see if a link is valid?
attached mail follows:
although it's a bit klunky (and not entirely correct) to do things this way, but a simple fopen(); will tell you if the URL is retrievable or not.
(although i dont think that fopen() handles redirects or any of those esoteric HTTP features)
but if you want to make sure that a link is there, with no SSL, redirects, or any other stuff, fopen() should be more than sufficient.
> -----Original Message-----
> From: Adam Plocher [mailto:aplocher
erepublic.com]
> Sent: Tuesday, August 28, 2001 6:09 PM
> To: 'php-general
lists.php.net'
> Subject: [PHP] Link Checker
>
>
> Is there any function that will allow me to check to see if a link is valid?
>
attached mail follows:
I am trying to send data from a textarea into a blob and then when retrieving the data populating a row in a html table with the text wrapping as per the wrap in the textarea.
I keep getting the record in one long line of text that goes off the screen (ie the horizontal scrollbars show).
Any help would be appreciated.
Will.
attached mail follows:
On Wed, 29 Aug 2001 08:07, freshNet wrote: > I am trying to send data from a textarea into a blob and then when > retrieving the data populating a row in a html table with the text > wrapping as per the wrap in the textarea. > > I keep getting the record in one long line of text that goes off the > screen (ie the horizontal scrollbars show). > > Any help would be appreciated. > > Will.
nl2br() assuming that you have WRAP set in your TEXTAREA
-- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIANEWS! Survivor of siamese twins joins parents
attached mail follows:
$query = "SELECT mpn_job.ID, job, assigned_to, status_date, category"; $query .= "FROM mpn_job, mpn_job_category WHERE CID = mpn_job_category.ID"; $query .= "AND category = '$category'"; $result = mysql_query($query); $row = mysql_fetch_row($result); foreach ($row as $data) { echo "$data[0]"; }
I tried the SELECT statement from mysql command line (less $category, I used an actual category name) and it works there. I try it out in php, and I get nothing. (I echoed $category before this and it works correctly) Do you guys see anything in there that may need correcting? Thanks.
attached mail follows:
"Gerard Samuel" <trini0
optonline.net> wrote in message
news:3B8C1CA2.6050205
optonline.net...
> $query = "SELECT mpn_job.ID, job, assigned_to, status_date, category";
> $query .= "FROM mpn_job, mpn_job_category WHERE CID =
> mpn_job_category.ID";
> $query .= "AND category = '$category'";
> $result = mysql_query($query);
> $row = mysql_fetch_row($result);
> foreach ($row as $data) {
> echo "$data[0]";
> }
>
> I tried the SELECT statement from mysql command line (less $category, I
> used an actual category name) and it works there. I try it out in php,
> and I get nothing. (I echoed $category before this and it works
> correctly) Do you guys see anything in there that may need correcting?
Sure - you need to have an extra space at the end of each line... right now, it comes out like ... status_date, categoryFROM mpn_job ... ... mpn_job_category.IDAND category ...
I often find it useful to echo the query statement just before using it... it makes mistakes like this kind of obvious.
Also, if you used
$result =
mysql_query($query)
or die("Error querying: ".mysql_error());
you should get more-useful error messages.
attached mail follows:
Hi it may sound funny, but you may want to add a space at the end of lines before ". I mean $query = "SELECT mpn_job.ID, job, assigned_to, status_date, category "; $query .= "FROM mpn_job, mpn_job_category WHERE CID = mpn_job_category.ID "; $query .= "AND category = '$category'";
also echo $query; before you run the php page to see the sql. I think your $query is like
SELECT mpn_job.ID, job, assigned_to, status_date, categoryFROM mpn_job, mpn_job_category WHERE CID = mpn_job_category.IDND category = '$category' now, and it willl not run!
/mehmet/
--- Gerard Samuel <trini0
optonline.net> wrote:
> $query = "SELECT mpn_job.ID, job, assigned_to,
> status_date, category";
> $query .= "FROM mpn_job, mpn_job_category WHERE CID =
> mpn_job_category.ID";
> $query .= "AND category = '$category'";
> $result = mysql_query($query);
> $row = mysql_fetch_row($result);
> foreach ($row as $data) {
> echo "$data[0]";
> }
>
> I tried the SELECT statement from mysql command line
> (less $category, I
> used an actual category name) and it works there. I try
> it out in php,
> and I get nothing. (I echoed $category before this and
> it works
> correctly) Do you guys see anything in there that may
> need correcting?
> Thanks.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> php-general-unsubscribe
lists.php.net
> For additional commands, e-mail:
> php-general-help
lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin
lists.php.net
>
===== Mehmet Erisen http://www.erisen.com
__________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
attached mail follows:
Gentlemen, thank you for correcting me with the space ont the end. Ill try and make it a habit to echo out the query.
All is well in the land of PHP, till next time.....
attached mail follows:
Hi phpers,
I'm looking for a PHP Developer ... what is probably the best way to go for it?
Cheers,
Vince
''' ô¿ô -
attached mail follows:
"Vincent - D. Ertner" <vincent
eec.de> wrote in message
news:9477153515.20010829003921
eec.de...
> Hi phpers,
>
> I'm looking for a PHP Developer ... what is probably the
> best way to go for it?
General procedure is to give a rough sketch of what you want to accomplish, what development tools you are using, how long it will take, and a request for either quotes or resumes (depending on whether it's permanent or not).
attached mail follows:
Hey, please, I'm using the function mail() in one of my scripts, but when I use it, one exclamation point appears from nowhere in the email body. And it appears in different places, it moves around in the email body. It is very strange. And everytime, every email I send, it appears, no exception.
If you could help me, I would be very gratefull!
thanks!
Saul
__________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
attached mail follows:
Hi,
try to change the line in that loop to this one: $sql .= $key.' = '.$$key.', ';
----- Original Message -----
From: P.Agenbag <internet
psimation.com>
To: <php-general
lists.php.net>
Sent: Tuesday, August 28, 2001 7:54 PM
Subject: [PHP] Putting variables in a string
> I am trying to make a string that will contain variables.
>
> The resulting string will be a sql query string and must look something
> like
>
> " update $table_name set key='$key' , next='$next' where id = $id"
>
> Since the variable name is the same as the key name, I tried to generate
> this string with a foreach statement looking something like this:
>
> foreach( $myrow as $key=>$val) {
> $sql .= "$key = ' \$$key ' ,";
> }
>
> This then makes the string look as follow:
>
> key='$key',next='$next', and I just add the rest of the string to the
> front and back, yet, when I now try to use this string in the
> mysql_query() function, it does not recognise the '$key' and '$next' as
> variables and add them into the db as $key and $next. I need to know how
> I am going to make this string "recognise" the variables in them.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
Wow, I'll try it! I don't think someone will put extra info into the cell,
but you never know.
Thanks,
Hugh
----- Original Message -----
From: James Holloway <james
towntalk.co.uk>
To: Hugh Danaher <hdanaher
earthlink.net>
Sent: Tuesday, August 28, 2001 7:11 AM
Subject: Re: Need help on putting variable into <form>
> Hi Hugh,
>
> Most of your questions have been answered, but I thought you might also
like
> to consider this:
>
> htmlentities() and htmlspecialchars()
>
> If someone uses " or > in your variable, it might mess your form up:
>
> print "<input type=\"text\" size=\"30\"
> name=\"comp_name\" value=\"$comp_name\">";
>
> If they type ABC Company "The Best"
>
> it becomes:
> print "<input type=\"text\" size=\"30\"
> name=\"comp_name\" value=\"ABC Company \"The Best\"\">";
>
> ^^^^^^^^^^
>
> The form interprets the " before "The Best" as the end of the value for
that
> field.
>
> Using
> print "<input type=\"text\" size=\"30\"
> name=\"comp_name\" value=\"" . htmlentities($comp_name) . "\">";
>
> will cure any woes ;)
>
> http://www.php.net/manual/en/function.htmlspecialchars.php
> http://www.php.net/manual/en/function.htmlentities.php
>
> James
>
> ----- Original Message -----
> From: "Hugh Danaher" <hdanaher
earthlink.net>
> Newsgroups: php.general
> To: "Php-General" <php-general
lists.php.net>
> Sent: Tuesday, August 28, 2001 4:27 AM
> Subject: Need help on putting variable into <form>
>
>
> Help. I have a page with a form with lots of text boxes which can be
filled
> with data from a text file. the fopen() and fgets() works, and the text
> boxes which require numbers have no problems. But, I have text boxes
which
> require several words of text and they refuse to work right. The first
word
> makes it in the box, but the rest of the words are lost.
>
> As an example, the data file contains: ABC Company, Inc. in the spot for
> $comp_name. If I call for this variable elsewhere outside of a text box,
it
> prints in full, but when used by the following, it prints only: ABC
>
> print "<input type=text size=30 name=comp_name value=$comp_name>";
>
> There must be something blindingly obvious that I'm missing. Please help.
> Thanks, Hugh
>
>
>
>
attached mail follows:
If the lines terminate in "\n", I'd use fgets($fp,1000) in a loop, and loop as many times as needed.
$fp=fopen("filename","r") or die ("couldn't open filename");
for ($count=1;$count<=10,$count++)
{
$line=fgets($fp,1000); // the 1000 represents the number of bytes to
go to unless it finds "\n" sooner.
print "$line";
}
I'm prety sure the above will work.
Hugh
----- Original Message -----
From: Jon Farmer <jonfarmer
enta.net>
To: Tauntz <tauntz
hot.ee>; <php-general
lists.php.net>
Sent: Tuesday, August 28, 2001 6:40 AM
Subject: RE: [PHP] How do I read the first n lines from a file?
> If you are on a unix box you might want to use the tail command... if you
> use exec() the output will be in an array...
>
> --
> Jon Farmer Õ?Õ?
> Systems Programmer, Entanet www.enta.net
> Tel +44 (0)1952 428969 Mob +44 (0)7968 524175
> PGP Key available, send blank email to pgpkey
bctech.co.uk
>
> -----Original Message-----
> From: Tauntz [mailto:tauntz
hot.ee]
> Sent: 28 August 2001 12:13
> To: php-general
lists.php.net
> Subject: [PHP] How do I read the first n lines from a file?
>
>
> hi !
>
> I have a simmple question :)..
>
> Lets say that I have a file called:
> list.txt
> and I want to take the first 10 lines from it & echo it to the browser ?
>
> thank you
> Tauntz
hot.ee
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
Fast and dirty:
function readnlines($filename, $count) { return array_slice(file($filename), 0, $count); }
//elias
"Tauntz" <tauntz
hot.ee> wrote in message
news:003801c12fb2$685b90c0$0f00a8c0
tauntz...
hi !
I have a simmple question :)..
Lets say that I have a file called: list.txt and I want to take the first 10 lines from it & echo it to the browser ?
thank you
Tauntz
hot.ee
attached mail follows:
I have a medium sized db... with about 300 feilds and 15k rows.
I need to create a search that will submit user input to seach the db from about 30 different feilds with some of those wildcards.
i.e bedrooms, bathrooms, price, pool, city, etc....
Would using an array for the results page be the best way to approach this in PHP?
attached mail follows:
UNSUBSCRIBE
attached mail follows:
> -----Original Message-----
> From: daniel james [mailto:cgi_guy1313
yahoo.com]
> Sent: Tuesday, August 28, 2001 12:23 PM
> To: Jeff Lewis; php-general
lists.php.net
> Subject: Re: [PHP] Pulling webpages - may be a weird question :)
>
>
> try readfile('http://www.somesite.com/');
>
> it creates a mirror; it might bypass the firewall,
> depending on how the blocking software is keyed to
> activate.
>
> -dj
> --- Jeff Lewis <jeff
hyrum.net> wrote:
> > I was sitting here at work (working of course!)
> > thinking about how some sites are blocked etc from
> > viewing... Is it possible with PHP to do something
> > like this:
> >
> > Have a page where I can create kind of a middle man.
> > I mean the PHP can be hosted on my server, it goes
> > to the site I'd want to view (lets say www.php.net).
> > It then relays it to my browser but as if it is
> > coming from my server. So can it grab the pages,
> > temp write them and server them over to me?
> >
> > I know it seems kind of strange but I am curious
> > about it....
> >
> > Jeff
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
Some of us live in countries where these proxy servers are banned. I cannot access anonymiser, safesurf or any of the other open proxies.
sometimes accessing cnn is useful, so I wrote some quick and very nasty code to retrieve and view webpages - also encrypts the url as well - China sometimes bans via url contents, so www.someserver.com/proxy/www.cnn.com would be banned as well.
(Chinese Government went through a phase a few weeks ago where even google was banned, that was terrible, I rely on google every day!).
See code below (it's not good, but it works - text only)
I use it on my Shanghai site www.shanghaiguide.com in the proxy page - www.shanghaiguide.com/proxy
<?php
function ROT ($string,$n=13){ for ($i = 0; $i < strlen($string); $i++) { $string[$i] = chr(ord($string[$i]) + $n); } return $string; }
if (!isset($URL)) { ?> <form action="<?php print $PHP_SELF;?>" method=post> <input name="URL" size=50 value=""> <p><input type=submit value="Go"> </form> <br> No Graphics will be displayed, only a href style links are processed, proxy is alpha version, but hey its better than nothing<br> <?php } else { if (isset($ENC)) { $URL =ROT ($URL,-1); }
//Check prefix badly if (substr (strtoupper($URL),0,4) == "HTTP") { //Probly http } else { $URL="http://".$URL; }
if (isset($URLPATH)){ if (strpos ($URLPATH,"p://")) { $URL=""; //New Site = strip out the http:// and replace //To Do if (substr($URLPATH,-3)=='gif') { Header("Content-type: image/gif"); } if (substr($URLPATH,-3)=='jpg') { Header("Content-type: image/jpg"); } }
//If url ends in / and urlpath starts in / strip url trailing slash. if ((substr($URL,-1) =="/" ) && (substr($URLPATH,0,1)=="/")) { $URL=substr ($URL,0,strlen($URL)-1); } } else { $URLPATH=""; if (substr($URL,-1) !="/"){ $URL.="/"; } }
//$URL =ROT($URL,1);
//print "Encrypted URL=". $URL;
if (!$NOHDR) {
print "URL =".$URL;
//Show Browse Form Again
?>
<form action="<?php print $PHP_SELF;?>" method=post>
<input name="URL" size=50 value="<?php print $URL;?>">
<input type=submit value="Go">
</form>
<hr>
<?php
}
$up = fopen($URL.$URLPATH,"r");
if ($up){
while (!feof($up)) {
$results.= fread($up, 1024);
}
fclose($up);
unset($URLPATH);
}
$URL=ROT($URL,1); //$results = str_replace("href=\"http://", "href=" $scriptpath "?url="$url, $pagedata);
$results = eregi_replace ("href=\"" , "href=\"$PHP_SELF?ENC=1&URL=$URL&URLPATH=",$results); $results = eregi_replace ("src=\"","src=\"blank.gif?$PHP_SELF?ENC=1&NOHDR=1&URL=$URL&URLPATH=",$resul ts); print $results;
} ?>
There are better ways to do this, James Marshall wrote CGIProxy, but this is the only one I know that also encrypts urls.
-----Original Message-----
From: Dan Harrington [mailto:dan
tudan.net]
Sent: August 29, 2001 8:52 AM
To: daniel james; Jeff Lewis; php-general
lists.php.net
Subject: RE: [PHP] Pulling webpages - may be a weird question :)
> -----Original Message-----
> From: daniel james [mailto:cgi_guy1313
yahoo.com]
> Sent: Tuesday, August 28, 2001 12:23 PM
> To: Jeff Lewis; php-general
lists.php.net
> Subject: Re: [PHP] Pulling webpages - may be a weird question :)
>
>
> try readfile('http://www.somesite.com/');
>
> it creates a mirror; it might bypass the firewall,
> depending on how the blocking software is keyed to
> activate.
>
> -dj
> --- Jeff Lewis <jeff
hyrum.net> wrote:
> > I was sitting here at work (working of course!)
> > thinking about how some sites are blocked etc from
> > viewing... Is it possible with PHP to do something
> > like this:
> >
> > Have a page where I can create kind of a middle man.
> > I mean the PHP can be hosted on my server, it goes
> > to the site I'd want to view (lets say www.php.net).
> > It then relays it to my browser but as if it is
> > coming from my server. So can it grab the pages,
> > temp write them and server them over to me?
> >
> > I know it seems kind of strange but I am curious
> > about it....
> >
> > Jeff
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
mvc9v9 We help business owners accept credit cards!
Competitive Rates! Below Market Prices!
Our approval process is quick and simple!
We offer complete processing systems for your business:
*Internet *Retail *Mail Order *Phone Order
Free information request form: PLEASE VISIT
http://www.freewebdirect.net/merchantservices/
****************************************************************
Since you have received this message you have either responded
to one of our offers in the past or your address has been
registered with us. If you wish to be removed please reply to:
mailto:morleads7
yahoo.com?subject=remove
****************************************************************
lilkc9c
**********
attached mail follows:
We have several GUI applications that we are preparing to convert to web-based applications, based primarily on PHP. The applications are based on Informix On-Line (on a SCO Unix server) and MS SQL (on NT). Since we will be doing a port, in any case, I am wondering your thoughts on whether MySQL may be a better database solution. This is particularly important from a price-performance point of view since the other two databases are quite pricy on a per-seat basis.
TIA, James
attached mail follows:
Hello,
James wrote: > > We have several GUI applications that we are preparing to convert to > web-based applications, based primarily on PHP. The applications are based > on Informix On-Line (on a SCO Unix server) and MS SQL (on NT). Since we > will be doing a port, in any case, I am wondering your thoughts on whether > MySQL may be a better database solution. This is particularly important > from a price-performance point of view since the other two databases are > quite pricy on a per-seat basis.
If you don't know yet, you'd better try different database to see which is capable of doing what you need.
On solution that would not be compromising because it would let you change you minds later is to use a database abstraction package that would let you write applications that are portable between databases. That way you may try different databases with the same code and make up your minds when you feel ready.
You may want to try Metabase which is a PHP database abstraction package that lets you write portable applications and among other databases supports those that you meantioned.
Metabase is freely available from here:
http://phpclasses.UpperDesign.com/browse.html/package/20
Regards, Manuel Lemos
attached mail follows:
I can't get the php to convert audio data to nicely formed binary wav format. For instance, in perl you simply do a
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
and you're done with it.
In php, there are two problems:
1. no existence of a handy builtin hex2bin() function (though many have been written, such as
function hex2bin($hex_str)
for ($i = 0; $i < strlen($hex_str); $i += 2)
$bin_str .= chr(hexdec(substr($hex_str, $i, 2)));
}
return $bin_str;
}
which seems to get the case done,
2. But the real problem is that doing a straight hex2bin conversion is not what that beautiful little perl script does. The part that confuses me is the hash oriented piece /%([a-fA-F0-9][a-fA-F0-9])/ -- what exactly is it doing? Is it just stepping through the string two characters at a time and comparing them? Or is it doing something more ambitious and arcane that I'm not really grasping. I tried to emulate it with the following php workaround, but come up short...
for ($i = 0; $i < strlen($hex_str); $i += 2)
$newdata =. preg_replace("/[a-fA-F0-9][a-fA-F0-9]/",pack("C",hexdec(substr($hex_str, $i, 2))),$hex_str);
}
Any help?
attached mail follows:
Hello Zeev,
Zeev Suraski wrote: > > At 23:02 26-08-01, Manuel Lemos wrote: > >I don't think we have the same understanding of what is marketing. For > >me, marketing is being proactive in terms of promoting something before > >the potential market. Seeing people advocating PHP or analysts covering > >PHP here and there is not proactive at all. It is a result of the > >evolution of PHP capabilities, but it was not something that was > >especifically planned. > > Well, that's not quite true. The analysts that are beginning to show > interest are a result of efforts being made in certain companies. As for > advocating, I specifically mentioned companies and not people, which is > what makes it pro-active. I think our definitions for marketing are quite > similar :)
If when you mean pro-active you mean that's intentional and is all part of a plan, then we agree. If you acted somehow to promote PHP and got some unexpected results (good or bad) that is still marketing although not pro-active.
> > > At any rate, suggestions will be welcome. I've seen the Web Developer Ring > > > you suggested, and I think it's worth thinking (the reason I'm not going > > > wild with enthusiasm is that I think it also has drawbacks, not only > > > advantages). > > > >I don't know what drawbacks do you see, but let's discuss it openly. > > Well, not all of the sites are of the same quality and enjoy the same > maintenance level. Such sites may have a good audience and may be a good > service, but they won't necessarily do a good job at presenting PHP. They > may (will) also overlap in content, which would also not look very > professional either.
If you are going to descriminate sites based on subjective criteria, like matters of taste or points of view that vary greatly from person to person, that is bad because you will certainly leave out contributions that could help greatly PHP and in the end yourself.
It would certainly would make you look arrogant if you get to be picky as if including some sites and not others you would be doing somebody else a favor when the promotion that PHP gets from the sites will always benefit you direct or indirectly.
If I were you I certainly would not rule out sites with content that overlaps others. Why not accept all sites that provide PHP articles? One site may not be as good or as complete as other today, but they may improve over time enough to be technically better than others that you picked before. What would you do then? Accept what you refused before and then discard what you accepted before? Doesn't seem to be a good idea.
Anyway, in a Web ring banner you only promote a site at each banner view. I don't see the problem of rotating banners of overlapped content.
> Things like that are usually not that simple, or in other words, they're > easier said than done. If done sloppily, they can have a negative > effect. And doing them correctly requires substantial efforts.
You sound bureacratic. You should feel honoured by the extra promotion that all the PHP content sites give you because your business depends on PHP acceptance in the market. Why make it hard for sites that are willing to help you in the end?
I think it is fair enough to make some base rules like "don't be too lame" (define "too lame"), but almost everybody should be accepted.
> >Ok, it is not fading out, but it is fading, meaning it is no longer the > >exciting thing that it seemed to be and was attracting some many people > >from everywhere. > > I disagree even with the toned-down version :) I think that the Web as a > medium is one of the most promising infrastructures around. True, the hype > is gone, but that's a good thing. I don't think the hype moved anywhere > else, it's just gone (for now :)
I guess you just say that because you were simply not affected by the major Internet layoffs that happened in the latest months, so you don't seem to have a great idea how bad this has been for so many people.
Of course the Internet is not gone. It just happens that the number of companies with business depending on it was drastically reduced. So, there aren't so much employment and business opportinities as before. That's what I mean.
> >It is not a matter of loosing that focus, but rather enlarge the focus > >of PHP that is adverstised for things that some people are already using > >it seriously. > > By definition of the word focus (well, almost), there's no real way to > 'enlarge' it without losing it. We can play with words forever, though :)
Ok, I meant enlarging the focus area, but I agree, there's no point in carrying on with playing with how each other expresses in English. :-)
> >Anyway, lets just concentrate on the Web development focus. Web > >development is not just Web scripts that are served by the Web server. > >Web development is also, installing and maitaining applications and also > >run processes that run separately from the Web server. > > > >You know you can run PHP from the command line to do things like run > >database installation scripts or run cron scripts that execute periodic > >tasks. > > > >The truth is that most people are not aware of this. They think PHP can > >only be run from the Web server to serve Web pages. I was suprised by > >the number of people that was telling me that Perl is better for running > >scripts from the command line. Duh?! Why? Because nobody told them > >otherwise! This very wrong perception of the current PHP user base needs > >urgent fixing! The fix needs not to be applied in PHP, but rather in PHP > >users minds. PHP needs to be advertised as tool than can run scripts > >from anywhere, like any other language. For starters, drop the > >designation of PHP CGI version. > > Could be. The truth is that PHP *is* lacking in command line features if > you compare it to Perl, because it was indeed never brought up to be a > command line tool...
I don't think the actual PHP for command line features matter. My point is that people get it wrong. What is it that you can do on Perl in the command line that you can't do with PHP? Nothing relevant, it is that people hardly can concieve PHP as a command line scripting language because PHP is not known nor advertised as a capable language to work that way. That is what needs fixing: people's misconceptions. That's fixable with targetted marketing.
> >If people are already using PHP that way for serious purposes, why > >neglect that it can be used that way? That only lets other languages > >take over a space that PHP has already conquered. > > I'm not saying it won't happen, but I've yet to see projects like PHP-GTK > being used 'seriously'. To make it clearer, I've yet to see an application > which is actually written in PHP-GTK, and is being distributed or
Man, give it some time! How long was it since Andrei released PHP-GTK? How old is PHP now?
> sold. The day may come, but unlike the Web ring where we hold a huge > chunk, I find it very hard to imagine seeing PHP taking a considerable > chunk of the GUI market, ever.
One thing is certain, if you don't help advertising PHP as capable of doing GUI programming, things won't be as easy.
I think it is amazing the some how unexpected uses that people find for PHP. What really confuses me is that instead of making that "use cases" to promote PHP, you simply raise a lot of objections as if that would cause any harm to PHP. Come on, enjoy all the PHP users applications because they certainly help you to make the proof of concept that PHP is the right choice for so many people.
> >The way I see, most people tend to only use one language at once. If > >they see an alternative to PHP not only serves well for Web programming, > >but also for non-Web programming, PHP will loose its user base there. It > >is a matter of time until a lot of PHP people will start seeing it that > >way. > > It's really an issue of different opinions. I think our focus should > remain on the Web ring, because we can't enlarge it without losing it. We > can foster additional projects, such as PHP-GTK, improved command line > features, etc., but the way I see it, if you want to define PHP in one > sentence, the best qualifying one would still be 'A Server Side, HTML > Embedded Scripting Language' (sorry Andrei ;). It's true that it can be > used in other ways, but that's the focus, and the rest are useful 'exceptions'.
Useful? How can you reckon them as useful if you insist on neglecting them?
One other thing, I don't know if you notice, that but every time you neglect these unexpected uses of PHP you are somehow ruling out people behind them. That's a serious thing because you are eventually hurting people's feelings when that worked so hard to use the language that you developed. If people are making a private use of their work and could not care less if their work is reckoned, that is not a problem. But sometimes you see people working so hard with recognition as their main goal. Neglecting that recognition or making it very hard is terrible. I don't thing you want those people to give up for the lack of recognition, don't you?
> >No, I mean executables that may be just like VB executables that > >basically contain PHP code compiled into Zend bytecodes or whatever is > >enough for most people be stopped from copy source code directly. > > > >A lot of people give up PHP because it does not provide affordable > >conditions to let them sell whole applications that others can't still > >their code, when they can just spend only US$100 or less in VB, Delphi, > >Java, Kylix, etc... suite and compile programs that they can distribute > >or sell to others without risking their business. > > > >There are a lot more other things to say on these subjects, but these > >should give you enough to think for a while. :-) > > Thank you :)
You're welcome, but you just skipped the implicit million dollar question: will there be an affordable version of Zend encoder that developers can buy for USD$100 like they can with VB or Delphi? :-)
Regards, Manuel Lemos
attached mail follows:
Hello,
Julio Nobrega Trabalhando wrote: > > Hi Manuel, > > Great post. I enjoyed the part where you said it would be a good idea to > do some 'competition' with php programmers, sponsored by some company.
Actually, what I was suggested was not invented. It seems some body with great interest to promote Python invented this "Open Source Software contest" offering $100.000 in prizes. It is funny that they call it "Open Source software contest" but the rules explicitly said that only Python entries would be accepted. The contest was to develop software development tools that would probably would cost that much if they contracted qualified developers to write them on demand.
This way, not only they got the tools that they wanted all in Python, developed by the best contenders, and even managed to promote Python as if it is the big language of the century so that it would be the only right choice for developing those tools! Yeah right! :-)
These guys resort to these marketing tricks to promote Python as hell, and the PHP people just sits and waits doing almost nothing in comparision to promote PHP as hard as they can even when they lives depend on the acceptance of PHP as a wide spread language!
Look here to see the trick:
http://software-carpentry.codesourcery.com/contest-rules.html
Regards, Manuel Lemos
attached mail follows:
> These guys resort to these marketing tricks to promote Python as hell, > and the PHP people just sits and waits doing almost nothing in > comparision to promote PHP as hard as they can even when they lives > depend on the acceptance of PHP as a wide spread language!
Manuel, please, give this tirade a rest. Nobody associated with Python development was involved in this "amazing" marketing trick you are referring to. Somebody just decided to do this on their own. And now you are criticizing the PHP developers for not having the same foresight as the Python developers?
It says so right in their FAQ (http://software-carpentry.codesourcery.com/faq.html)
"And in answer to some of the more virulent postings on Usenet and in other venues, neither Guido van Rossum nor anyone else associated with Python development was involved in setting up this project, choosing the language, or defining the terms of the competition. Guido was only asked to be a judge after the decision to use Python had been made. If we had decided to use Perl or Tcl, we would obviously have invited Larry Wall or John Ousterhout to join the panel."
If somebody wants to put up $100,000 for a PHP software contest, perfect, great, we will be every bit as cooperative as the Python developers.
-Rasmus
attached mail follows:
--On Tuesday, August 28, 2001 11:42 PM -0300 Manuel Lemos <mlemos
acm.org>
wrote:
> These guys resort to these marketing tricks to promote Python as hell, > and the PHP people just sits and waits doing almost nothing in > comparision to promote PHP as hard as they can even when they lives > depend on the acceptance of PHP as a wide spread language!
dear mr lemos,
your ongoing participation in this thread has opened my eyes to views i had not considered before and caused me to revisit mine. however, the above is representative of where i think you and i disagree.
[please note that my thoughts here are really in response to the overall impression i received from reading all of your posts in this thread and i only include the above quote for my convenience. even though i'll mostly mention where you and i disagree, it doesn't mean i disagree with all that you say. indeed, i find your enthusiasm contagious and offer encouragement to you in your effort]
one assumption you seem to have is the ongoing viability of php (if not the very livelihood of we the developers using php) is somehow a function of the number of folks who know what php is. that somehow the more folks know about php, the better php gets. it also seems that you feel 'the PHP people' are not putting forth enough effort to further php's acceptance and viability.
from my point of view as a developer using php, recognition of php in the corporate world is not as important as how good php is. i prefer to see efforts focused on developing the best darn HTML-embedded scripting language this side of the railroad tracks. whether or not php gets talked about on the evening news doesn't really matter. what matters is whether php helps me as a programmer. i don't care how many folks recognize the power of php. i care about the power of php. the number of folks using php is a function of whether or not 'the PHP people' can continue to produce such rockin' code over the next few years. not the other way around.
i imagine you have a unique perspective on the effort it takes to promote php. but, i'm guessing that 'the PHP people' probably do as well. i myself am unduly grateful for the effort that they put forth, not only in producing the rockin'st language anyone could have hoped for when learning to program, but in promoting php as well. when i saw php was featured at the open source convention in san jose, i knew things were moving along just fine. that's the kind of promotion i want to see. i believe 'the PHP people' should be allowed to promote php in a manner they are comfortable with. after all, it's their itch.
ya know, making the best HTML-embedded scripting language seems a pretty noble goal to me.
> Regards, > Manuel Lemos
have a good one, mike
-- mike cullerton
attached mail follows:
Hi geeks,
I have a strage problem over here. I developed a site which runs fine at my home. When i hosted it on to the remote server it is giving an error saying cant connect to mysql. the error is like this Warning: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111) in /home/httpd/html/procbit/login.php on line 17
the line 17 in my code is as follows: $db=mysql_connect("localhost","root","password");
please help me out of this problem.
Please reply me at sagarchand
yahoo.com
thank you all sagar
_________________________________________________________
Do You Yahoo!?
Get your free
yahoo.com address at http://mail.yahoo.com
attached mail follows:
Is mysql on the remote server? if so then i doubt very much that they would let you have root access to the DB... so you need to change your connect line to resemble the remote server and if it's a web hosting company that your using as a remote server ask for a user name you can use
>Mailing-List: contact php-general-help
lists.php.net; run by ezmlm
>list-help: <mailto:php-general-help
lists.php.net>
>list-unsubscribe: <mailto:php-general-unsubscribe
lists.php.net>
>list-post: <mailto:php-general
lists.php.net>
>Delivered-To: mailing list php-general
lists.php.net
>X-Apparently-From: <sagarchand
yahoo.com>
>From: "Sagar N Chand" <sagarchand
yahoo.com>
>To: <php-general
lists.php.net>
>Date: Wed, 29 Aug 2001 08:04:40 +0530
>MIME-Version: 1.0
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
>Subject: [PHP] cant connect to mysql
>X-Mozilla-Status: 0000
>X-Mozilla-Status2: 00000000
>X-UIDL: 6badc33ff2c371e368ef53f676502437
>
>Hi geeks,
>
>I have a strage problem over here. I developed a site which runs fine at my
home.
>When i hosted it on to the remote server it is giving an error saying cant
connect
>to mysql. the error is like this
>
>Warning: Can't connect to local MySQL server through socket '/tmp/mysql.sock'
(111) in /home/httpd/html/procbit/login.php on line 17
>
>the line 17 in my code is as follows:
>$db=mysql_connect("localhost","root","password");
>
>please help me out of this problem.
>Please reply me at sagarchand
yahoo.com
>
>thank you all
>sagar
>
>
------------------------------------------------------
Peter Houchin
Sun Rentals STR Manager
Phone: 03 9329 1455
Fax: 03 9329 6755
peterh
sunrentals.com.au
http://www.sun.com.au/rentals
============================ _____ __ /\
/_/_/_\ / |_/ \
/_/_/_ __ __ __ __ / \
\_/_/_\ /_/ /_/ /_/ /_/ \ _ /
___\_\_\/ /_/_/_/ /_//\/_/ \_/ \/\_/
\_//_/_/ /_/_/_/ /_/ \/_/ v
________ ________________________________________
/_/_/_/_/ /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
/_/_ _/_/ ______ __ __ /_/ ____ __ ______
/_/_/_/_/ /_/_/_/ /_/ /_/ /_/ /_/\_\ /_/ /_/_/_/
/_/ \_\ /_/ _/ /_//\/_/ /_/ /_/__\_\ /_/___ _\_\_\
/_/ \_\/_/_/_/ /_/ \/_/ /_/ /_/ \_\/_/_/_//_/_/_/
============================Telephone : (03) 9329 1455 Facsimile : (03) 9329 6755
************* We rent the dot in .COM! **************
attached mail follows:
Hello
A quick question here: is it possible to have your script write to file with the user's as owner and not as 'nobody' or 'www' as owner (which is what it usually does). For example in perl one can use cgiwrap to write to file as the user to whom the script belongs. Any way of doing this in php? Any advice will be greatly appreciated.
Anton Stroganov webmaster www.artwithin.com
attached mail follows:
Hi,
I would like to know how to use the mailto function to attach a specific file.
Thank you
Mark
attached mail follows:
You're probably going to need a mime class - Manuel Lemos makes a good one, then send as a mime attachment.
http://freshmeat.net/projects/mimemessageclass/
Some sample code below that I use (and a mime class).
Example.php <? if (!isset($SEND_MIME_LOADED)) { require "mimeclass.php"; }
$mymessage = new Mail(); $mymessage->from = "$emailfrom"; $mymessage->to = "$emailto"; $mymessage->subject = "$emailfromname sent a picture to you from shanghaiguide.com"; $mymessage->headers["Reply-To"] = "$emailfrom"; $mymessage->headers["X-Extra-Header"] = "Pointless Header v3.0"; $mymessage->body = "$emailfromname sent you a picture from the ShanghaiGuide.com site\n" . "----------------------------\n". "http://www.Shanghaiguide.com\n\n". "The Shanghai Guide - The real guide to Shanghai Life\n\nLive Chat, Thousands of Pictures, Classifieds, Message Forum and more..."; $mymessage->attachments[0] = $DOCUMENT_ROOT.$pic; $mymessage->Send();
?>
mimeclass.php <?php
//Abort on re-entry... if ($SEND_MIME_LOADED==1){ exit; }
$SEND_MIME_LOADED=1;
//////////////////////////////////////////////////////////////// //Main Code //////////////////////////////////////////////////////////////// /* Uses sendmail to send the mail, mimencode to do the MIME encoding, and zip to automatically zip attachments.
Contacting the author(s):
Brought to you by the team at Sequoia Softworks, http://www.sequoiasoft.com
Feel free to contact tony
sequoiasoft.com and tell us how you like it!
(Or to complain bitterly, report bugs, or suggest new features.)
Known shortcomings/bugs: o guessMIMEType()only knows about a few MIME types. You can expand this as you need. o $mime_boundary in the Send() method should be randomly generated, but it isn't likely to ever hurt anything in its current form
Example:
require("Mail.phtml");
$mymessage = new Mail();
$mymessage->from = "php3.script
www.somedomain.net";
$mymessage->to = "luckyuser
destination.org";
$mymessage->subject = "This is your lucky day";
$mymessage->headers["Reply-To"] = "webmaster
www.somedomain.net";
$mymessage->headers["X-Extra-Header"] = "Pointless Header v3.0";
$mymessage->body = "Doesn't it feel good to get mail?\nEspecially with
files
attached!\n";
$mymessage->attachments[0] = "tarball.tar.gz";
$mymessage->attachments[1] = "images/smiling_countenance.gif";
$mymessage->attachments[2] = "/usr/share/reference/jargondict.html";
$mymessage->attachments[3] = "./core";
$mymessage->attachments[4] = "/etc/passwd"; //naughty naughty!!
$mymessage->ZipAttachments("your_files.zip"); //uncomment this to zip all
//the attachments into one
big
//attachment.
$mymessage->Send();
*/
class Mail {
var $from; //The sender
var $to; //The recipient
var $subject; //The subject line
var $headers; //A hash of additional headers (headername => headervalue)
var $zipname; //The name of the file the attachments are zipped into //($zipname == false if attachments are to be sent //individually) var $attachments; //An array of files to attach var $body; //The body text of the message //Mail constructor: initializes vars to default values. 'Nuff said. function Mail() { $this->from = ""; $this->to = ""; $this->subject = ""; $this->headers = array(); $this->zipname = false; $this->attachments = array(); $this->body = ""; } //Auxiliary method, used to guess a file's MIME type //based on its extension. Doesn't know about too many //extensions right now function guessMIMEType($filename) { //GUESS MIME TYPE $filename = basename($filename); if(strrchr($filename,".") == false) { return("application/octet-stream"); } $ext = strrchr($filename,"."); switch($ext) { case ".gif": return "image/gif"; break; case ".gz": return "application/x-gzip"; case ".htm": case ".html": return "text/html"; break; case ".jpg": return "image/jpeg"; break; case ".tar": return "application/x-tar"; break; case ".txt": return "text/plain"; break; case ".zip": return "application/zip"; break; default: return "application/octet-stream"; break; } }
//Cute little convenience method. Supply it with a filename to //zip attachments to, or supply it with false if attachments are //sent individually function ZipAttachments($name) { $this->zipname = $name; }
//The workhorse method, does the actually sending of the mail. //Doesn't check for errors so be careful! function Send($sendmail = "/usr/lib/sendmail") {
if($this->from == "") { $fp = popen($sendmail . " -i " . $this->to, "w"); } else { $fp = popen($sendmail . " -i -f\"" . $this->from . "\" " . $this->to, "w"); }
$mime_boundary = "-1747901728-1448367683-913849620=:4553";
if($fp == false)
return false;
//Write subject header
fwrite($fp,"Subject: " . $this->subject . "\n");
//Write user-defined headers
reset($this->headers);
while(list($hdrname,$hdrval) = each($this->headers)) {
fwrite($fp,$hdrname . ": " . $hdrval . "\n");
}
//If there are attachments, this needs to be a MIME message
if(count($this->attachments) > 0) {
//Write MIME headers
fwrite($fp,"MIME-Version: 1.0\n");
fwrite($fp,"Content-Type: multipart/mixed; BOUNDARY=\""
. $mime_boundary . "\"\n");
fwrite($fp,"\n");
//Write dummy message body
fwrite($fp," This message is in MIME format. The
first part should be readable text,\n");
fwrite($fp," while the remaining parts are likely
unreadable without MIME-aware tools.\n");
fwrite($fp," Send mail to
mime
docserver.cac.washington.edu for more info.\n");
fwrite($fp,"\n");
//Write message text
fwrite($fp,"--" . "$mime_boundary" . "\n");
fwrite($fp,"Content-Type: text/plain; charset=US-
ASCII\n");
fwrite($fp,"\n");
fwrite($fp,$this->body);
fwrite($fp,"\n");
//Handle attachments
if($this->zipname != false) { //IF we've been told to
//zip the attachments
fwrite($fp,"--" . $mime_boundary . "\n");
fwrite($fp,"Content-Type: application/zip; name=
\"". $this->zipname . "\"\n");
fwrite($fp,"Content-Transfer-Encoding: base64
\n");
//fwrite($fp,"Content-ID: " . $content_ID . "\n");
fwrite($fp,"Content-Description:\n");
fwrite($fp,"\n");
$cmdline = "zip - ";
while(list($key, $attachment_name) = each($this->attachments))
$cmdline .= "$attachment_name ";
$cmdline .= "| mimencode -b";
$pp = popen($cmdline,"r");
while(!feof($pp)) {
$data = fread($pp,4096);
fwrite($fp,$data);
}
pclose($pp);
}
else { //no need to zip the attachments, attach them
//separately
while(list($key, $attachment_name) = each($this->attachments)) {
fwrite($fp,"--" . $mime_boundary . "\n");
fwrite($fp,"Content-Type: " . $this->guessMIMEType($attachment_name) .
";
name=\"". basename($attachment_name) . "\"\n");
fwrite($fp,"Content-Transfer-Encoding: base64\n");
//fwrite($fp,"Content-ID: " .
//$content_ID . "\n");
fwrite($fp,"Content-Description:\n");
fwrite($fp,"\n");
$pp = popen("mimencode -b $attachment_name","r");
while(!feof($pp)) {
$data = fread($pp,4096);
fwrite($fp,$data);
}
pclose($pp);
}
}
fwrite($fp,"--" . $mime_boundary . "--\n");
}
//No need for a MIME message, so it's an RFC822 message
else {
fwrite($fp,"\n");
fwrite($fp,$this->body);
}
pclose($fp);
}
}
?>
-----Original Message-----
From: Mark Lo [mailto:mark
3dsources.com]
Sent: August 29, 2001 12:25 PM
To: php-general
lists.php.net
Subject: [PHP] mailto function to attach a photo
Hi,
I would like to know how to use the mailto function to attach a specific file.
Thank you
Mark
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
I could never get MIME classes and the like to work, so I rolled
my own, so to speak. It was posted here a while ago, but I have
a copy on my web server
home:
http://planetkiller.shadow.net.au/mime-php.txt
-- Jason Murray jasonmmelbourneit.com.au Web Developer, Melbourne IT "Work now, freak later!"
attached mail follows:
Mail+Attach issue has been answered lots of times. You might want to check www.phpbuilder.com you must be able to find a topic there.
"Mark Lo" <mark
3dsources.com> wrote in message
news:000701c13042$9d0352a0$7c7ba8c0
mark...
> Hi,
>
> I would like to know how to use the mailto function to attach a
> specific file.
>
> Thank you
>
> Mark
>
attached mail follows:
... I just thought I would see if anyone else can reproduce it!
Ok. The problem is in the following snippet of code. ( Note : this exmaple is extremely contrived, and is the essence of a much more complicated situation involving a function call from a class method... )
<?php $data = array( "A" => "AA" , "B" => "BB", "C"=> "CC", "D"=> "DD", "E" => "EE" );
print "<pre>\n"; foreach ( $data as $key1=>$val1 ) { // foreach ( $data as $key2=>$val2 ) foreach ( array_keys($data) as $key2 ) // <= PROBLEM IS HERE { if ( $key1 == $key2 ) print "<b>$key2</b>"; else print $key2;
print " "; } print "\n"; }
print "</pre>"; ?>
I beleive it should generate <pre> <b>A</b> B C D E A <b>B</b> C D E A B <b>C</b> D E A B C <b>D</b> E A B C D <b>E</b> </pre>
Instead it generates <pre> <b>A</b> B C D E </pre>
If I replace the problem line foreach ( array_keys($data) as $key2 )
with the alternate foreach ( $data as $key2=>$val2 )
then it works fine.
I am using PHP 4.0.4pl1.
Regs
Brian White
-------------------------
Brian White
Step Two Designs Pty Ltd - SGML, XML & HTML Consultancy
Phone: +612-93197901
Web: http://www.steptwo.com.au/
Email: bwhite
steptwo.com.au
attached mail follows:
<Original message>
From: Brian White <bwhite
steptwo.com.au>
Date: Wed, Aug 29, 2001 at 04:01:06PM +1000
Message-ID: <4.3.2.20010829154702.00b62910
mail.steptwo.com.au>
Subject: [PHP] I beleive I have found a bug.....
> ... I just thought I would see if anyone else can reproduce it!
>
> Ok. The problem is in the following snippet of code. ( Note : this exmaple
> is extremely contrived, and is the essence of a much more complicated
> situation involving a function call from a class method... )
>
> <?php
> $data = array( "A" => "AA" , "B" => "BB", "C"=> "CC", "D"=> "DD", "E"
> => "EE" );
>
> print "<pre>\n";
> foreach ( $data as $key1=>$val1 )
> {
> // foreach ( $data as $key2=>$val2 )
> foreach ( array_keys($data) as $key2 ) // <= PROBLEM IS HERE
> {
> if ( $key1 == $key2 )
> print "<b>$key2</b>";
> else
> print $key2;
>
> print " ";
> }
> print "\n";
> }
>
> print "</pre>";
> ?>
>
> I beleive it should generate
> <pre>
> <b>A</b> B C D E
> A <b>B</b> C D E
> A B <b>C</b> D E
> A B C <b>D</b> E
> A B C D <b>E</b>
> </pre>
>
> Instead it generates
> <pre>
> <b>A</b> B C D E
> </pre>
>
> If I replace the problem line
> foreach ( array_keys($data) as $key2 )
>
> with the alternate
> foreach ( $data as $key2=>$val2 )
>
> then it works fine.
>
> I am using PHP 4.0.4pl1.
>
>
> Regs
>
> Brian White
>
> -------------------------
> Brian White
> Step Two Designs Pty Ltd - SGML, XML & HTML Consultancy
> Phone: +612-93197901
> Web: http://www.steptwo.com.au/
> Email: bwhite
steptwo.com.au
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
</Original message>
<Reply>
Hai Brain,
I don't _think_ this is a bug (note: think). I haven't taken a very good look at your code, but as I understand you believe that:
foreach ($data as $key)
delivers the same $key as in:
foreach ($data as $key=>$value)
Well... it doesn't. Check the manual on it. If you use the foreach ($x as $y) construction, $y is the value... not the key. Take a look at:
http://www.php.net/manual/en/control-structures.foreach.php
<Quote from PHP manual> foreach(array_expression as $value) foreach(array_expression as $key => $value) </Quote from PHP manual>
I think this solves your problem...
</Reply>
--* R&zE:
-- »»»»»»»»»»»»»»»»»»»»»»»» -- Renze Munnik -- DataLink BV -- -- E: renze
datalink.nl -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- ««««««««««««««««««««««««
attached mail follows:
Renze Munnik said: >I don't _think_ this is a bug (note: think). I haven't taken a very >good look at your code, but as I understand you believe that: > > foreach ($data as $key) > >delivers the same $key as in: > > foreach ($data as $key=>$value)
You didn't read my code closely enough:
I said: > > If I replace the problem line > > foreach ( array_keys($data) as $key2 ) > > ^^^^^^^^^^ > > with the alternate > > foreach ( $data as $key2=>$val2 )
At 09:54 29/08/2001 +0200, * R&zE: wrote:
><Original message>
>From: Brian White <bwhite
steptwo.com.au>
>Date: Wed, Aug 29, 2001 at 04:01:06PM +1000
>Message-ID: <4.3.2.20010829154702.00b62910
mail.steptwo.com.au>
>Subject: [PHP] I beleive I have found a bug.....
>
> > ... I just thought I would see if anyone else can reproduce it!
> >
> > Ok. The problem is in the following snippet of code. ( Note : this exmaple
> > is extremely contrived, and is the essence of a much more complicated
> > situation involving a function call from a class method... )
> >
> > <?php
> > $data = array( "A" => "AA" , "B" => "BB", "C"=> "CC", "D"=> "DD", "E"
> > => "EE" );
> >
> > print "<pre>\n";
> > foreach ( $data as $key1=>$val1 )
> > {
> > // foreach ( $data as $key2=>$val2 )
> > foreach ( array_keys($data) as $key2 ) // <= PROBLEM IS HERE
> > {
> > if ( $key1 == $key2 )
> > print "<b>$key2</b>";
> > else
> > print $key2;
> >
> > print " ";
> > }
> > print "\n";
> > }
> >
> > print "</pre>";
> > ?>
> >
> > I beleive it should generate
> > <pre>
> > <b>A</b> B C D E
> > A <b>B</b> C D E
> > A B <b>C</b> D E
> > A B C <b>D</b> E
> > A B C D <b>E</b>
> > </pre>
> >
> > Instead it generates
> > <pre>
> > <b>A</b> B C D E
> > </pre>
> >
> > If I replace the problem line
> > foreach ( array_keys($data) as $key2 )
> >
> > with the alternate
> > foreach ( $data as $key2=>$val2 )
> >
> > then it works fine.
> >
> > I am using PHP 4.0.4pl1.
> >
> >
> > Regs
> >
> > Brian White
> >
> > -------------------------
> > Brian White
> > Step Two Designs Pty Ltd - SGML, XML & HTML Consultancy
> > Phone: +612-93197901
> > Web: http://www.steptwo.com.au/
> > Email: bwhite
steptwo.com.au
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> > For additional commands, e-mail: php-general-help
lists.php.net
> > To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
></Original message>
>
><Reply>
>
>Hai Brain,
>
>I don't _think_ this is a bug (note: think). I haven't taken a very
>good look at your code, but as I understand you believe that:
>
> foreach ($data as $key)
>
>delivers the same $key as in:
>
> foreach ($data as $key=>$value)
>
>Well... it doesn't. Check the manual on it. If you use the
>foreach ($x as $y) construction, $y is the value... not the key.
>Take a look at:
>
>http://www.php.net/manual/en/control-structures.foreach.php
>
><Quote from PHP manual>
>foreach(array_expression as $value)
>foreach(array_expression as $key => $value)
></Quote from PHP manual>
>
>I think this solves your problem...
>
></Reply>
>
>--
>
>* R&zE:
>
>
>-- »»»»»»»»»»»»»»»»»»»»»»»»
>-- Renze Munnik
>-- DataLink BV
>--
>-- E: renze
datalink.nl
>-- W: +31 23 5326162
>-- F: +31 23 5322144
>-- M: +31 6 21811143
>--
>-- Stationsplein 82
>-- 2011 LM HAARLEM
>-- Netherlands
>--
>-- http://www.datalink.nl
>-- ««««««««««««««««««««««««
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
>For additional commands, e-mail: php-general-help
lists.php.net
>To contact the list administrators, e-mail: php-list-admin
lists.php.net
-------------------------
Brian White
Step Two Designs Pty Ltd - SGML, XML & HTML Consultancy
Phone: +612-93197901
Web: http://www.steptwo.com.au/
Email: bwhite
steptwo.com.au
attached mail follows:
<Original message>
From: Brian White <bwhite
steptwo.com.au>
Date: Wed, Aug 29, 2001 at 06:16:49PM +1000
Message-ID: <4.3.2.20010829181433.00addf00
mail.steptwo.com.au>
Subject: Re: [PHP] I beleive I have found a bug.....
> You didn't read my code closely enough: > > I said: > > > If I replace the problem line > > > foreach ( array_keys($data) as $key2 ) > > > ^^^^^^^^^^ > > > with the alternate > > > foreach ( $data as $key2=>$val2 )
</Original message>
<Reply>
Oops... Sorry! That's what I said... I didn't take a very good look. But now I have... You need to reset the $data-array before the inner foreach-loop. Then there's no problem.
--- PHP code ---
<?php print "<pre>\n"; foreach ( $data as $key1=>$val1 ) { reset ($data); // <----- R E S E T !!! foreach ( array_keys($data) as $key2 ) { if ( $key1 == $key2 ) print "<b>$key2</b>"; else print $key2;
print " "; } print "\n"; }
print "</pre>"; ?>
--- End of PHP code ---
</Reply>
--* R&zE:
-- »»»»»»»»»»»»»»»»»»»»»»»» -- Renze Munnik -- DataLink BV -- -- E: renze
datalink.nl -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- ««««««««««««««««««««««««
attached mail follows:
Hing Lung Motor Mfy, New Offer Aug-2001
http://www.hinglungmotor.com.hk hlmotor
hkstar.com hlmotor
i-cable.com Fax: 852-24817148
NO: HL101-D-D8xH6 VIBRATER MOTOR
SIZE: 20 x 15.5 x H25 MM
PRICE: US$ 0.13/PCNO: HL307 MOTOR
SIZE: D12 x 19.5 MM
PRICE: US$ 0.38/PC
NO: HL1011-DC SCOOTER MOTOR
SIZE: D100 x H70 MM
OUTPUT: 95 W
PRICE: US$ 13.50/PCNO: HL200 GENERATOR MOTOR
SIZE: D30.5 x H13 MM
PRICE: US$ 2.3
WE PRODUCE MORE THAN 50 DIFFERENT DESIGN
AND SIZE OF AC/DC MOTORS, THEY ARE SUITABLE
FOR OPERATION TOYS, HOUSEHOLD APPLIANCES,
RECORDS, SCOOTER, VIBRATOR, GENERATOR ETC.
¡
-----ANY ENQUIRY ARE WELCOME-----
¡
¡
attached mail follows:
On Wed, 29 Aug 2001 02:14:10 +1000, "Jason Brooke" <jb
qgl.org> wrote:
>Another way you might be able to do it is find an environment variable that >is only present when the cgi's are executed by the virtual() call,
Could not find any ...
>use the apache SetEnvIf directive combined with <DirectoryMatch>
But that gave me an idea for a solution with .htaccess control, and after some testing, I was able to work it out:
My document root .htaccess file includes:
SetEnvIf Request_URI "the_cgi_caller\.php$" CGI_REFERER=local
And my /cgi subdirectory .htaccess file includes:
Order Allow,Deny Allow from env=CGI_REFERER
The environment variable CGI_REFERER does not exist unless Apache is processing a request for "the_cgi_caller.php" in document root, and thus requesting any file in the /cgi subdirectory via its URL results in a HTTP Error 403 - Forbidden.
And since PHP virtual() causes Apache to execute a sub-request, the environment variable CGI_REFERER *does* exist while the CGI is being called via virtual() from "the_cgi_caller.php"
It will be simple to add SetEnvIf lines to .htaccess in document root, one for each .php file which needs to call a CGI with virtual().
This is the solution I was looking for. Thanks for the ideas!
Egan
attached mail follows:
would like to build/compile php as a dso ! Linux version is Suse 7.2 apache is version 1.3.19 already compiled with mod.so.c but I don't seem to have an apache/bin and I can't find apxs which should be there ???
Is this a Suse problem or what ?? do I have to de-install apache and re-install a normal version ??
or how do I use dso's in this one ?? cause when i try "apxs -i -a -c mod_foo.c" i just get command not found !
attached mail follows:
You have to write your own function for this.
<alvarez
sto13.st-oneline.de> wrote in message
news:200108281212.OAA06367
sto13.st-oneline.de...
>
> I want a function or macro to return executable code yielding syntax
> preprocessing of binary trees. Because the Macro Processor seems to be
> somewhat messy I though a regular function might be capable of doing the
job.
>
> e.g.
>
> btree ('(("a", "b")("c", "d"))')
>
> should be expanded to
>
> array (array ("a", "b")
> array ("c", "d")
>
>
> How can I archieve this?
>
> D. Alvarez Arribas <alvarez
st-oneline.net>
attached mail follows:
Hello
I'm looking for someone who have ever used DOM with PHP. Actually, i've a trouble with CDATA section when i descend the tree of my XML document. Does someone can help me ?
Thx
Jean-Charles Preaux
attached mail follows:
i am have trouble running php, i can run a simple doc like one to check the version and get the time but i cannot run anything eles and it gives we this Warning: Failed opening 'c:\inetpub\wwwroot\upload\admin\config.php' for inclusion (include_path='') in Unknown on line 0
its that right path, i think and what am i suppos to do with the php.ini file could you show we what changes i need to do to it.
thanks
_________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
attached mail follows:
Hi all,
I noticed this chunk of code in a site the other day:
<input type="Submit" name="btn" value="Yes"> <input type="Submit" name="btn" value="No">
My GUESS is that if i click the "Yes" button, I magically get $btn = "Yes" as a var is the receieving PHP script. I was just about to test this, when I realised that (from what I can tell) multiple submits are not supported by CGI spec.
So, even if it works on my browser/platform/server/php combination, can I be sure it'll work faithfully on all environments?
Should I be worried about what the browser sends, or what PHP does with it, etc etc?
Has anyone doen some serious testing on this? Good or bad stories?
Justin French
attached mail follows:
I've written a simple recursive function to convert trees like <*a* <*b*, *c*>, <*d*>> into PHP arrays like the corresponding one as generated by array (a, array (b, c), d)
The resulting array construct is directly usable. Feel free to include the function in your own sources and modify it at will. I hereby release it under the bugroff license available from http://www.geocities.com/SoHo/Cafe/5947/bugroff.html
this is the code:
function free_to_array ($str) {
$i = 0; while ($cursor < strlen ($str)) {
while ( ($c = substr ($str, $cursor, 1)) == " " || $c == "\n" || $c == "," || $c == ".") $cursor ++;
$match = $c; if ($c == "<") $match = ">";
$end = strpos ($str, $match, ++ $cursor); $level[$i] = substr ($str, $cursor, $end - $cursor);
if ($c == "<") $level[$i] = free_to_array ($level[$i]); $cursor = $end + 1; $i ++; }
return $level; }
and a practical application example:
xml_open ("test", "<*language*> <*JavaScript*>");
creating element/value pairs for use in XML-like documents without the syntax overhead of nested calls to arrays.
D. Alvarez Arribas <alvarez
st-oneline.net>
>You have to write your own function for this.
>> I want a function or macro to return executable code yielding syntax >> preprocessing of binary trees. Because the Macro Processor seems to be >> somewhat messy I though a regular function might be capable of doing the >> job. >> >> e.g. >> >> btree ('(("a", "b")("c", "d"))') >> >> should be expanded to >> >> array (array ("a", "b") >> array ("c", "d") >> >> >> How can I archieve this?
attached mail follows:
Correction to the code submitted
s/example/xml_open ("script", "<*language* *JavaScript*>");
I had snipped it from prior debugging code - sorry for that.
D. Alvarez Arribas <alvarez
st-oneline.net>
attached mail follows:
Hi folks
While we are on the subject of strategic issues for PHP, a quick question on the OOP functionality.
As many on this list will know, there is a peculiarity with the PHP object model - in many situations it creates a copy of an instance when you would expect a reference. This means that you have to constantly remember to create references with &, adding an extra source of hard-to-find bugs.
Are there any plans to sort this out? It rather disfigures the language.
Yes, I know PHP was conceived as a functional language, but a high percentage of the more sophisticated applications make use of its object functionality - you just have to look at the script download sites to see that this is true. Both Perl and C/C++ are examples of successful hybrid languages. With just a little extra work, PHP could join this list...
Geoff Caplan
attached mail follows:
Is there a way to compare between two scripts ?
like how much time took every script or how much memory/resources it used.
-------------------------- Canaan Surfing Ltd. Internet Service Providers Ben-Nes Michael - Manager Tel: 972-4-6991122 http://sites.canaan.co.il --------------------------
attached mail follows:
I have a simple problem, but for some reason I can't figure it out! I need to read in a string from a short text file, so I do that the normal way: /* // get string from the text file. $filename = "textfilehere.text"; $fd = fopen ($filename, "r"); $contents = fread ($fd, filesize ($filename)); fclose ($fd); */
however, this text file contains variables, for example, the first could be:
Hello $variable_here
now when i print out the text file (it really needs to be emailed, but anyway) the variables are not parsed with the variables from the script, so instead of printing the contents of $variable_here within that string, it actually prints "$variable_here". so, how can i parse a text file read into a string for variables??
any help is appreciated, and thank you very much in advance!
-derick
attached mail follows:
I have a html page including php scripts that perform different stuff. The page contains a form (a Select 'products-price' and a field 'qty'). Depending the choice made by the user, I need to know what item in the SELECT object was choose and the number entered in the 'Qty' field to initialized a 'subtotal' zone BEFORE the user submit the form. This functionality is common to all e-business sites when you have to clic on the 'update' button before submit the form.
Any idea ?
thanks
----------------------------------
Stéphane Pinel
39, Rue du Docteur Heulin
75017 Paris (FRANCE)
33 1 53 11 05 77
33 6 08 94 63 16
spinel
noos.fr
----------------------------------
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]