php-general Digest 17 Feb 2005 16:06:00 -0000 Issue 3291

2005-02-17 Thread php-general-digest-help

php-general Digest 17 Feb 2005 16:06:00 - Issue 3291

Topics (messages 208879 through 208922):

Re: Session Vars and Performance
208879 by: trlists.clayst.com

login error to mySQL from PHP
208880 by: David Freedman
20 by: Dan Phiffer
208894 by: Burhan Khalid

Re: Password Protection
208881 by: Bret Hughes
208893 by: Burhan Khalid
208895 by: Joe Wollard
208897 by: Steve
208904 by: Kevin Javia

Re: Getting floats from 8 byte IEEE binary representations
208882 by: Bret Hughes
208884 by: Dan Phiffer

Re: XHTML 1.1  +  php sessions  =  :(
208883 by: Dan Phiffer
208887 by: Bret Hughes

Re: strange behaviour upgrade from 4.3.10 - 5.0.3 : cgi works but apache does 
not
208885 by: Dan Phiffer

Re: Why is my class throwing this error?
208886 by: Dan Phiffer
208890 by: Bret Hughes

Undefined function - mysql_connect() - php5?
208889 by: Jacques
208891 by: Lester Caine

Re: php login
208892 by: William Stokes

Re: Appending DOM doc as child in another DOM doc
208896 by: Christian Stocker

Re: [PHP-DEV] toString() in SimpleXML?
208898 by: Leendert Brouwer

Re: pcntl_fork() hangs with FUTEX_WAIT
208899 by: Steve

Crawlers (was parsing large files - PHP or Perl)
208900 by: John Cage

Problem connecting to MySQL with PEAR::DB and mysqli
208901 by: markusjais.gmx.de

md5 passwords to db
208902 by: William Stokes
208917 by: AdamT

Re: Dynamic/runtime object creation
208903 by: joe Lovick
208911 by: kermodebear.kermodebear.org

Re: Running PHP from inside another application!
208905 by: Mikael Andersson

map internal extension name to actual file
208906 by: Zac Barton

Re: reading/writing files outside of web root
208907 by: Phil Ewington - 43 Plc

FOPEN
208908 by: Diana Castillo
208910 by: Mikey

CURLOPT_RETURNTRANSFER
208909 by: QT

help me
208912 by: K Karthik
208921 by: Robby Russell

use_soap_error_handler
208913 by: FENDT Charles
208914 by: Jochem Maas
208915 by: FENDT Charles
208916 by: Jochem Maas
208918 by: FENDT Charles
208920 by: Jochem Maas

traversing multi-dimensional arrays
208919 by: blackwater dev

username and password auth
208922 by: William Stokes

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
php-general@lists.php.net


--
---BeginMessage---
On 16 Feb 2005 Richard Lynch wrote:

 Use the exact same session stuff you have now and just dump the
 serialized data into SQL using the 5 functions for session handling. 

Oh, OK, that's what you meant about the 5 functions.  I am not sure of 
the advantage to that, actually something I've always wondered.  
Especially if I am serializing the data anyway -- the way I see it is 
as follows (we are in the realm of theorizing here):  Serializing is 
serializing, likely just as fast whether using the built-in session 
mechanism or a replacement, or even serializing it myself, I'm sure it 
all goes through the same underlying routine.  Writing and reading a 
single flat data record like this through MySQL has to be slower than 
using a flat file, unless PHP flat file access is somehow drastically 
slower than it should be.  Ergo, I'm likely to lose, not gain, by using 
MySQL.  (So why did I ask the original question?  Because I hadn't 
analyzed it this carefully first!)

 It's literally an hour's work to alter the code to use MySQL to store the
 sessions instead of the hard drive.
 
 This might or might not improve performance.

As mentioned above -- under what circumstances would it improve?  
Perhaps if file open is an expensive operation and the database is 
already open.  But it's hard to think of where one would expect the SQL 
access to be faster.

 It's incredibly UNLIKELY that trying to send an SQL query for every single
 line of code that currently does $_SESSION[...] = ...; is going to be
 faster... I'd almost be willing to say IMPOSSIBLE that would be faster,
 but somebody would post a trivial example to prove me wrong :-)

Totally agree.

 But you'd probably find it easier to write a C extension and
 re-compile PHP to pre-load all the stuff. 
 
 None of which applies to you, I don't think, but you may want to
 re-read that thread. 

Well when I am not doing PHP programming I do C and C++ programming so 
I could conceivably do that, but have no desire to -- and my client  
certainly wouldn't want to pay for it!

--
Tom
---End Message---
---BeginMessage---
I am attempting to install both phpMyAdmin and phpLens. When attempting to
connect to the mySql server I get the following error message:

 Unable to 

[PHP] Re: Password Protection

2005-02-17 Thread Steve
Kevin Javia wrote:
I am experimenting on my site and I want to make it password protected like
www.realsolution.com.
If any one enters correct user name and password, only then they will be
able to enter into my site.
How can I do that in PHP?
Any ideas? Thanks a ton in advance.

Try this:

function authenticate() {
  header('WWW-authenticate: basic realm=My protected area');
  header('HTTP/1.0 401 Unauthorized');
  print 'Please use a correct login!';
  exit;
}
function authorize() {
  if( (!isset($_SERVER['PHP_AUTH_USER']))
 or ($_SERVER['PHP_AUTH_USER'] == '') ) {
authenticate();
  }
  else {
$login = strtolower($_SERVER['PHP_AUTH_USER']);
$passwd = $_SERVER['PHP_AUTH_PW'];
if (.) { // check $login and $passwd against the list of 
authorized users
  return true;
}
else {
  authenticate();
}
  }
  return false;
}

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


[PHP] Re: [PHP-DEV] toString() in SimpleXML?

2005-02-17 Thread Leendert Brouwer
Hi Marcus,
Marcus Boerger wrote:
  having a function __toString() would interfere with the mapping ideas of
SimpleXML. However it is there internally so you simply do one of the
following:
php -r '$x=SimpleXML_load_string(?xml version=\1.0\?rootblablabla/root); echo 
$x, \n; var_dump((string)$x);'
I'm aware of that. But how would something like nodeValue() interfere 
with the mapping ideas behind SimpleXML? IMHO, casts are not intuitive 
in a development process, especially not when you need them as much as 
you would in SimpleXML. Now it just feels like working around a problem 
when coding.

further questions please to [EMAIL PROTECTED]
as you wish..
Monday, February 14, 2005, 1:23:44 PM, you wrote:

Hi,

I have a feature request. Maybe it would be a good idea to have a 
toString() or perhaps nodeValue() method in SimpleXML's SimpleXMLElement 
class? It might make it more obvious that the element is still a 
SimpleXMLElement object when you want to actually use it (when you print 
it, the value automagically casts to a string internally, so users might 
think that it will be casted to a string when you directly access it 
without a specified property/method, which is not the case). I know that 
the docs say that you should cast it to a string when you want to do a 
comparison, but apart from that just being an example, maybe my 
suggestion is a more obvious one to notice?

regards,

Leendert



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


Re: [PHP] pcntl_fork() hangs with FUTEX_WAIT

2005-02-17 Thread Steve
Well, but I don't use multithreading? PHP is running as CLI exec, not 
compiled into Apache...

That's my configure command:
./configure  --enable-pcntl --with-curl --with-mysql
Or do I have to care for thread safety anyway?
Regards,
Steve

Richard Lynch wrote:
Steve wrote:
I have a program which creates a lot of children over the time, which
terminate themselves after they are finished.
After some time however, the parent process hangs; apparently in
pcntl_fork(). The child from this fork, however, seems to run normally.
An strace on the parent shows futex(0x471cb0, FUTEX_WAIT, 2, NULL
The program runs on PHP 5.0.3-cli and Linux 2.6.
Has anyone an idea what could be the reason for that hang?

Didja try:
http://www.google.com/search?q=FUTEX_WAIT
I did and got:
http://lists.boost.org/MailArchives/boost-users/msg07650.php
So I'm guessing you didn't compile *everything* on your PHP/Apache system
with multi-thread support.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Crawlers (was parsing large files - PHP or Perl)

2005-02-17 Thread John Cage
Hi there
Just an update.  We altered our code last night and the result is that 
we have managed to bring in everything with no problem now. The slowest 
part was actually pulling down the emails which are on another server. 
I'd like to thank everyone for their help

I have another project I'm working on - more as a hobby than anything 
else.  I need to create a crawler that will crawl approximately 100,000 
domains, pull in the information and then classify the content based on 
some logic (still to be decided but thinking of using bayesian 
filters).  Is there anyone on this list who has written fast and decent 
crawlers in PHP who would be willing to share their experiences?

Thanks again for your help - it was much appreciated
John
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Problem connecting to MySQL with PEAR::DB and mysqli

2005-02-17 Thread markusjais
hello


when connecting to MySQL 4.1 using PHP 5 and PEAR::DB I get this error:

DB Error: connect failed

a closer look gets this:

Can't connect to local MySQL server through socket 'localhost' (2)

the code for the connection is like this::


public static function getConnection() {
   $mysql_user = myname;
   $mysql_password = secret;
   $mysql_host = localhost;
   $db_name = mydb;
   $dsn = mysqli://$mysql_user:[EMAIL PROTECTED]/$db_name;
   echo $dsn;
   $db = DB::connect($dsn);
   if(DB::isError($db)) {
  echo $db-getMessage();
   }
   return $db; 
}
===

the DSN looks correct:
and in the php.ini I set the following option:

mysqli.default_socket = /var/lib/mysql/mysql.sock

this is where the socket for mysql access is.
then I restarted apache and mysqld.

the MySQL Server is running. I can connect via mysql on the command line
but not with PEAR::DB. 

I am using PHP 5, the latest PEAR::DB, Apache 1.3 on a Redhat 7.3 System.

any ideas what's wrong here ?

Markus

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



[PHP] md5 passwords to db

2005-02-17 Thread William Stokes
Hello,

I need to make a script/form that can create username and md5 password and 
save the info to mysql db.

Can anyone help?

Thanks
-Will
 

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



[PHP] Re: Dynamic/runtime object creation

2005-02-17 Thread joe Lovick
Thanks for your help Jason, yes aggregating methods was what i had in mind,
but now as i explore it as a option i realise that it would work best is if
their was a way for me to pull my object out of the database variables, data,
methods and all and then instantiate them some how, with out any of the code
being prewritten.
a bit like create_function() for lambada type functions, but in this case for
my more general object code... and searching the hell out of all these formums
 gives me the classkit functions, so i guess i will try and install and give
them a try...
anyhow
cheers
 joe
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Password Protection

2005-02-17 Thread Kevin Javia
Thank you people.

Kevin Javia [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I am experimenting on my site and I want to make it password protected
like
 www.realsolution.com.

 If any one enters correct user name and password, only then they will be
 able to enter into my site.

 How can I do that in PHP?

 Any ideas? Thanks a ton in advance.

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



[PHP] Re: Running PHP from inside another application!

2005-02-17 Thread Mikael Andersson
Thanx!

I found a component for Delphi that solved my problem through SAPI.
It's called PHP4Delphi.

/ Mike

Jason Barnett [EMAIL PROTECTED] skrev i meddelandet 
news:[EMAIL PROTECTED]

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



[PHP] map internal extension name to actual file

2005-02-17 Thread Zac Barton
Hi,

Does anyone have any good ideas of how to find out what extension was 
loaded/enabled from what actual file.

For example the ming extension (thats its internal name) could come from 
php_ming.dll in my extensions dir. But if the file name is say mingFlash.dll 
how can i determine (in php) that my ming functions come from the mingFlash.dll 
file?

I had thoughts of getting the name of the first function from 
get_extension_funcs(ming) and then seeing if the text of the function name 
appeared in the actual content of mingFlash.dll, but it seems a bit inaccurate 
and slow. Can unpack help me here?

To re-cap id love to be able to say (from within php), yea the ming extension 
was loaded by enabling the mingFlash.dll in php.ini.

Hope that makes sense

Zac

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



RE: [PHP] reading/writing files outside of web root

2005-02-17 Thread Phil Ewington - 43 Plc
 Jason Wong wrote:
  On Wednesday 09 February 2005 02:31, Richard Lynch wrote:
  Phil Ewington - 43 Plc wrote:
   For some reason user_prefs will not open
   for read/write even when I tested it under apache.apache and chmod'd
   to 755,
   perhaps because /home is owned by root?
 
  Something went wrong with this test.
 
  You SHOULD have been able to read/write that file in PHP, assuming
  'apache' is the user PHP runs as.  Use http://php.net/phpinfo to
  confirm that it really *IS* 'apache' user that's running apache/php.
 
  It *will* fail if apache has no access to $HOME!

 I stand corrected.

 In addition to read/write access to the file itself, Apache must have at
 least eXecute (directory listing) permission to the directory containing
 that file.

 /home being owned by root is not the issue -- But if it's not something
 the apahce user can 'ls /home' and get the contents of, then you've got a
 problem.

Thanks for all the input guys. The cron job suggestion is a great idea and I
will go with this over using sudo. Thanks again.

- Phil Ewington.
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.8 - Release Date: 14/02/2005

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



[PHP] FOPEN

2005-02-17 Thread Diana Castillo
   How can I read the contents of a web page that uses basic authentication? 
I want to use fopen() but dont know how to do this and also send the 
username and password

-- 
Diana Castillo
Global Reservas, S.L.
C/Granvia 22 dcdo 4-dcha
28013 Madrid-Spain
Tel : 00-34-913604039 Ext 216
Fax : 00-34-915228673
email: [EMAIL PROTECTED]
Web : http://www.hotelkey.com
  http://www.destinia.com

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



[PHP] CURLOPT_RETURNTRANSFER

2005-02-17 Thread QT
dear Sirs,

I am running a script which is on the remote server. I do not want to wait
output of that script, when I run my script. Because some time, other script
takes a long time to complete job. I just want to run other script.

I used following curl option but still my script grap other script outputs.

curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 0);

What I should to do?



any idea

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



RE: [PHP] FOPEN

2005-02-17 Thread Mikey
http://uk.php.net/header should help you.

BTW, you should address your replies to the list and not to individual ppl.

Mikey

 -Original Message-
 From: Diana Castillo [mailto:[EMAIL PROTECTED] 
 Sent: 17 February 2005 12:36
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] FOPEN
 
 how do I send headers with php?
 - Original Message -
 From: Mikey [EMAIL PROTECTED]
 To: 'Diana Castillo' [EMAIL PROTECTED]
 Sent: Thursday, February 17, 2005 1:32 PM
 Subject: RE: [PHP] FOPEN
 
 
 How can I read the contents of a web page that uses basic
  authentication?
  I want to use fopen() but dont know how to do this and also
  send the username and password
 
  I don't know exactly what they are, but it should just be a case of 
  sending
  the correct HTTP headers at the start of your request
  http://www.w3.org/Protocols/#Specs should give you the 
 information you
  need...
 
  HTH,
 
  Mikey
  
 
 

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



Re: [PHP] Dynamic/runtime object creation

2005-02-17 Thread kermodebear
Hello Joe,

If you are careful, you can build a string of PHP and eval() it to create a new
class definition. I've done this before, but it was for the novelty more than
needed to actually use it.

I know for a fact that I have seen several projects for this on the web;
However, I tried doing a quick search and I was unable to find anything.
Figures. do:

Anyways, yes it is possible and people have done it before, but if I were going
down this path I would second guess myself as to if this was the best solution.
You should be able to get by with something simpler (and less time consuming to
develop and test). I recommend finding a different solution, but if this is
what _you_ need to do then who am I to tell you no?

Best of luck!
-KBear


Original Message Below:
Hi,
 forgive me if this is a complete noob question
What i want to do is create an object at runtime with members and 
methods based
on the result of queries from my db back end. is this (a) possible? or (b)
something i should get out of my head and go and find a better solution?
basically is their a create_object() style function, and some
add_method() / add_member() style functions, that to allow me to instance things
dynamically at runtime.

sorry that i am not being to clear, but i hope you can get my gist, thanks in
advance to any help any of you can give me!

cheers
joe

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



[PHP] help me

2005-02-17 Thread K Karthik
can u help me to use $_SERVER['remote_addr'] to find the IP address ?
i am new to php. i also want to find what page of my site he is viewing ?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] use_soap_error_handler

2005-02-17 Thread FENDT Charles
Hello...
Someone knows how this work ?
use_soap_error_handler
I search a way to handle SoapFault exceptions from the SoapServer class...
Regards
FENDT Charles
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] use_soap_error_handler

2005-02-17 Thread Jochem Maas
FENDT Charles wrote:
Hello...
Someone knows how this work ?
use_soap_error_handler
I don't have a clue but looking at the docs you have at least 2 other ways 
of
handling SOAP errors:
1. http://php.paradoxical.co.uk/manual/en/function.is-soap-fault.php
2. use a try/catch block
try {
// do some SOAP stuff here
}
catch (SoapFault $e) {
// catch SOAP specific exceptions here
}
catch (Exception $e) {
// catch general exceptions
}
I DO NOT KNOW what the classname of the Soap Exception assuming SoapServer
does not just throw std Exceptions... so I guessed that it might be called
SoapFault the manual seems to indicate that this is correct.
HTH - (I just figured out wtf HTH means :-)
I search a way to handle SoapFault exceptions from the SoapServer class...
Regards
FENDT Charles
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] use_soap_error_handler

2005-02-17 Thread FENDT Charles
Jochem Maas a écrit :
FENDT Charles wrote:
Hello...
Someone knows how this work ?
use_soap_error_handler

I don't have a clue but looking at the docs you have at least 2 other 
ways of
handling SOAP errors:

1. http://php.paradoxical.co.uk/manual/en/function.is-soap-fault.php
is_soap_fault is only for SoapClient...
2. use a try/catch block
try {
// do some SOAP stuff here
}
catch (SoapFault $e) {
// catch SOAP specific exceptions here
}
catch (Exception $e) {
// catch general exceptions
}
and try catch nothing !!!
just an exmple :
?php
echo begin\n;
$server = new SoapServer(null, http://test/;);
try {
  $server-handle();
} catch (Exception $e) {
  echo ERROR\n;
}
echo end\n;
?
:-(
that's why y search some stuff over use_soap_error_handler
Is the solution there ???
FENDT Charles

I DO NOT KNOW what the classname of the Soap Exception assuming SoapServer
does not just throw std Exceptions... so I guessed that it might be called
SoapFault the manual seems to indicate that this is correct.
HTH - (I just figured out wtf HTH means :-)
I search a way to handle SoapFault exceptions from the SoapServer 
class...

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


Re: [PHP] use_soap_error_handler

2005-02-17 Thread Jochem Maas
FENDT Charles wrote:
Jochem Maas a écrit :
FENDT Charles wrote:
Hello...
Someone knows how this work ?
use_soap_error_handler

I don't have a clue but looking at the docs you have at least 2 other 
ways of
handling SOAP errors:

1. http://php.paradoxical.co.uk/manual/en/function.is-soap-fault.php

is_soap_fault is only for SoapClient...
ah, ok, sorry.

2. use a try/catch block
try {
// do some SOAP stuff here
}
catch (SoapFault $e) {
// catch SOAP specific exceptions here
}
catch (Exception $e) {
// catch general exceptions
}

and try catch nothing !!!
just an exmple :
?php
echo begin\n;
$server = new SoapServer(null, http://test/;);
try {
  $server-handle();
} catch (Exception $e) {
  echo ERROR\n;
}
echo end\n;
?
I can't test this (no machine with the SOAP extension + lack of time +
less than stellar skills when it comes to compiling stuff :-)
I am wondering what the return value of $server-handle() is, maybe
you will have to check the return value to see if an error occurs.
:-(
that's why y search some stuff over use_soap_error_handler
Is the solution there ???
FENDT Charles

I DO NOT KNOW what the classname of the Soap Exception assuming 
SoapServer
does not just throw std Exceptions... so I guessed that it might be 
called
SoapFault the manual seems to indicate that this is correct.

HTH - (I just figured out wtf HTH means :-)
I search a way to handle SoapFault exceptions from the SoapServer 
class...

Regards
FENDT Charles

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


Re: [PHP] md5 passwords to db

2005-02-17 Thread AdamT
On Thu, 17 Feb 2005 11:33:45 +0200, William Stokes [EMAIL PROTECTED] wrote:
 Hello,
 
 I need to make a script/form that can create username and md5 password and
 save the info to mysql db.
 
You can use:  http://www.php.net/md5 to make MD5 hashes from strings,
or you can just the format of the database field to MD5, which IIRC
will automagically store whatever's assigned to it as an MD5 hash.

-- 
AdamT
Justify my text?  I'm sorry, but it has no excuse.

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



Re: [PHP] use_soap_error_handler

2005-02-17 Thread FENDT Charles
Jochem Maas a écrit :
FENDT Charles wrote:
Jochem Maas a écrit :
FENDT Charles wrote:
Hello...
Someone knows how this work ?
use_soap_error_handler


I don't have a clue but looking at the docs you have at least 2 other 
ways of
handling SOAP errors:

1. http://php.paradoxical.co.uk/manual/en/function.is-soap-fault.php

is_soap_fault is only for SoapClient...

ah, ok, sorry.

2. use a try/catch block
try {
// do some SOAP stuff here
}
catch (SoapFault $e) {
// catch SOAP specific exceptions here
}
catch (Exception $e) {
// catch general exceptions
}

and try catch nothing !!!
just an exmple :
?php
echo begin\n;
$server = new SoapServer(null, http://test/;);
try {
  $server-handle();
} catch (Exception $e) {
  echo ERROR\n;
}
echo end\n;
?

I can't test this (no machine with the SOAP extension + lack of time +
less than stellar skills when it comes to compiling stuff :-)
I am wondering what the return value of $server-handle() is, maybe
you will have to check the return value to see if an error occurs.
void ... :-(
void SoapServer::handle([string])
no exception...
in 2 words... NO INFORMATION on what happened
FENDT Charles

:-(
that's why y search some stuff over use_soap_error_handler
Is the solution there ???
FENDT Charles

I DO NOT KNOW what the classname of the Soap Exception assuming 
SoapServer
does not just throw std Exceptions... so I guessed that it might be 
called
SoapFault the manual seems to indicate that this is correct.

HTH - (I just figured out wtf HTH means :-)
I search a way to handle SoapFault exceptions from the SoapServer 
class...

Regards
FENDT Charles

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


[PHP] traversing multi-dimensional arrays

2005-02-17 Thread blackwater dev
Hello all,

What is the best way to do this?  I have two arrays:

$cars=array(ford,chevy);
$models=array(ford=array(ranger,escape),chevy=array(malibu,tahoe));

then I need to traverse both arrays:

   foreach ($cars as $car){
   //now I need to get into the models array and echo out all 
of the
models that
 //coincide with the specific car so it should print
out ford-ranger
//I basically want to do this but can't
   //how can I get into this second array without looping
through the whole thing each time?
   foreach($cars[$car] as $model){
  
  }

  }

Thanks!

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



Re: [PHP] use_soap_error_handler

2005-02-17 Thread Jochem Maas
FENDT Charles wrote:
...
just an exmple :
?php
echo begin\n;
$server = new SoapServer(null, http://test/;);
try {
  $server-handle();
} catch (Exception $e) {
  echo ERROR\n;
}
echo end\n;
?

I can't test this (no machine with the SOAP extension + lack of time +
less than stellar skills when it comes to compiling stuff :-)
I am wondering what the return value of $server-handle() is, maybe
you will have to check the return value to see if an error occurs.

void ... :-(
void SoapServer::handle([string])
no exception...
in 2 words... NO INFORMATION on what happened
have you tried setting a handler function for the SoapServer,
before calling SoapServer::handle() ?:
function test($v) { var_dump($v); }
$server-addFunction(test);
if you do that do you get any output? if not then I'm really no more help to
you... you next best bet is to dive into CVS and check the test scripts (if 
there are any),
unpublished documentation/examples (if there are any) and the source code (if 
it means
anything to you.)
if all that fails you might consider going higher up the PHP foodchain
and mailing the maintainer/list politely asking whether there maybe a problem - 
if you
do decide to mail the maintainer  or internals or something - be polite, 
apologetic, consise
and make sure you detail your problem fully - they are all busy people and you 
want to
maximise the chance of getting a useful reply :-).

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


Re: [PHP] help me

2005-02-17 Thread Robby Russell
On Thu, 2005-02-17 at 19:11 +0530, K Karthik wrote:
  can u help me to use $_SERVER['remote_addr'] to find the IP address ?
  i am new to php. i also want to find what page of my site he is viewing ?
 

print_r($_SERVER);

what do you see?



-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting  Development
* --- Now hosting Ruby on Rails Apps ---
/

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



[PHP] username and password auth

2005-02-17 Thread William Stokes
Hello,

What is the best or right way to compare users name and password given in a 
web form to data in mysql database?

I saw one example where sql SELECT query was made with username and password 
as WHERE and the script tested how many rows was returned from database if 
there was 1 row returned the login was accepted.

Is there other ways to do this? What if the usertable has more than these 2 
columns.

Thanks
-Will 

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



RE: [PHP] username and password auth

2005-02-17 Thread Jay Blanchard
[snip]
What is the best or right way to compare users name and password given
in a 
web form to data in mysql database?

I saw one example where sql SELECT query was made with username and
password 
as WHERE and the script tested how many rows was returned from database
if 
there was 1 row returned the login was accepted.

Is there other ways to do this? What if the usertable has more than
these 2 
columns.
[/snip]

How familiar are you with database usage and SQL?

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



[PHP] Crontab for Windows

2005-02-17 Thread bob
Hi,
I am trying to schedule the running of some PHP scripts on my Win2K PC 
at home.

On my live server I use Linux, so am fully familiar with Crontab. I am 
not that familiar with running scripts using the scheduler in Win2K though.

So far what I have is:
C:\php\php.exe -q c:\path\to\php\file.php
But this doesn't seem to do anything..the task manager in the windows 
scheduler just keeps saying that the task has not been run.

Any suggestions?
Also, one thing I would like my script to do is to send out an email, 
but I don't have a mail server set up on my home PC..is there anyway to 
run a script from a server on a different machine, using Windows 
scheduler, and if so, what form would the 'path' to the file/server take?

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


[PHP] Request for old-timers

2005-02-17 Thread Rasmus Lerdorf
Anybody happen to have an archive of the old [EMAIL PROTECTED] 
Majordomo mailing list from 1995 or have an idea where I might be able 
to get that?  Or perhaps an email backup of any correspondence with me 
from back then?

Please reply privately to avoid cluttering this list.
-Rasmus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Crontab for Windows

2005-02-17 Thread Michelle Konzack
Am 2005-02-17 11:31:22, schrieb bob:
 Hi,

 On my live server I use Linux, so am fully familiar with Crontab. I am 
 not that familiar with running scripts using the scheduler in Win2K though.

 Any suggestions?

wincron.exe ?

Search with GOOGLE for it...
It exist since the old WfW 3.11 days.

 Also, one thing I would like my script to do is to send out an email, 
 but I don't have a mail server set up on my home PC..is there anyway to 
 run a script from a server on a different machine, using Windows 
 scheduler, and if so, what form would the 'path' to the file/server take?

smtp.exe

Search with GOOGLE for it...
It is a 16 or 32 Bit Commandlinetool.
It can send PRE-Written E-Mails where all Headers must be in the File.

 Many thanks
 Alexis

Greetings
Michelle

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/ 
Michelle Konzack   Apt. 917  ICQ #328449886
   50, rue de Soultz MSM LinuxMichi
0033/3/8845235667100 Strasbourg/France   IRC #Debian (irc.icq.com)


signature.pgp
Description: Digital signature


[PHP] mail, CRLF, RFCs, MTAs, Windows and Unix [long]

2005-02-17 Thread Christophe Chisogne
I dont know if it's the right place to post, but anyway...
(Sorry for the cross-post.)
I think the doc for the mail function [1] should be improved,
after reading bug 15841 [2], mail.c [3], skim some RFCs,
and after I had different problems with PHP mail()
Basicaly, the doc says to use
- \n in body
- \r\n in extra headers
As far as I understand the matter:
- SMTP requires \r\n : cfr RFCs (ex 822, 2822)
- Under windows, PHP mail directly uses socket and SMTP
- Under *nix, PHP mail uses \n to send subject, to, etc [3]
  to the sendmail/postfix/qmail binary (ok, *nix eol is \n),
  then the MTA uses translate this to SMTP with \r\n
  (adding \r to standalone \n if needed) -- ok, RFC want \r\n
Which basicaly means
- Under windows (SMTP, so \r\n)
  use \r\n for body (doc says \n) : doc KO
  use \r\n for mail headers (doc says \r\n) : doc ok
- Under *nix (local sendmail and eol, so \n, not SMTP)
  use \n for body (doc says \n) : doc ok
  use \n for mail headers (doc says \r\n) : doc KO
So, the doc is sometimes correct, sometimes not,
and it leads to problems (portability, ignored headers,
etc).
I think correct behaviour is
- windows (direct SMTP): use \r\n for headers and body
- *nix (local eol, then SMTP): use \n for headers and body
At least, it seems Postfix works that way, perhaps Qmail too
(I dont know for other MTAs)
My question is twofold (three?)
1. Am I right about that 'correct behaviour' or do I miss something?
2. If I am, could the doc be improved and explain that?
   Ex doc says
   Some poor quality Unix mail transfer agents replace LF by CRLF
   but
   \n is unix end of line, PHP src code use \n itself [3],
   and MTA must speak SMTP and use \r\n, so conversion seems required.
-- I guess 3 is not a very good idea
3. use \n everywhere, php will automagically s#\n#\r\n# on windows only.
   this would add portability between *nix and windows
Christophe
PS Below is an example of problem I had.
If I follow current mail() doc on my Linux server,
ie using \n for body (ok) and \r\n for headers (ko),
something like this will fail:
$headers = From: [EMAIL PROTECTED]: [EMAIL PROTECTED];
$body = Hello\nWorld;
Postfix (which uses \n for local *nix delivery [4])
generates headers with \n for standard headers
and \r\n for extra headers, which break RFCs
and cause many mail clients to see part of the headers
as part of the body (really ugly):
To:   [EMAIL PROTECTED]
Subject:  foo bar\n
From: [EMAIL PROTECTED]
Cc:   [EMAIL PROTECTED]
X-Mailer: efg\r\n
Which some mail clients (thunderbird and others) see as
To:   [EMAIL PROTECTED]
Subject:  foo bar\r\n
From: [EMAIL PROTECTED]-- headers break here
Cc:   [EMAIL PROTECTED]
X-Mailer: efg\r\r\n
[1] PHP manual : mail()
http://www.php.net/manual/en/function.mail.php
[2] PHP Bug 15841
http://bugs.php.net/bug.php?id=15841
[3] PHP src : mail.c
http://cvs.php.net/php-src/ext/standard/mail.c
[4] Subject: Re: CRLF vs. LF (From: Wietse Venema)
http://archives.neohapsis.com/archives/postfix/2000-02/0398.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Crontab for Windows

2005-02-17 Thread Warren Vail
 On my live server I use Linux, so am fully familiar with Crontab. I am
 not that familiar with running scripts using the scheduler in
 Win2K though.

I use nncronlite which is a cron implementation for windoz (familiar
crot.tab file);

http://www.batchconverter.com/nnCronLITE-download-16062.shtml

One problem I encountered with the MS scheduler, is it needed to be running
as a process, and in an implementation of windows that had Microsoft SQL
Server running on NT, seems this SQL server has the ability to schedule some
batch processes, but it implemented a replacement for the batch scheduler
that would not process my AT commands.  In windoz the AT command is used
to add processes to the schedule.

hope this helps,

Warren Vail

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



Re: [PHP] traversing multi-dimensional arrays

2005-02-17 Thread Brent Baisley
Forget about the $cars array. The array key in the $models array will  
be your car list.

$cars=array(ford,chevy);
$models=array(ford=array(ranger,escape),chevy=array(malibu, 
tahoe));
//Loop through first level of array, getting car maker
foreach($models as $carmaker=$models) {
		//Loop through car models, paring up with maker
		foreach($models as $model) {
			echo $carmaker.'-'.$model.'br /';
		}
}

Another option, which isn't as readable, is to use implode instead of  
the inner loop.
$cars=array(ford,chevy);
$models=array(ford=array(ranger,escape),chevy=array(malibu, 
tahoe));
foreach($models as $car=$models) {
		$pairing = $car.'-'.implode('br /'.$car.'-',$models).'br /';
		echo $pairing;
}

On Feb 17, 2005, at 9:49 AM, blackwater dev wrote:
Hello all,
What is the best way to do this?  I have two arrays:
$cars=array(ford,chevy);
$models=array(ford=array(ranger,escape),chevy=array(malibu, 
tahoe));

then I need to traverse both arrays:
   foreach ($cars as $car){
   //now I need to get into the models array and echo out all 
of the
models that
 //coincide with the specific car so it should print
out ford-ranger
//I basically want to do this but can't
   //how can I get into this second array without looping
through the whole thing each time?
   foreach($cars[$car] as $model){
  }
  }
Thanks!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Password Protection] -- My solution

2005-02-17 Thread Mailit, LLC

---BeginMessage---
Here is the setup that I have used.
Please, adapt to your needs.
Table 'theTable' is supposed to contain columns fname, mname, lname
and ePass (encrypted password). The crypt() function produces a password 
that
cannot be decrypted and really works well.
Of course, you need to use crypt() in the PHP script that creates a row in
'theTable'.

?php
#-- code starts here 
-#
$action = $_POST[action];
if( !empty( $action ) )
{
   $userName = $_POST[userName];
   $passw= $_POST[passw];

   # Bring the encrypted password and creation date from database:
   $cmd = SELECT * FROM theTable 
   .  WHERE userName='$userName' ;
   $res = mysql_query( $cmd ) or die( Password search failed. );
   $numRows = mysql_num_rows( $res );
   if( $numRows == 0 )
   {
   print( $userName not a valid user name.BR );
   exit;
   }
   $rec = mysql_fetch_array( $res );
   $privLevel = $rec[level];
   $nome = $rec[fname]. .$rec[mname]. .$rec[lname];
   # Encrypt the password:
   $passe = crypt( $passw, $rec[ePass] );
   if( $passe == $rec[ePass] )
   {
 /* Bring up the home page */
 print( h2WELCOME TO MY HOME PAGE/h2 );
   exit;
   }
   else
   {
   $retry = 1;
   }
}
   if( $retry )
   print(brh3Incorrect Login - Please, try again./h3br);
   ?
   FORM ACTION=? print( $_SERVER[PHP_SELF] ); ? METHOD=POST 
   INPUT TYPE=hidden NAME=action VALUE=login
   table align=center
   tr
   td
   BUser Name :/B
   /tdtd
   INPUT TYPE=text NAME=userName SIZE=20
   /td
   /trtr
   td
   BPassword :/B
   /tdtd
   INPUT TYPE=password NAME=passw SIZE=20
  /td
   /tr
   /table
   br
   P align=center
   INPUT TYPE=submit VALUE=Login STYLE=width:120;height:25
   /P
   /FORM
!-- - code ends here 
 --
Mario


Kevin Javia wrote:
I am experimenting on my site and I want to make it password protected like
www.realsolution.com.
If any one enters correct user name and password, only then they will be
able to enter into my site.
How can I do that in PHP?
Any ideas? Thanks a ton in advance.
 



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

[PHP] Need Help

2005-02-17 Thread Ramya Ramaswamy
Hii,

Iam currently doing a research on OPen Source Systems.I need some help
on that.I would like to know if there is performance modelling done in
open source and it wud b nice if somebody can throw some light on the
vendor specific certifications for open source.

Please Do help me On this,

Many Thanx
Ramya

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



[PHP] Re: Crawlers (was parsing large files - PHP or Perl)

2005-02-17 Thread Jamie Alessio
Is there anyone on this list who has written fast and decent 
crawlers in PHP who would be willing to share their experiences?

My first inclination would be to use an existing crawler to grab the 
pages and store all the files locally (even if only temporarily). Then, 
you can use PHP to do whatever type of processing you want on those 
files and can even have PHP crawl deeper based on links in those files 
if necessary. I'd have a hard time coming up with a reason to think I 
would implement a better web crawler on my own than is already available 
from other projects that focus on that. What about existing search 
systems like:

Nutch - http://www.nutch.org
mnoGoSearch - http://mnogosearch.org/
htdig - http://www.htdig.org/
or maybe even a wget -r - http://www.gnu.org/software/wget/wget.html
(I'm sure I missed a bunch of great options)
Just an idea - I'd also like to hear if someone has written nice 
crawling code in PHP.

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


[PHP] Hashing strings

2005-02-17 Thread Gerard Samuel
Im currently using md5() to hash strings to be used,
as an id for a cache system.
Im trying to determine if md5() would be the fastest,
*cheapest* solution.
The only native php functions that I know of are md5() and sha1().
Are there any other native php functions that hash
strings?
Thanks
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: traversing multi-dimensional arrays

2005-02-17 Thread Jamie Alessio
What is the best way to do this?  I have two arrays:
$cars=array(ford,chevy);
$models=array(ford=array(ranger,escape),chevy=array(malibu,tahoe));
Why do you even need the $cars array? Wouldn't this work?
foreach($models as $car = $model_array) {
  foreach($model_array as $key = $model) {
print The car is a $car $model;
  }
}
If you know what manufacturer you want ('ford' or 'chevy') then you can 
just get the models for that by doing this:

$car = 'ford';
foreach($models[$car] as $key = $model) {
  print The car is a $car $model;
}
- Jamie
then I need to traverse both arrays:
   foreach ($cars as $car){
		   //now I need to get into the models array and echo out all of the
models that
 //coincide with the specific car so it should print
out ford-ranger
//I basically want to do this but can't
   //how can I get into this second array without looping
through the whole thing each time?
   foreach($cars[$car] as $model){
  
  }

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


[PHP] Re: Hashing strings

2005-02-17 Thread M. Sokolewicz
Gerard Samuel wrote:
Im currently using md5() to hash strings to be used,
as an id for a cache system.
Im trying to determine if md5() would be the fastest,
*cheapest* solution.
The only native php functions that I know of are md5() and sha1().
Are there any other native php functions that hash
strings?
Thanks
I believe crc32 is faster, but it's not that hard to change something in 
the code, and still get the same hash, so I'm not sure if it'd be such a 
great choice

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


RE: [PHP] Re: Crawlers (was parsing large files - PHP or Perl)

2005-02-17 Thread Warren Vail
Check out PHPdig;

http://www.phpdig.net/

Warren

 -Original Message-
 From: Jamie Alessio [mailto:[EMAIL PROTECTED]
 Sent: Thursday, February 17, 2005 9:22 AM
 To: John Cage
 Cc: php-general@lists.php.net
 Subject: [PHP] Re: Crawlers (was parsing large files - PHP or Perl)
 
 
  Is there anyone on this list who has written fast and decent 
  crawlers in PHP who would be willing to share their experiences?
  
 My first inclination would be to use an existing crawler to grab the 
 pages and store all the files locally (even if only temporarily). Then, 
 you can use PHP to do whatever type of processing you want on those 
 files and can even have PHP crawl deeper based on links in those files 
 if necessary. I'd have a hard time coming up with a reason to think I 
 would implement a better web crawler on my own than is already available 
 from other projects that focus on that. What about existing search 
 systems like:
 
 Nutch - http://www.nutch.org
 mnoGoSearch - http://mnogosearch.org/
 htdig - http://www.htdig.org/
 or maybe even a wget -r - http://www.gnu.org/software/wget/wget.html
 (I'm sure I missed a bunch of great options)
 
 Just an idea - I'd also like to hear if someone has written nice 
 crawling code in PHP.
 
 - Jamie
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 

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



Re: [PHP] Hashing strings

2005-02-17 Thread Richard Lynch
Gerard Samuel wrote:
 Im currently using md5() to hash strings to be used,
 as an id for a cache system.
 Im trying to determine if md5() would be the fastest,
 *cheapest* solution.
 The only native php functions that I know of are md5() and sha1().
 Are there any other native php functions that hash
 strings?

You may (or may not) want to look at http://php.net/uniqid

I don't think you actually pass in a string to hash so much as just get a
unique number back.

For *SOME* applications this may or may not be suitable, and it could be
faster than those complex hashing algorithms.  Or not, especially if you
include the optional entropy argument...

You'd have to benchmark and see to be sure, of course.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] mail, CRLF, RFCs, MTAs, Windows and Unix [long]

2005-02-17 Thread Richard Lynch
Christophe Chisogne wrote:
 - Under *nix, PHP mail uses \n to send subject, to, etc [3]
to the sendmail/postfix/qmail binary (ok, *nix eol is \n),
then the MTA uses translate this to SMTP with \r\n
(adding \r to standalone \n if needed) -- ok, RFC want \r\n

I use sendmail.

I use \r\n in the headers.

It works.

Perhaps it only adds \r *IF* there is a solo \n there...



At any rate -- Type up whatever you want to appear in the manual in a User
Contributed note.  If it's worth keeping, it will stay there, or even get
promoted up into the official documentation.


I must say, though, that the problem here seems to be with MTAs (and MUAs)
not following the specification rather than PHP not being correctly
documented.

If people are seeing your headers in the body of their email, the MTA/MUA
is probably what's broken, not PHP.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Crontab for Windows

2005-02-17 Thread Richard Lynch
bob wrote:
 C:\php\php.exe -q c:\path\to\php\file.php

 But this doesn't seem to do anything..the task manager in the windows
 scheduler just keeps saying that the task has not been run.

 Any suggestions?

The Task Scheduler uses the 'at' command under the hood, same as cron...

Perhaps if you dig down into your 'at' command and see if it's broken...

 Also, one thing I would like my script to do is to send out an email,
 but I don't have a mail server set up on my home PC..is there anyway to
 run a script from a server on a different machine, using Windows
 scheduler, and if so, what form would the 'path' to the file/server take?

If a full-fledged SMTP server is too much hassle, and you're looking to
send a relatively light load of email, I've been told that the Pegasus
email client is quite happy and easily run from a command line to send out
mail under Windows.  YMMV

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] mail, CRLF, RFCs, MTAs, Windows and Unix [long]

2005-02-17 Thread Richard Lynch

 $headers = From: [EMAIL PROTECTED]: [EMAIL PROTECTED];

Hey, what's that bullcrap \r\ in there after the Cc: line?!

You can't do that!

Use \r\n there or it will NEVER work right.

You're not following the spec.

:-)


-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] username and password auth

2005-02-17 Thread Richard Lynch
William Stokes wrote:
 What is the best or right way to compare users name and password given in
 a
 web form to data in mysql database?

It's kind of a Good Idea to store the password encrypted using MySQL's
md5() function or other similar functions.

In the old days, you'd use their password() function so you still see that
a lot, but it's deprecated, as they want to be able to change the guts
under-pinning their password() function that they use internally, since
various encryption algorithms become obsolete.

The point being that if somebody breaks into the database, they don't see
any actual passwords, just a bunch of useless junk -- But *YOU* can call
the md5() function on a password and compare the result to what's there.

md5 and similar functions are what you call a one-way encryption --
There's no (easy) way to take the output and go backwards to the input.

 I saw one example where sql SELECT query was made with username and
 password
 as WHERE and the script tested how many rows was returned from database if
 there was 1 row returned the login was accepted.

 Is there other ways to do this? What if the usertable has more than these
 2
 columns.

You don't care about the number of COLUMNS.

If you have two *ROWS* with the same username, then you have the same user
in there twice, which is BAD or two people using the same username which
is REAL BAD.  Don't do that. :-)

So what you saw was fine, but it would be better to use an encryption
function on the password as well.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] traversing multi-dimensional arrays

2005-02-17 Thread Richard Lynch
blackwater dev wrote:
 What is the best way to do this?  I have two arrays:

 $cars=array(ford,chevy);
 $models=array(ford=array(ranger,escape),chevy=array(malibu,tahoe));

 then I need to traverse both arrays:

foreach ($cars as $car){
  //now I need to get into the models array and echo out all 
 of the
 models that
  //coincide with the specific car so it should print
 out ford-ranger
 //I basically want to do this but can't
//how can I get into this second array without looping
 through the whole thing each time?
foreach($cars[$car] as $model){

You were very close:

foreach ($models[$car] as $model){


Note that everybody else's post that you shouldn't even NEED/USE the $cars
array was correct -- unless you've got some other reason to keep it around
and you *DO* need it, for reasons too complicated to put in the original
email.


   }

 }


-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] FOPEN

2005-02-17 Thread Richard Lynch




Diana Castillo wrote:
How can I read the contents of a web page that uses basic
 authentication?
 I want to use fopen() but dont know how to do this and also send the
 username and password

You may be able to do embed the username/password in your URL:

$file = fopen(http://username:[EMAIL PROTECTED]) or die(Could not
open remote page);

You may want to actually store the username/password in a different file,
and try to make it slightly less easy to read/find that file to avoid
exposing passwords, the same way you would do with MySQL
username/password.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] map internal extension name to actual file

2005-02-17 Thread Richard Lynch
Zac Barton wrote:
 Does anyone have any good ideas of how to find out what extension was
 loaded/enabled from what actual file.

 For example the ming extension (thats its internal name) could come from
 php_ming.dll in my extensions dir. But if the file name is say
 mingFlash.dll how can i determine (in php) that my ming functions come
 from the mingFlash.dll file?

 I had thoughts of getting the name of the first function from
 get_extension_funcs(ming) and then seeing if the text of the function
 name appeared in the actual content of mingFlash.dll, but it seems a bit
 inaccurate and slow. Can unpack help me here?

 To re-cap id love to be able to say (from within php), yea the ming
 extension was loaded by enabling the mingFlash.dll in php.ini.

This could be very useful info to have in the http://php.net/phpinfo output.

And I'm betting your fastest way to get what you want is to read the PHP C
source for that function.

Stiff upper lip and all that. :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Problem connecting to MySQL with PEAR::DB and mysqli

2005-02-17 Thread Richard Lynch
[EMAIL PROTECTED] wrote:
 when connecting to MySQL 4.1 using PHP 5 and PEAR::DB I get this error:

 DB Error: connect failed

 a closer look gets this:

 Can't connect to local MySQL server through socket 'localhost' (2)

 the code for the connection is like this::

 
 public static function getConnection() {
$mysql_user = myname;
$mysql_password = secret;
$mysql_host = localhost;
$db_name = mydb;
$dsn = mysqli://$mysql_user:[EMAIL PROTECTED]/$db_name;
echo $dsn;
$db = DB::connect($dsn);
if(DB::isError($db)) {
   echo $db-getMessage();
}
return $db;
 }
 ===

 the DSN looks correct:
 and in the php.ini I set the following option:

 mysqli.default_socket = /var/lib/mysql/mysql.sock

 this is where the socket for mysql access is.
 then I restarted apache and mysqld.

 the MySQL Server is running. I can connect via mysql on the command line
 but not with PEAR::DB.

 I am using PHP 5, the latest PEAR::DB, Apache 1.3 on a Redhat 7.3 System.

You could try using ODBC to connect to the DSN, I think, and maybe see if
it's the DSN itself that is messed up...

Assuming that DSN means the same thing in 'DB' as it does in 'ODBC', which
may be a completely invalid assumption on my part...

Perhaps try changing 'localhost' to '127.0.0.1' in case your DNS and
/etc/hosts are messed up somehow.

I suppose you could even try changing localhost to
'/var/lib/mysql/mysql.sock' -- not that I think it will work, but it's the
kind of desparation thing I always try, and end up learning something
from. :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] pcntl_fork() hangs with FUTEX_WAIT

2005-02-17 Thread Richard Lynch
Steve wrote:

 Well, but I don't use multithreading? PHP is running as CLI exec, not
 compiled into Apache...

 That's my configure command:
 ./configure  --enable-pcntl --with-curl --with-mysql

 Or do I have to care for thread safety anyway?

For all I know (not much) --enable-pcntl may imply that you are doing
multi-threading...  Doesn't it kind of have to?  I mean, isn't that what
pcntl *DOES*?  Allow you to 'fork' a new process, which has its own
separate thread, by definition?  Or maybe processes and threads are
different enough that you're okay on this one...

If so, you have to re-compile cURL and MySQL with multi-threading turned
on as well, at least as I understand the Google answers.

Or maybe you turned on multi-threading with cURL and MySQL when you
compiled them for Apache, but now you need that *OFF* to work with your
non-thread CLI PHP binary.

Maybe there's a command line tool to ask a .so file if it's threaded or
not?   Maybe even just 'file foo.so' will tell you???

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Hashing strings

2005-02-17 Thread Gerard Samuel
Richard Lynch wrote:
Gerard Samuel wrote:
 

Im currently using md5() to hash strings to be used,
as an id for a cache system.
Im trying to determine if md5() would be the fastest,
*cheapest* solution.
The only native php functions that I know of are md5() and sha1().
Are there any other native php functions that hash
strings?
   

You may (or may not) want to look at http://php.net/uniqid
I don't think you actually pass in a string to hash so much as just get a
unique number back.
For *SOME* applications this may or may not be suitable, and it could be
faster than those complex hashing algorithms.  Or not, especially if you
include the optional entropy argument...
You'd have to benchmark and see to be sure, of course.
The problem with uniqid(), is that it changes with time.
What Im looking for is something where the generated hashes can
be reproduced.
For example, md5('foo') today, will be equal to md5('foo') tomorrow.
Thanks
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Dynamic/runtime object creation

2005-02-17 Thread Jason Barnett
joe Lovick wrote:
 Thanks for your help Jason, yes aggregating methods was what i had in mind,
 but now as i explore it as a option i realise that it would work best is if
 their was a way for me to pull my object out of the database variables,
 data,

This is certainly do-able.  You serialize() an object and store this in
the DB...

 methods and all and then instantiate them some how, with out any of the
 code

... however, you *must* include a class definition for an object before
the object can be instantiated.  When an object gets serialized it is
only the object's properties (*not* its methods) that become serialized.

 being prewritten.
 
 a bit like create_function() for lambada type functions, but in this
 case for
 my more general object code... and searching the hell out of all these
 formums

So long as you have the (potential) class definitions already included,
you can use unserialize() to create the object (whatever type it happens
to be).  You don't even need to know what kind of object it's going to
be.  :)

  gives me the classkit functions, so i guess i will try and install and
 give
 them a try...
 anyhow
 cheers
  joe


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: map internal extension name to actual file

2005-02-17 Thread Jason Barnett
Zac Barton wrote:
 Hi,
 
 Does anyone have any good ideas of how to find out what extension was 
 loaded/enabled from what actual file.
 
 For example the ming extension (thats its internal name) could come from 
 php_ming.dll in my extensions dir. But if the file name is say mingFlash.dll 
 how can i determine (in php) that my ming functions come from the 
 mingFlash.dll file?
 
 I had thoughts of getting the name of the first function from 
 get_extension_funcs(ming) and then seeing if the text of the function name 
 appeared in the actual content of mingFlash.dll, but it seems a bit 
 inaccurate and slow. Can unpack help me here?
 
 To re-cap id love to be able to say (from within php), yea the ming extension 
 was loaded by enabling the mingFlash.dll in php.ini.
 

If you just want to know that an extension was loaded then the easiest
way would be this function:

http://www.php.net/manual/en/function.extension-loaded.php

wild_guessIf you really need more specific information about an
extension (such as where the extension library is stored on disk) then
you might be able to pull it out of the PHP class ReflectionExtension
/wild_guess

http://www.php.net/manual/en/language.oop5.reflection.php

 Hope that makes sense
 
 Zac


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] Why is my class throwing this error?

2005-02-17 Thread Richard Lynch
NathanielGuy#21 wrote:
 function displaygallery($user = FALSE, $lastprinted = 0, $move =
 'forward', $limit = 10) {//Line 52

 Error thrown
 --
 Parse error: parse error, unexpected T_STRING in
 /home/blacknut/public_html/picserv/includes/gallery.class on line 52

You probably have a missing ' or  somewhere BEFORE line 52.

And probably in the stuff you chopped out, since others ran the code you
provided with no error.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Session Vars and Performance

2005-02-17 Thread Richard Lynch
[EMAIL PROTECTED] wrote:
 On 16 Feb 2005 Richard Lynch wrote:

 Use the exact same session stuff you have now and just dump the
 serialized data into SQL using the 5 functions for session handling.

 Oh, OK, that's what you meant about the 5 functions.  I am not sure of
 the advantage to that, actually something I've always wondered.
 Especially if I am serializing the data anyway -- the way I see it is
 as follows (we are in the realm of theorizing here):  Serializing is
 serializing, likely just as fast whether using the built-in session
 mechanism or a replacement, or even serializing it myself, I'm sure it
 all goes through the same underlying routine.  Writing and reading a
 single flat data record like this through MySQL has to be slower than
 using a flat file, unless PHP flat file access is somehow drastically
 slower than it should be.  Ergo, I'm likely to lose, not gain, by using
 MySQL.  (So why did I ask the original question?  Because I hadn't
 analyzed it this carefully first!)

Except that your MySQL buffers and caches may well be larger than, or
under-utilized when compared to, your already over-stressed file buffer in
the Operating System.

Sure the data all ends up being written by MySQL sooner or later, and
there's definitely more overhead with MySQL than with the file OS system.

*BUT* there are simply too many variables in buffers, caches, and OS
utilization for you to predict what's faster.

 It's literally an hour's work to alter the code to use MySQL to store
 the
 sessions instead of the hard drive.

 This might or might not improve performance.

 As mentioned above -- under what circumstances would it improve?

When the file system is already getting hammered, but MySQL is
under-utilized for the amount of RAM/cache/buffer space you've given it.

And we can safely assume MySQL has the file already opened up and ready
after your first request, so the file open, which *IS* expensive, will not
be there.

But you've got the MySQL overhead that is inherent to a connection.

But...

We could play this theoretical game all day.

Or you could spend an hour and TEST IT.

[shrug]

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Date() reporting wrong on OS X server intermittently

2005-02-17 Thread Rowan Hick
Hi There, 

I have an app which is installed across a dozen odd organisations, and one
this week which is running on an OS X Xserve machine.

Intermittently this week the PHP app has been seeing the wrong time.
Shifting 12hrs at a time. The IT administrator who runs the box says that
it's all okay, and it's synced correctly with a master server. Suspiciously
enough some workmen had been in on the weekeend prior and may have
cut/spiked the power to the box... (coincidence?)

Is it possible that PHP could see a different date to the OSX GUI ? I
wouldn't think it would be possible at all.

Has anyone out there seen weird problems like this before ?

Many Thanks, 
Rowan

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



[PHP] Problems with print html to pdf

2005-02-17 Thread Juan Antonio Garrido
Hi everybody:

Does it exists someone library I can print html files to pdf without it loss 
information about my property css classes(background,color,width...)?

With GPL library HTML_To_PDF3.3 it isn't possible... 

If the library is GPL much better.

Thank you for all...
-- 

---
Juan Antonio Garrido Mata
Emergya S.L
Tel. +34 954 98 10 53  FAX +34 954 98 11 79
Avda. Luis Montoto, 105.
E41007 - Sevilla(España)
[EMAIL PROTECTED]
http://www.emergya.info

---

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



[PHP] memory error

2005-02-17 Thread Bruno Santos
Hello. I've developed a script to use in shell to resize several images, 
but, when i try to run it, i keep receiving this error:

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to 
allocate 2048 bytes)

how can i solve it ?
PHP: 5.0.3
php.ini settings:
max_execution_time = 300
max_input_time = 60
memory_limit = 8M
by the way, is there any function that allows me to flush the memory ??
cheers
Bruno Santos
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Date() reporting wrong on OS X server intermittently

2005-02-17 Thread Brent Baisley
The 12 hours seems suspicious to me since it's the difference between 
AM and PM.

My other guess would be that it's grabbing Greenwich time, but it 
doesn't look like your offset from GMT is twelve hours.

On Feb 17, 2005, at 4:12 PM, Rowan Hick wrote:
Hi There,
I have an app which is installed across a dozen odd organisations, and 
one
this week which is running on an OS X Xserve machine.

Intermittently this week the PHP app has been seeing the wrong time.
Shifting 12hrs at a time. The IT administrator who runs the box says 
that
it's all okay, and it's synced correctly with a master server. 
Suspiciously
enough some workmen had been in on the weekeend prior and may have
cut/spiked the power to the box... (coincidence?)

Is it possible that PHP could see a different date to the OSX GUI ? I
wouldn't think it would be possible at all.
Has anyone out there seen weird problems like this before ?
Many Thanks,
Rowan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] memory error

2005-02-17 Thread Marek Kilimajer
Bruno Santos wrote:
Hello. I've developed a script to use in shell to resize several images, 
but, when i try to run it, i keep receiving this error:

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to 
allocate 2048 bytes)

how can i solve it ?
PHP: 5.0.3
php.ini settings:
max_execution_time = 300
max_input_time = 60
memory_limit = 8M
by the way, is there any function that allows me to flush the memory ??
Are you using imagedestroy() after you create each image? You can also 
use unset() for variables you don't need.

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


[PHP] PHP or ASP.Net

2005-02-17 Thread OOzy Pal
Guys/Gals

In a long debate with a friend, he tried to convince
my that ASP.Net is the language to go for. Me, I don't
like MS product. I really could not convince him that
PHP is better than ASP.Net. Can you guys/gals help me
to convince this guy that PHP is the language to go
for. 

Thank you

=
Regards,
OOzy

What is the purpose of life?



__ 
Do you Yahoo!? 
All your favorites on one personal page – Try My Yahoo!
http://my.yahoo.com 

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



[PHP] [HAB] PHP or ASP.Net

2005-02-17 Thread OOzy Pal
Guys/Gals

In a long debate with a friend, he tried to convince
my that ASP.Net is the language to go for. Me, I don't
like MS product. I really could not convince him that
PHP is better than ASP.Net. Can you guys/gals help me
to convince this guy that PHP is the language to go
for. 

Thank you

=
Regards,
OOzy

What is the purpose of life?



__ 
Do you Yahoo!? 
All your favorites on one personal page – Try My Yahoo!
http://my.yahoo.com 

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



Re: [PHP] [HAB] PHP or ASP.Net

2005-02-17 Thread Greg Donald
On Thu, 17 Feb 2005 13:15:08 -0800 (PST), OOzy Pal [EMAIL PROTECTED] wrote:
 In a long debate with a friend, he tried to convince
 my that ASP.Net is the language to go for. Me, I don't
 like MS product. I really could not convince him that
 PHP is better than ASP.Net. Can you guys/gals help me
 to convince this guy that PHP is the language to go
 for.

ASP vs. PHP discussions:
http://www.pointafter.com/Archives/nl0203.htm
http://www.oracle.com/technology/pub/articles/hull_asp.html
http://www.webxpertz.net/forums/showthread.php?t=19686
http://www.wrensoft.com/zoom/benchmarks.html

At the web dev shop I work at, we have two developers who code in both
PHP and ASP, and they both like ASP better.  *shrug*

I found this just the other day, discusses PHP vs. Perl:
http://tnx.nl/php


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

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



Re: [PHP] [HAB] PHP or ASP.Net

2005-02-17 Thread Stephen Johnson
I find it humorous that these types of debates keep coming back up -- no
matter what the topic, the IT world can not seem to agree on anything.

OS wars - Browser wars - coding languages.

It all gets very tiring.  Bottom line - go with what you like and with what
can get the job done.  Myself personally, I have never found something that
I could not do in PHP.  However, that being said, a lot of companies simply
do not want to leave off the Microsoft model. So if you want to work for
those companies you will need to know ASP.

In the end, it is all about marketability.  You want to be able to put
yourself in a position where are your needed by a company -- best way to do
that -- learn both.

Just my 2 cents.


?php
/*

Stephen Johnson c|eh
The Lone Coder

http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?

 From: Greg Donald [EMAIL PROTECTED]
 Reply-To: Greg Donald [EMAIL PROTECTED]
 Date: Thu, 17 Feb 2005 15:32:42 -0600
 To: php-general@lists.php.net
 Subject: Re: [PHP] [HAB] PHP or ASP.Net
 
 On Thu, 17 Feb 2005 13:15:08 -0800 (PST), OOzy Pal [EMAIL PROTECTED] wrote:
 In a long debate with a friend, he tried to convince
 my that ASP.Net is the language to go for. Me, I don't
 like MS product. I really could not convince him that
 PHP is better than ASP.Net. Can you guys/gals help me
 to convince this guy that PHP is the language to go
 for.
 
 ASP vs. PHP discussions:
 http://www.pointafter.com/Archives/nl0203.htm
 http://www.oracle.com/technology/pub/articles/hull_asp.html
 http://www.webxpertz.net/forums/showthread.php?t=19686
 http://www.wrensoft.com/zoom/benchmarks.html
 
 At the web dev shop I work at, we have two developers who code in both
 PHP and ASP, and they both like ASP better.  *shrug*
 
 I found this just the other day, discusses PHP vs. Perl:
 http://tnx.nl/php
 
 
 -- 
 Greg Donald
 Zend Certified Engineer
 http://destiney.com/
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



Re: [PHP] [HAB] PHP or ASP.Net

2005-02-17 Thread AdamT
On Thu, 17 Feb 2005 13:41:03 -0800, Stephen Johnson
[EMAIL PROTECTED] wrote:
 I find it humorous that these types of debates keep coming back up -- no
 matter what the topic, the IT world can not seem to agree on anything.
 
http://en.wikipedia.org/wiki/Internet_troll

It happens in comp.lang.php too.  And comp.os.linux.advocacy.  And
I've even seen people post soccer-related questions to chess forums.

-- 
AdamT
Justify my text?  I'm sorry, but it has no excuse.

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



[PHP] Weird Error Help

2005-02-17 Thread Joe Harman
Hey has anyone had an error like this one? and have a solution

---
Warning: Unexpected character in input: '' (ASCII=1) state=1 in
**/_eid_page_functions.php on line
173


it appears to be very random... could be my PHP code... but the only
thing that has happened since this error occured is that we moved the
site to a new server

Thanks,
Joe

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



Re: [PHP] Date() reporting wrong on OS X server intermittently

2005-02-17 Thread Rowan Hick
It could be flicking between GMT and local time, local time is 13 hrs
difference. 

There's nothing on the server that would be changing an environment variable
for the PHP app, so I'm pretty much ruling out interference from that. I
still keep coming back to the server clock must be wrong but the IT guy
assures me it isn't.

Has anyone seen an error in PHP when it's gotten the date wrong. I can't
imagine this ever happening. (FYI OSX Server 10.3 PHP 4.3.6 )

 

On 18/2/05 9:00 AM, Brent Baisley [EMAIL PROTECTED] wrote:

 The 12 hours seems suspicious to me since it's the difference between
 AM and PM.
 
 My other guess would be that it's grabbing Greenwich time, but it
 doesn't look like your offset from GMT is twelve hours.
 
 
 On Feb 17, 2005, at 4:12 PM, Rowan Hick wrote:
 
 Hi There,
 
 I have an app which is installed across a dozen odd organisations, and
 one
 this week which is running on an OS X Xserve machine.
 
 Intermittently this week the PHP app has been seeing the wrong time.
 Shifting 12hrs at a time. The IT administrator who runs the box says
 that

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



Re: [PHP] Weird Error Help

2005-02-17 Thread Greg Donald
On Thu, 17 Feb 2005 17:04:06 -0500, Joe Harman [EMAIL PROTECTED] wrote:
 Hey has anyone had an error like this one? and have a solution
 
 ---
 Warning: Unexpected character in input: '' (ASCII=1) state=1 in
 **/_eid_page_functions.php on line
 173
 
 
 it appears to be very random... could be my PHP code... but the only
 thing that has happened since this error occured is that we moved the
 site to a new server

I saw an error like that once when I had a space at the end of a
heredoc start tag.


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

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



Re: [PHP] PHP or ASP.Net

2005-02-17 Thread Chris Shiflett
--- OOzy Pal [EMAIL PROTECTED] wrote:
 In a long debate with a friend, he tried to convince
 my that ASP.Net is the language to go for. Me, I don't
 like MS product. I really could not convince him that
 PHP is better than ASP.Net. Can you guys/gals help me
 to convince this guy that PHP is the language to go
 for.

That's easy. ASP.Net requires that you run IIS.

Debate over.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming Soon http://httphandbook.org/

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



Re: [PHP] Hashing strings

2005-02-17 Thread Jason Barnett
Gerard Samuel wrote:
...
 Im trying to determine if md5() would be the fastest,
 *cheapest* solution.
...
 What Im looking for is something where the generated hashes can
 be reproduced.
 For example, md5('foo') today, will be equal to md5('foo') tomorrow.
 Thanks

AFAIK crc32() is the fastest hashing function in PHP.  I don't have
actual results on hand still, but I created a filesystem plugin that
auto-generates hashes for each file in a directory.  crc32() was faster
than md5() and sha1().

FYI the benchmarking that I did was for a Windows XP system... YMMV

-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: Date() reporting wrong on OS X server intermittently

2005-02-17 Thread Jason Barnett
Rowan Hick wrote:
...
 
 Has anyone out there seen weird problems like this before ?
 
 Many Thanks, 
 Rowan

The other suggestions are good.  If they don't pan out, check to see if
you use the function strtotime().  It has been buggy in a few versions
of PHP and may not be acting properly in your build...

http://www.php.net/manual/en/function.strtotime.php

-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] Weird Error Help

2005-02-17 Thread Richard Lynch
Joe Harman wrote:
 Hey has anyone had an error like this one? and have a solution

 ---
 Warning: Unexpected character in input: '' (ASCII=1) state=1 in
 **/_eid_page_functions.php on line
 173
 

 it appears to be very random... could be my PHP code... but the only
 thing that has happened since this error occured is that we moved the
 site to a new server

Perhaps the file got garbled in the move...

Check that there isn't an ASCII 1 character (control-A) in there in a hex
editor or something.

Also re-copy over some files using a different mechanism and do some diff
to be SURE the files are the same.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] memory error

2005-02-17 Thread Richard Lynch
Bruno Santos wrote:
 Hello. I've developed a script to use in shell to resize several images,
 but, when i try to run it, i keep receiving this error:

 Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
 allocate 2048 bytes)

 how can i solve it ?

If you actually NEED more than 8 Megs to handle your images, just use a
different php.ini with:
memory_limit = 16M
or whatever you think is suitable.

You can choose any php.ini file you want from the command line.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] HTML2pdf

2005-02-17 Thread Richard Lynch
[NB Got trigger-happy on the delete again.  Sorry.]

 convert HTML to PDF with CSS intact

There's a 'webthumb' application from the GD guys that would, in theory,
let you snatch the way a URL looks to your web-server's X + Mozilla setup,
and then you'd have that as a JPEG, which you could then cram into a
PDF...

Probably not the ideal solution, but it should work

You'd have to have 'webthumb', X, and a webthumb-compatible browser
installed on your server -- or wherever you intend to generate the PDFs...
 Or, at least, somewhere that you could generate JPEGs and then get them
to the machine where you generate PDFs.

I haven't even gotten around to installing webthumb, so now you know as
much as I do about it. :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Storing formulas

2005-02-17 Thread Mike Smith
I am developing an application that will require a set of formulas to
calculate measurements. We take information from measurers and based
on that with some formulas calculate how much material is needed. We
have a Product Series and each Series has 3-4 Product Lines. . The
formula to calculate the measurements varies from line to line, so I
need to have 16 standard formulas like:

TopMeasurment+1.6875+OutOfPlumbWall

The TopMeasurement and OutOfPlumbWall are decimal numbers entered in a
separate screen (from the measurers information)  and will be stored
in a table. The 1.6875 can vary from job to job. I need to give the
people doing the entry the flexibility to change the formula. This is
a simple example and only has one variable (though mostly it is
static). Other formulas have 10 and 12 variables in them. How have
others gone about storing formulas that require such modifications?

TIA,
Mike Smith

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



[PHP] Re: Problems with print html to pdf

2005-02-17 Thread Jason Barnett
Juan Antonio Garrido wrote:
 Hi everybody:
 
 Does it exists someone library I can print html files to pdf without it loss 
 information about my property css classes(background,color,width...)?
 
 With GPL library HTML_To_PDF3.3 it isn't possible... 
 
 If the library is GPL much better.
 
 Thank you for all...

A couple of ways you might go about doing this... You could probably get
the fpdf library to fill this need.

-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] MySQL and MySQLi compiling

2005-02-17 Thread Chris
Hi, I've been trying to get these 2 compiled together for a while, and 
have had no luck.

WHere my problem lies, I think, is that I'm not sure what directory 
should be specified on the --with-mysql part

./configure --with-apxs2=/usr/local/apache/bin/apxs 
--with-mysql=/usr/include/mysql/ --with-mysqli=/usr/bin/mysql_config

I have my own compiled Apache (It is Apache 2) , and MySQL 4.1.9 
installed (the packages off mysql.com). The PHP documentation jsut says 
point it to the install dir. I'm nto sure what counts as the install dir 
for the MySQL packages.

Any advice would be appreciated.
Below is a snippet of some of the error I'm getting I'm actually getting 
ALOT more, they all seem to be First defined here errors.

Thanks,
Chris
/usr/lib/mysql/libmysqlclient.a(vio.o)(.text+0x40): first defined here
/usr/lib/mysql/libmysqlclient.a(vio.o)(.text+0xc0): In function 
`vio_delete':
: multiple definition of `vio_delete'
/usr/lib/mysql/libmysqlclient.a(vio.o)(.text+0xc0): first defined here
/usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x0): In function 
`vio_errno':
: multiple definition of `vio_errno'
/usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x0): first defined here
/usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x20): In function 
`vio_read':
: multiple definition of `vio_read'
/usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x20): first defined here
/usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x60): In function 
`vio_write':
: multiple definition of `vio_write'
/usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x60): first defined here
/usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x80): In function 
`vio_blocking':
: multiple definition of `vio_blocking'
/usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x80): first defined here
/usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0xe0): In function 
`vio_is_blocking':
: multiple definition of `vio_is_blocking'
/usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0xe0): first defined here
/usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x100): In function 
`vio_fastsend':
: multiple definition of `vio_fastsend'
/usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x100): first defined 
here
/usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x160): In function 
`vio_keepalive':
: multiple definition of `vio_keepalive'
/usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x160): first defined 
here
/usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x1a0): In function 
`vio_should_retry':
: multiple definition of `vio_should_retry'
/usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x1a0): first defined 
here
/usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x1d0): In function 
`vio_close':
: multiple definition of `vio_close'
/usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x1d0): first defined 
here
/usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x230): In function 
`vio_description':
: multiple definition of `vio_description'
/usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x230): first defined 
here
/usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x240): In function 
`vio_type':
: multiple definition of `vio_type'
/usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x240): first defined 
here
/usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x250): In function 
`vio_fd':
: multiple definition of `vio_fd'
/usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x250): first defined 
here

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


Re: [PHP] Why is my class throwing this error?

2005-02-17 Thread NathanielGuy#21
Thanks to you all, the problem ended up being me leaving off a sigle
quote in a function declared before.  8_  I didnt expect that to be
the error because I was thinking it would flag it much sooner in my
script than it did.  Thanks for the help.

--nathan

On Thu, 17 Feb 2005 11:48:12 -0800 (PST), Richard Lynch [EMAIL PROTECTED] 
wrote:
 NathanielGuy#21 wrote:
  function displaygallery($user = FALSE, $lastprinted = 0, $move =
  'forward', $limit = 10) {//Line 52
 
  Error thrown
  --
  Parse error: parse error, unexpected T_STRING in
  /home/blacknut/public_html/picserv/includes/gallery.class on line 52
 
 You probably have a missing ' or  somewhere BEFORE line 52.
 
 And probably in the stuff you chopped out, since others ran the code you
 provided with no error.
 
 --
 Like Music?
 http://l-i-e.com/artists.htm
 
 


-- 
http://www.blacknute.com/

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



[PHP] Re: Storing formulas

2005-02-17 Thread Jason Barnett
Mike Smith wrote:
...
 
 TopMeasurment+1.6875+OutOfPlumbWall
 
...
 static). Other formulas have 10 and 12 variables in them. How have
 others gone about storing formulas that require such modifications?
 
 TIA,
 Mike Smith

If I was programming this I would probably create 16 functions for
whatever the formula is supposed to produce.  If you believe that a
constant will usually work you can have that as a default.

?php

define('TABLE_STANDARD_ERROR', 1.6875);

function table_get_length($top, $plumb, $se = null) {
  if (null === $se) {
$se = TABLE_STANDARD_ERROR;
  }
  return $top + $se + $plumb;
}

/** Now the fun begins... assume that $_POST is populated with data and
it has been scrubbed for improper input... */
$length = table_get_length($_POST['top'], $_POST['plumb'], $_POST['se']);

echo In order to make the table, you need $length inches of wood.\n

?

-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] MySQL and MySQLi compiling

2005-02-17 Thread dan
Chris wrote:
Hi, I've been trying to get these 2 compiled together for a while, and 
have had no luck.

WHere my problem lies, I think, is that I'm not sure what directory 
should be specified on the --with-mysql part

./configure --with-apxs2=/usr/local/apache/bin/apxs 
--with-mysql=/usr/include/mysql/ --with-mysqli=/usr/bin/mysql_config

I have my own compiled Apache (It is Apache 2) , and MySQL 4.1.9 
installed (the packages off mysql.com). The PHP documentation jsut says 
point it to the install dir. I'm nto sure what counts as the install dir 
for the MySQL packages.

Any advice would be appreciated.
Below is a snippet of some of the error I'm getting I'm actually getting 
ALOT more, they all seem to be First defined here errors.

Thanks,
Chris
/usr/lib/mysql/libmysqlclient.a(vio.o)(.text+0x40): first defined here
/usr/lib/mysql/libmysqlclient.a(vio.o)(.text+0xc0): In function 
`vio_delete':
: multiple definition of `vio_delete'
snip
I had in my mind that they could not be used together, and I began to 
wonder why again, as I had since forgotten.  When I try to use 
--with-mysql --with-mysqli, I get the following:
...
...
checking for MSSQL support via FreeTDS... no
checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
checking for MySQL UNIX socket location... /tmp/mysql.sock
checking for mysql_close in -lmysqlclient... (cached) yes
checking for MySQLi support... yes
checking whether to enable embedded MySQLi support... no
configure: error: --with-mysql (using bundled libs) can not be used 
together with --with-mysqli.

So I guess that might help you out.  The only other thing I can think of 
is if you have two different mysql-devel or mysql library packages 
installed.

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


[PHP] mysql query

2005-02-17 Thread Sebastian
Hello,
im working on an article system and looking to avoid running three queries.
example, i have this query:

SELECT id,title FROM articles WHERE id=$_GET[id]

now say $_GET[id] = 5

I would like to get the previous id 4 and the next id 6 (if there is one)
so i can do something like:

 Previous Article [Title]
Next Article [Ttitle] 

i would assume this is impossible without running mulitple queries? just
thought i'd ask in case i am wrong. i am using mysql 4x

thanks

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



RE: [PHP] MySQL and MySQLi compiling

2005-02-17 Thread Hans Zaunere

 Hi, I've been trying to get these 2 compiled together for a while, and
 have had no luck.
 
 WHere my problem lies, I think, is that I'm not sure what directory
 should be specified on the --with-mysql part
 
 ./configure --with-apxs2=/usr/local/apache/bin/apxs
 --with-mysql=/usr/include/mysql/ --with-mysqli=/usr/bin/mysql_config
 
 I have my own compiled Apache (It is Apache 2) , and MySQL 4.1.9
 installed (the packages off mysql.com). The PHP documentation jsut says
 point it to the install dir. I'm nto sure what counts as the install dir
 for the MySQL packages.
 
 Any advice would be appreciated.

Both MySQL and MySQL libs can be compiled into PHP.  Try

--with-mysql=/usr --with-mysqli=/usr/bin/mysql_config

H







 
 Below is a snippet of some of the error I'm getting I'm actually getting
 ALOT more, they all seem to be First defined here errors.
 
 Thanks,
 Chris
 
 /usr/lib/mysql/libmysqlclient.a(vio.o)(.text+0x40): first defined here
 /usr/lib/mysql/libmysqlclient.a(vio.o)(.text+0xc0): In function
 `vio_delete':
 : multiple definition of `vio_delete'
 /usr/lib/mysql/libmysqlclient.a(vio.o)(.text+0xc0): first defined here
 /usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x0): In function
 `vio_errno':
 : multiple definition of `vio_errno'
 /usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x0): first defined here
 /usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x20): In function
 `vio_read':
 : multiple definition of `vio_read'
 /usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x20): first defined here
 /usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x60): In function
 `vio_write':
 : multiple definition of `vio_write'
 /usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x60): first defined here
 /usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x80): In function
 `vio_blocking':
 : multiple definition of `vio_blocking'
 /usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x80): first defined here
 /usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0xe0): In function
 `vio_is_blocking':
 : multiple definition of `vio_is_blocking'
 /usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0xe0): first defined here
 /usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x100): In function
 `vio_fastsend':
 : multiple definition of `vio_fastsend'
 /usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x100): first defined
 here
 /usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x160): In function
 `vio_keepalive':
 : multiple definition of `vio_keepalive'
 /usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x160): first defined
 here
 /usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x1a0): In function
 `vio_should_retry':
 : multiple definition of `vio_should_retry'
 /usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x1a0): first defined
 here
 /usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x1d0): In function
 `vio_close':
 : multiple definition of `vio_close'
 /usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x1d0): first defined
 here
 /usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x230): In function
 `vio_description':
 : multiple definition of `vio_description'
 /usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x230): first defined
 here
 /usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x240): In function
 `vio_type':
 : multiple definition of `vio_type'
 /usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x240): first defined
 here
 /usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x250): In function
 `vio_fd':
 : multiple definition of `vio_fd'
 /usr/lib/mysql/libmysqlclient.a(viosocket.o)(.text+0x250): first defined
 here
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



Re: [PHP] mysql query

2005-02-17 Thread dan
Sebastian wrote:
Hello,
im working on an article system and looking to avoid running three queries.
example, i have this query:
SELECT id,title FROM articles WHERE id=$_GET[id]
now say $_GET[id] = 5
I would like to get the previous id 4 and the next id 6 (if there is one)
so i can do something like:
 Previous Article [Title]
Next Article [Ttitle] 
i would assume this is impossible without running mulitple queries? just
thought i'd ask in case i am wrong. i am using mysql 4x
thanks
Is it possible to make a function that would increase/decrease a 
counter which would contain the page number that they were on?  I am 
not sure about doing all this, since I am a bit new, but I believe 
that's what I'd investigate.

$pagenumber = thepagenumberthatweareon
int getNextPage(int currentPage, int scale), where scale 'up' or 'down'
function getNextPage($currentPage, $scale) {
global $pagenumber;
if ($scale = 'up') {
return $currentpage + 1;
} else {
return $currentpage - 1;
}

}
That could be a totally bogus function, but I thought it'd be fun to 
throw that out.  It at least gives you something to go on, I guess.

As long as we're looking at this, anyone want to suggest to me if I had 
done anything wrong with that function, and how I can improve on it?

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


Re: [PHP] mysql query

2005-02-17 Thread Stephen Johnson
Now I am assuming that 4 and 6 would not always be the next article ID -
otherwise you could just increment your id accordingly.

If you wanted to do that without running multiple queries, this is who I
might do it, rather sloppy, but I think it would work.

$idGet= $_GET['id'];
$sql = select id, title from articles;
$db-query($sql);
$i=0; 
while($db-getRow()) {
  $id[$i] =  $db-row['id'];
  $title[$i] = $db-row['title'];
  $i++; 
  if($id[$i] == $idGet) {
  $j = $I;
   } 
} 

$prev = $j-1; 
$next = $j+1;

previous $title[$prev ]
next $title[$next] 



?php
/*

Stephen Johnson c|eh
The Lone Coder

http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?

 From: Sebastian [EMAIL PROTECTED]
 Date: Thu, 17 Feb 2005 19:24:50 -0500
 To: php-general@lists.php.net
 Subject: [PHP] mysql query
 
 Hello,
 im working on an article system and looking to avoid running three queries.
 example, i have this query:
 
 SELECT id,title FROM articles WHERE id=$_GET[id]
 
 now say $_GET[id] = 5
 
 I would like to get the previous id 4 and the next id 6 (if there is one)
 so i can do something like:
 
  Previous Article [Title]
 Next Article [Ttitle] 
 
 i would assume this is impossible without running mulitple queries? just
 thought i'd ask in case i am wrong. i am using mysql 4x
 
 thanks

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



[PHP] Problem: mysqli class not found

2005-02-17 Thread Dave Adler
I have an install of PHP 5 on Windows 2003 Server with Apache 2 and when I 
reference mysqli in my php code, I get an error that the mysqli class is not 
found.

I looked at the php.ini file and I added a line for php_mysqli in the 
extensions section and I edited the extension_dir directive to point to 
c:\php\ext folder (I used /php/ext as the value assigned to the directive.

I made sure that the c:\php\ext folder actually had a file called 
php_mysqli.dll, which it did.

No I can't start my Apache server.

I had done a default install of both Apache 2 and PHP 5.

Any ideas as to how I can get the mysqli class identified and allow my 
Apache server to start.

Thanks,

David 

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



Re: [PHP] mysql query

2005-02-17 Thread Bret Hughes
On Thu, 2005-02-17 at 18:24, Sebastian wrote:
 Hello,
 im working on an article system and looking to avoid running three queries.
 example, i have this query:
 
 SELECT id,title FROM articles WHERE id=$_GET[id]
 
 now say $_GET[id] = 5
 
 I would like to get the previous id 4 and the next id 6 (if there is one)
 so i can do something like:
 

sure how about :

select id, title 
from articles 
where id = $_GET[id] - 1 
and id = $_GET[id] + 1
order by num;

should be valid sql but I have no experience with mysql

Bret

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



Re: [PHP] Hashing strings

2005-02-17 Thread Gerard Samuel
Jason Barnett wrote:
Gerard Samuel wrote:
...
 

Im trying to determine if md5() would be the fastest,
*cheapest* solution.
   

...
 

What Im looking for is something where the generated hashes can
be reproduced.
For example, md5('foo') today, will be equal to md5('foo') tomorrow.
Thanks
   

AFAIK crc32() is the fastest hashing function in PHP.  I don't have
actual results on hand still, but I created a filesystem plugin that
auto-generates hashes for each file in a directory.  crc32() was faster
than md5() and sha1().
FYI the benchmarking that I did was for a Windows XP system... YMMV
I normally profile with apd, but it only measures in the hundredth of
a second.
So I used getrusage()  memory_get_usage() functions to *unscientifically*
profile md5()/sha1()/crc32() on FreeBSD 5.3.
I ran a for loop 75 times, hashing the constant __FILE__
These are an average of 5 runs -

md5:   
Usertime   - 784.2 µsec
Systemtime -  72.2 µsec
Memory - 120.0 bytes

sha1:
Usertime   - 846.8 µsec
Systemtime - 150.2 µsec
Memory -  80.0 bytes
  
crc32:
Usertime   - 194.8 µsec
Systemtime -  54.2 µsec
Memory -  80.0 bytes

Can you shed some light on that code,
that you're using for the filesystem plugin?
Thanks
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP security

2005-02-17 Thread .....hG
While back I read in an article that placing UN and PASSwords in a PHP was 
not secure. couple of open source programs that I have seen they have for 
example

$database = ;
$username = ;
$password = ;

It makes me wonder how secure in reallity it is to place your UN and 
Passwords on a PHP file.

Thanks for your input

-- 
...hG

http://www.helmutgranda.com

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



Re: [PHP] mysql query

2005-02-17 Thread Jason Petersen
On 17 Feb 2005 19:28:18 -0600, Bret Hughes [EMAIL PROTECTED] wrote:
 On Thu, 2005-02-17 at 18:24, Sebastian wrote:
  Hello,
  im working on an article system and looking to avoid running three queries.
  example, i have this query:
 
  SELECT id,title FROM articles WHERE id=$_GET[id]
 
  now say $_GET[id] = 5
 
  I would like to get the previous id 4 and the next id 6 (if there is one)
  so i can do something like:

I would do something like:

$theId = $_GET['id'];
$ids = $theId-1 . , . $theId  , . $theId+1;
$query = SELECT id, title FROM articles WHERE id IN ($ids);

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



Re: [PHP] PHP security

2005-02-17 Thread Robby Russell
On Thu, 2005-02-17 at 20:47 -0600, .hG wrote:
 While back I read in an article that placing UN and PASSwords in a PHP was 
 not secure. couple of open source programs that I have seen they have for 
 example
 
 $database = ;
 $username = ;
 $password = ;
 
 It makes me wonder how secure in reallity it is to place your UN and 
 Passwords on a PHP file.
 
 Thanks for your input
 

Well, what do you suggest we do? We could ask the code you write to
guess the username and password?

From the web, if you do it right, there is no way to really find out
what the user/pass is. Don't keep it in your webroot if you can help it
is a good way to avoid any issues. The only people who should have
access to the file are you and your webserver process. 

if you put a file in your directory called, db.inc.php and it looks like
so:

?php

// robbys secret password
$super_secret_password = noonewillguessthisone; 

?

.. if php is properly configured, this will never be displayed
at /db.inc.php ... will just show a blank page


-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting  Development
* --- Now hosting Ruby on Rails Apps ---
/

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



Re: [PHP] PHP security

2005-02-17 Thread Chris Shiflett
--- .hG [EMAIL PROTECTED] wrote:
 While back I read in an article that placing UN and PASSwords in a PHP
 was not secure.

Well, that's very subjective. In a shared hosting environment, it
certainly does pose a risk. If you place it within document root (don't do
that), it poses a significant risk.

My favorite method of handling this is described at the end of this
article:

http://shiflett.org/articles/security-corner-mar2004

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming Soon http://httphandbook.org/

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



Re: [PHP] mysql query

2005-02-17 Thread Bret Hughes
On Thu, 2005-02-17 at 22:02, Jason Petersen wrote:
 On 17 Feb 2005 19:28:18 -0600, Bret Hughes [EMAIL PROTECTED] wrote:
  On Thu, 2005-02-17 at 18:24, Sebastian wrote:
   Hello,
   im working on an article system and looking to avoid running three 
   queries.
   example, i have this query:
  
   SELECT id,title FROM articles WHERE id=$_GET[id]
  
   now say $_GET[id] = 5
  
   I would like to get the previous id 4 and the next id 6 (if there is one)
   so i can do something like:
 
 I would do something like:
 
 $theId = $_GET['id'];
 $ids = $theId-1 . , . $theId  , . $theId+1;
 $query = SELECT id, title FROM articles WHERE id IN ($ids);
 

That is a good approach I wonder if there is any difference in
performance?  ...

To answer my own question before I even post it:

A quick test or two shows that on a postgres table with about 45K rows
both ways used an index scan.  on a table with about 35 rows the  
always used a index scan but the in() used a seq scan.  I am sure mysql
would use the index both ways as well but I do not know.  Seems like the
smaller the number of elements used the better off you are with the in()
deal since each element in the index had to be compared to each of the
numbers where as with the   approach only two comparisions have to be
made regardless of the range.

This is not to say my approach was better I am just thinking out loud.

Bret

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



[PHP] Help with SQL statement

2005-02-17 Thread Jacques
How can I determine which users have signed in and are still on-line during 
the first minute after they have signed in? My sql statement currently 
reads:

SELECT * FROM tblusers WHERE usignedin = yes AND utimesignedin = (time() - 
60)

Hoe does one indicate seconds in a SQL statement? Can I use the time() 
function or should I use the now() function rather?

Thanks
Jacques 

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



[PHP] [php] -help me

2005-02-17 Thread K Karthik
i have got string as /home/karthik/welcome.php/view.php
i just need view.php how shall i remove rest of the string.
please do help me.i am new to php.
-thanks,
karthik
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] help me

2005-02-17 Thread K Karthik
i am so surprised for the immediate reply.thank you so much.
i'll be thank ful again if you could help me finding the current date 
and time using php.
thanks,
karthik

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


[PHP] create forum

2005-02-17 Thread Stefan
Hi.
Are there some code-examples how to build a forum
with php and xml?

Tnx
Stefan 

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



[PHP] How do I add PHP code into a DB field

2005-02-17 Thread Tim Burgan
Hello,
On my page, all my content is updated via a textarea online.
If I include PHP code embeded with my HTML in the textarea, the database 
converts it to plain text, instead of code that can be used. It doesn't 
convert  to lt; though, it's still in the database as , just when 
it's read out again.. it don't work!

I want to be able to call a random image script in PHP from the content 
that's stored in the DB.

How do I do this?
Thanks
Tim
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How do I add PHP code into a DB field

2005-02-17 Thread Bret Hughes
On Fri, 2005-02-18 at 00:45, Tim Burgan wrote:
 Hello,
 
 
 On my page, all my content is updated via a textarea online.
 
 If I include PHP code embeded with my HTML in the textarea, the database 
 converts it to plain text, instead of code that can be used. It doesn't 
 convert  to lt; though, it's still in the database as , just when 
 it's read out again.. it don't work!
 
 I want to be able to call a random image script in PHP from the content 
 that's stored in the DB.
 
 How do I do this?
 

How are you calling the page that retrieves the code?  Does the file
name end in php?  I suspect that simply echoing code to the browser
won't work because it's a string.  Are you using eval?

Bret 

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



Re: [PHP] MySQL and MySQLi compiling

2005-02-17 Thread Chris
dan wrote:
Chris wrote:
Hi, I've been trying to get these 2 compiled together for a while, 
and have had no luck.

WHere my problem lies, I think, is that I'm not sure what directory 
should be specified on the --with-mysql part

./configure --with-apxs2=/usr/local/apache/bin/apxs 
--with-mysql=/usr/include/mysql/ --with-mysqli=/usr/bin/mysql_config

I have my own compiled Apache (It is Apache 2) , and MySQL 4.1.9 
installed (the packages off mysql.com). The PHP documentation jsut 
says point it to the install dir. I'm nto sure what counts as the 
install dir for the MySQL packages.

Any advice would be appreciated.
Below is a snippet of some of the error I'm getting I'm actually 
getting ALOT more, they all seem to be First defined here errors.

Thanks,
Chris
/usr/lib/mysql/libmysqlclient.a(vio.o)(.text+0x40): first defined here
/usr/lib/mysql/libmysqlclient.a(vio.o)(.text+0xc0): In function 
`vio_delete':
: multiple definition of `vio_delete'
snip
I had in my mind that they could not be used together, and I began to 
wonder why again, as I had since forgotten.  When I try to use 
--with-mysql --with-mysqli, I get the following:
...
...
checking for MSSQL support via FreeTDS... no
checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
checking for MySQL UNIX socket location... /tmp/mysql.sock
checking for mysql_close in -lmysqlclient... (cached) yes
checking for MySQLi support... yes
checking whether to enable embedded MySQLi support... no
configure: error: --with-mysql (using bundled libs) can not be used 
together with --with-mysqli.

So I guess that might help you out.  The only other thing I can think 
of is if you have two different mysql-devel or mysql library packages 
installed.

Hope that helps
-dant
Thanks, but the documentation (PHP) does say that both can be compiled 
in at the same time, they just need to be compiled against the same version.

I actually got this to work on a different install, one in which the 
MySQL wasn't the package, and jsut had a single isntallation directory. 
On that one I used  --with-mysql=/usr/local/mysql 
--with-mysqli=/usr/local/mysql/bin/mysql_config

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


  1   2   >