php-general Digest 4 Mar 2005 11:29:18 -0000 Issue 3318

2005-03-04 Thread php-general-digest-help

php-general Digest 4 Mar 2005 11:29:18 - Issue 3318

Topics (messages 209948 through 209968):

What is the 'cli' interface.
209948 by: Daniel Guerrier
209952 by: Jay Blanchard
209953 by: Jochem Maas

Re: [noob] can't submit simple form, need help
209949 by: Jay Blanchard
209950 by: Warren Vail
209951 by: Jochem Maas

Re: Authentication fails - problem line found
209954 by: John Swartzentruber

Re: Document root, preferred way to find it???
209955 by: Tom Rogers
209958 by: Leif Gregory

Re: Preventing data from being reposted?
209956 by: pmpa
209957 by: pmpa

which class it is?
209959 by: yangshiqi
209963 by: Jochem Maas
209966 by: yangshiqi
209967 by: yangshiqi
209968 by: anirudh dutt

email attach and contain message together
209960 by: agung.prematours.com
209964 by: Jochem Maas

upload and resize image script
209961 by: p80

Re: mysql problems
209962 by: Jed R. Brubaker

Re: Read From COM1 port
209965 by: Kim Madsen

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---
I am getting this error using ezpublish to import RSS
feeds.  Does anyone know what this means.

PHP is currently using the 'apache2handler' interface.
Make sure it is using the 'cli' interface.

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
---End Message---
---BeginMessage---
[snip]
Make sure it is using the 'cli' interface.
[/snip]

Command Line Interface
---End Message---
---BeginMessage---
Daniel Guerrier wrote:
I am getting this error using ezpublish to import RSS
feeds.  Does anyone know what this means.
if you want to ask a new question then dont reply to an existing
post. post a new message.
PHP is currently using the 'apache2handler' interface.
Make sure it is using the 'cli' interface.
Command Line Interpreter. it a special 'kind' of php that built
specifically to be used on the cmdline (e.g. DOS on windows,
bash on linux, etc)
__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---End Message---
---BeginMessage---
[snip]
any idea why this simple peace of code is not working?

// code that will be executed if the form has been submitted: 
$submit_post=$_REQUEST['submit']; 
 
if ($submit_post=='yes') 
[/snip]

Probably because $_REQUEST['submit'] !== 'yes'

print_r($_REQUEST); to see the array
---End Message---
---BeginMessage---
 $submit_post=$_REQUEST['submit']; 
  
 if ($submit_post=='yes') { 
 
looks like the value in your form is not 'yes' but 'submit'


 pinput type=submit name=submit value=submit /  /p 

if this is not it, perhaps we should see more.

Warren Vail
---End Message---
---BeginMessage---
p80 wrote:
any idea why this simple peace of code is not working?
now lets see:
   1.  ?php
   2.  // code that will be executed if the form has been submitted:
   3.  $submit_post=$_REQUEST['submit'];
   4.
   5.  if ($submit_post=='yes') {
$submit_post  will never equal 'yes' because your submit buttons value is
'submit' and its name is also 'submit', the POST value is are overwriting
the GET value (thats default order for php anyway)
removing the name attribute of the submit button should do the trick.
   6.
   7.  // connect to the database
   8.  // (you may have to adjust the hostname,username or password)
   9.
  10.  include db.php;
  11.
  12.
  13.  $result=MYSQL_QUERY(INSERT INTO machines
  14.  (description_fr) .
  15.  VALUES ('$form_description_en'));
you might want to sanitize $form_description_en before sticking it in your
query like that. see http://php.net/mysql_escape_string
  16.  $bob = $img-image_name;
who is bob... why are you trying to get the property of
a non-existent object? php will have a fatal one on this.
  17.
  18.  #$thumbdata = addslashes(fread(fopen('.thumb/$bob', r)));
  19.
  20.
  21.
  22.
  23.  $id= mysql_insert_id();
  24.
  25.  print query success!;
  26.  echo $form_description_en;
the quotes around the var above are a waste of cpu.
the following will do:
echo $form_description_en;
  27.  MYSQL_CLOSE();
  28.
  29.  }
  30.
  31.
  32.  ?
  33.
  34.  form method=post action=test.php?submit=yes 
enctype=multipart/form-data /
  35.Description:br  /
  36.  textarea name=form_description_en  id=form_description_en rows=4 
cols=40/textareabr  /
  37.
  38.  pinput type=submit name=submit value=submit /  /p
  39.
  40.  /form
http://hashphp.org/pastebin?pid=1880
thanx in advance
---End Message---
---BeginMessage---

Re: [PHP] which class it is?

2005-03-04 Thread Jochem Maas
yangshiqi wrote:
I have a question that how to get the class name, which is initialized by
other class or function.
...
 

How can I get class b's name in a?
you have the get_class() function,
you have the __CLASS__ constant
can you give an example of a situation where you are having
trouble of retrieving the className of a subclassed object (or class)?
 

 

Best regards,
Yang Shiqi
 

 

 

 


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


Re: [PHP] email attach and contain message together

2005-03-04 Thread Jochem Maas
[EMAIL PROTECTED] wrote:
Hi all
I have the problem which I would like to send email with contain and
attachment ( excel file) together not just a part.
What should I do with the term please help
phpmailer.sourceforge.net
either save yourself the trouble of doing it yourself,
or use their code to figure out how to get it to work
phpmailer is a really neat class, and a piece of cake to use.
...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


SV: [PHP] Read From COM1 port

2005-03-04 Thread Kim Madsen

From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: 3. march 2005 20:56

 $fp = fopen(COM1, rwb);
 You might try this:
 $input = fopen(COM1, rb);
 $output = fopen(COM1, wb);
 Use $output to write, and $input to read.

On a windows one would have to close the connection every time then since that 
OS only allow _one_ connection to the serial ports.

 Another possibility would be to check the manual...

I´ve been it around, as I wrote in the first mail, but something must have been 
misspelled by me, cause I took the example from fgetc:

$fp = fopen(COM1, w+b);
while (false !== ($char = fgetc($fp))) {
  echo .$char;
}

And nothing happened, so I figured that the switch might me locked somehow, I 
turned it off and on again and suddenly all the start up info from the switch 
was shown on my screen. I now use the example as a wrapper:

// open connection
$fp = fopen(COM1, w+b);

// listen for output from $fp
while (false !== ($char = fgetc($fp))) {
  // save chars in buffer, if NOT returns or newlines
  if($char != \r  $char != \n) {
$buffer .= $char;

  // We need to know if things went wrong
  if(trim($buffer) == Error)
$response[] = Error;

  // execute commands
  if(trim($buffer) == SecOff ) {
$command = $Sec[$SecOff]\r\n;
fwrite($fp, $command);
print writing: $command\n;
$SecOff++;
$buffer = ;
  } 
}

I´m working on it as we speak, this is just a part of the script. It´s so nice 
to have a break through finally :-)

 I don't thing 'rwb' is the correct way to fopen for read/write access.

 'wb+' would be a better answer, I think.

I know, that´s how I´ve done it. During tryfail tests I´ve tried like 
everything. My mistake to not check the code properly before mailing it here...

Have a nice weekend out there :o)

-- 
Sincerly
Kim Madsen
Systemdeveloper / ComX - http://www.comx.dk

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



RE: [PHP] which class it is?

2005-03-04 Thread yangshiqi
class DebugHelper
{
var $_str;
function do($string)
(
//here I want to know which class called this function do to
trace the bug.
$this-_str .= $string;
)
function show()
{
return $this-_str;
}
}

class B
{
 function B()
 {
  $debug = new DebugHelper;
  $debug-do('here');
...
 }
}

 
Best regards,
Yang Shiqi
 
 
 

-Original Message-
From: Jochem Maas [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 04, 2005 4:43 PM
To: yangshiqi
Cc: php-general@lists.php.net
Subject: Re: [PHP] which class it is?

yangshiqi wrote:
 I have a question that how to get the class name, which is initialized by
 other class or function.
 

...

  
 
 How can I get class b's name in a?
 

you have the get_class() function,
you have the __CLASS__ constant

can you give an example of a situation where you are having
trouble of retrieving the className of a subclassed object (or class)?

  
 
  
 
 Best regards,
 
 Yang Shiqi
 
  
 
  
 
  
 
  
 
 

-- 
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] which class it is?

2005-03-04 Thread yangshiqi
And I do not want all my classes to inherit the debughelper.

 
Best regards,
Yang Shiqi
 
 
 

-Original Message-
From: yangshiqi [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 04, 2005 5:41 PM
To: 'Jochem Maas'
Cc: 'php-general@lists.php.net'
Subject: RE: [PHP] which class it is?

class DebugHelper
{
var $_str;
function do($string)
(
//here I want to know which class called this function do to
trace the bug.
$this-_str .= $string;
)
function show()
{
return $this-_str;
}
}

class B
{
 function B()
 {
  $debug = new DebugHelper;
  $debug-do('here');
...
 }
}

 
Best regards,
Yang Shiqi
 
 
 

-Original Message-
From: Jochem Maas [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 04, 2005 4:43 PM
To: yangshiqi
Cc: php-general@lists.php.net
Subject: Re: [PHP] which class it is?

yangshiqi wrote:
 I have a question that how to get the class name, which is initialized by
 other class or function.
 

...

  
 
 How can I get class b's name in a?
 

you have the get_class() function,
you have the __CLASS__ constant

can you give an example of a situation where you are having
trouble of retrieving the className of a subclassed object (or class)?

  
 
  
 
 Best regards,
 
 Yang Shiqi
 
  
 
  
 
  
 
  
 
 

-- 
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] which class it is?

2005-03-04 Thread anirudh dutt
On Fri, 4 Mar 2005 17:41:01 +0800, yangshiqi [EMAIL PROTECTED] wrote:
 class DebugHelper
 {
 var $_str;
 function do($string)
 (
 //here I want to know which class called this function do to
 trace the bug.
 $this-_str .= $string;
 )
 function show()
 {
 return $this-_str;
 }
 }
 
 class B
 {
  function B()
  {
   $debug = new DebugHelper;
   $debug-do('here');
 ...
  }
 }

create a debug function (public) and use get_class. call that in the
debug function. when u want to do the debugging, use it with the obj
as parameter, maybe $this will work when u're in the class, otherwise,
use the object aka class instance variable.

u may wanna pass by reference and make it const (won't have to use
more memory for it...since it's task with it is small and read-only)

from http://php.net/get_class
[quote]
Example 1. Using get_class()
?php

class foo {
   function foo()
   {
   // implements some logic
   }

   function name()
   {
   echo My name is  , get_class($this) , \n;
   }
}

// create an object
$bar = new foo();

// external call
echo Its name is  , get_class($bar) , \n;

// internal call
$bar-name();

?

The above example will output:

Its name is foo
My name is foo
[/quote]

-- 
]#
Anirudh Dutt


...pilot of the storm who leaves no trace
like thoughts inside a dream

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



Re: [PHP] which class it is?

2005-03-04 Thread Jochem Maas
anirudh dutt wrote:
On Fri, 4 Mar 2005 17:41:01 +0800, yangshiqi [EMAIL PROTECTED] wrote:
class DebugHelper
{
   var $_str;
   function do($string)
   (
   //here I want to know which class called this function do to
trace the bug.
   $this-_str .= $string;
   )
   function show()
   {
   return $this-_str;
   }
}
class B
{
function B()
{
 $debug = new DebugHelper;
 $debug-do('here');
   ...
}
}

create a debug function (public) and use get_class. call that in the
if you are using the 'public' keyword then you have to use php5,.
debug function. when u want to do the debugging, use it with the obj
as parameter, maybe $this will work when u're in the class, otherwise,
use the object aka class instance variable.
u may wanna pass by reference and make it const (won't have to use
if you're using php5 all objects are references, pass-by-reference occurs
whether you like it or not (unless you specifically use 'clone')
...also a constant (global or class scope) cannot be set to an object.
I'm still very curious as to how Yangshiqi intends to use his DebugHelper class!
(apologies if I have written your name incorrectly.)

more memory for it...since it's task with it is small and read-only)
from http://php.net/get_class
[quote]
Example 1. Using get_class()
?php
class foo {
   function foo()
   {
   // implements some logic
   }
   function name()
   {
   echo My name is  , get_class($this) , \n;
   }
}
// create an object
$bar = new foo();
// external call
echo Its name is  , get_class($bar) , \n;
// internal call
$bar-name();
?
The above example will output:
Its name is foo
My name is foo
[/quote]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] which class it is?

2005-03-04 Thread Marek Kilimajer
Use debug_backtrace()
yangshiqi wrote:
class DebugHelper
{
var $_str;
function do($string)
(
//here I want to know which class called this function do to
trace the bug.
$this-_str .= $string;
)
function show()
{
return $this-_str;
}
}
class B
{
 function B()
 {
  $debug = new DebugHelper;
  $debug-do('here');
...
 }
}
 
Best regards,
Yang Shiqi
 
 
 

-Original Message-
From: Jochem Maas [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 04, 2005 4:43 PM
To: yangshiqi
Cc: php-general@lists.php.net
Subject: Re: [PHP] which class it is?

yangshiqi wrote:
I have a question that how to get the class name, which is initialized by
other class or function.

...


How can I get class b's name in a?

you have the get_class() function,
you have the __CLASS__ constant
can you give an example of a situation where you are having
trouble of retrieving the className of a subclassed object (or class)?



Best regards,
Yang Shiqi






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


Re: [PHP] which class it is?

2005-03-04 Thread anirudh dutt
On Fri, 04 Mar 2005 12:37:55 +0100, Jochem Maas [EMAIL PROTECTED] wrote:
 anirudh dutt wrote:
  create a debug function (public) and use get_class. call that in the
 
 if you are using the 'public' keyword then you have to use php5,.

i meant a function like this:
in a globally included file on a server far, far away
function debugme ($obj, $mode = 'echo')
{
   $obj_class = 'Class: '. get_class($obj);
   $obj_class.= 'non static properties: '. count($obj);
   if ($mode == 'echo') {
  echo $obj_class;
   } else {
  return $obj_class;
   }
}

won't debugme be available to all functions/methods?

  u may wanna pass by reference and make it const (won't have to use
 
 if you're using php5 all objects are references, pass-by-reference occurs
 whether you like it or not (unless you specifically use 'clone')
 
 ...also a constant (global or class scope) cannot be set to an object.

oh well :(

btw, can't that be done in c++?

forgot about the pass by reference default-ness in php5

-- 
]#
Anirudh Dutt


...pilot of the storm who leaves no trace
like thoughts inside a dream

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



Re: [PHP] which class it is?

2005-03-04 Thread anirudh dutt
On Fri, 04 Mar 2005 13:04:18 +0100, Marek Kilimajer [EMAIL PROTECTED] wrote:
 Use debug_backtrace()

then he can't use a common function to do the debugging, or will have
to do something like:
debugme(debug_backtrace());

and the debug info will be restricted to what debug_backtrace provides.

-- 
]#
Anirudh Dutt


...pilot of the storm who leaves no trace
like thoughts inside a dream

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



[suspicious - maybe spam] [PHP] [suspicious - maybe spam] [PHP] how to get checkbox form data as array?

2005-03-04 Thread tx
i create the html form as below

input type=checkbox name=aaa value=1
input type=checkbox name=aaa value=2
input type=checkbox name=aaa value=3
input type=checkbox name=aaa value=4

and i receive the form data in php file as below:

global $aaa;
print_r($aaa);

this action only echo 4 not the total array in array format,why?


Re: [PHP] which class it is?

2005-03-04 Thread Jochem Maas
anirudh dutt wrote:
On Fri, 04 Mar 2005 12:37:55 +0100, Jochem Maas [EMAIL PROTECTED] wrote:
anirudh dutt wrote:
create a debug function (public) and use get_class. call that in the
if you are using the 'public' keyword then you have to use php5,.

i meant a function like this:
in a globally included file on a server far, far away
function debugme ($obj, $mode = 'echo')
{
   $obj_class = 'Class: '. get_class($obj);
   $obj_class.= 'non static properties: '. count($obj);
   if ($mode == 'echo') {
  echo $obj_class;
   } else {
  return $obj_class;
   }
}
won't debugme be available to all functions/methods?
any function (outside of a class definition of course) you define is 
available
everywhere yes.
have you tried:
var_dump( $obj );
print_r( $obj );
print_r( $obj, true );
var_export( $obj );
var_export( $obj, true );
also have a look at exceptions again: e.g.
DebugMe extends Exception()
{
private $obj;
/* ctor */
function __construct($obj, $msg = '', $code = 0 /* er? */)
{
$this-obj = $obj;   
parent::__construct($msg, $code);   
}

/* output/return human readable information about the contained object. 
*/
public function printObj($returnVal = false)
{   
$v = print_r( $obj, true );
if ((boolean)$returnVal) { return $v; }
echo $v;
}

/* overload getMessage() in base class ??? */
public function getMessage() {

return (($om = parent::getMessage())?{$om}\n--\n:'')
   . $this-printObj( true );
}
}
then in you code you can do stuff like:
try {
// do some stuff
// 

try {

// ...
if ($somethingIsScrewed === true) {
throw new DebugMe( $myScrewedUpObject );
}
} catch (MyDBException) {
// catch a database related exception
}

// do some stuff
// 

// ...
}
catch (MyAppException $e) {
// this is a very specific exception you wish to take care of here
}
catch (DebugMe $e) {
// this may output something or add a message to a queue/log etc.
handleDebugMeException( $e );
// maybe after outputting the information you want to throw
// a new exception
}
catch (Exception $e) {
// general exception catcher, you may just want to
// re-throw the exception into the parent try/catch block.
throw $e;
}
'Exception' is a php internal class, the rest I have made up,
the above is totally untested - its just to give you some ideas.
Using a exception does not determine what you do with the object or even how
you deal with it but it does give you a lot of control over where and when you
deal with (in your code).
I like Exceptions, you may very well come to hate them with a passion yet
to be seen in this solarsystem - there's no accounting for taste :-).

u may wanna pass by reference and make it const (won't have to use
if you're using php5 all objects are references, pass-by-reference occurs
whether you like it or not (unless you specifically use 'clone')
...also a constant (global or class scope) cannot be set to an object.

oh well :(
btw, can't that be done in c++?
probably - that doesn't make a good thing by definition tho. besides php
is definitely not c++, on top of which php itself is written in c, which isn't
c++ either ;-)
forgot about the pass by reference default-ness in php5
it just is, there is no alternative, other than to run in
zend1 compatibility mode (can't remember the ini setting name) which gives you
the php4 object behaviour but that totally defeats the purpose, and I don't
really consider it 'proper' php5 (its nice when your moving a complex app from 
4 to 5)
and its just so much nicer :-)

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


[PHP] Re: [suspicious - maybe spam] [PHP] [suspicious - maybe spam] [PHP] how to get checkbox form data as array?

2005-03-04 Thread Frank Arensmeier
Try:
input type=checkbox name='aaa[]' value=1

/frank
2005-03-04 kl. 04.06 skrev tx:
i create the html form as below
input type=checkbox name=aaa value=1
input type=checkbox name=aaa value=2
input type=checkbox name=aaa value=3
input type=checkbox name=aaa value=4
and i receive the form data in php file as below:
global $aaa;
print_r($aaa);
this action only echo 4 not the total array in array format,why?



[PHP] User rights assignment

2005-03-04 Thread William Stokes
Hello

I'am creating a web site for a soccer club with about 30 teams. The idea is 
that there are about 20-30 persons who will update the data on the site via 
web forms admin interface.

I have really hard time to figure out how to do the users right assingment. 
So far I have user authentication against user name and password in database 
and a session id created which is sent as a cookie to browser.

I want to create system that allows a person have rights to update one or 
several teams in the club. Maybe someone will have access to all teams. I 
have one table with users info and another with the teams info. I was 
thinking of a system where, after login, the user is told that he has access 
to this and this team and then presented with select form to select the team 
he wants to update. Well I can't make the select menu because I have no idea 
how store and compare the rights info to team info.

If anyone have any ideas I would be very thankfull. It can be also different 
kinda system but the main idea is to keep the number of php files low 
(udpating/administering easy) and load data to each update page according 
the users rights and selection if he has rights to more than one team. I 
have already spent way too much time with this so help is highly 
appreciated.

Thanks a Lot
-William 

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



[PHP] Re: User rights assignment

2005-03-04 Thread Jason Barnett
William Stokes wrote:
 Hello
 
 I'am creating a web site for a soccer club with about 30 teams. The idea is 
 that there are about 20-30 persons who will update the data on the site via 
 web forms admin interface.
 
 I have really hard time to figure out how to do the users right assingment. 
 So far I have user authentication against user name and password in database 
 and a session id created which is sent as a cookie to browser.
 
 I want to create system that allows a person have rights to update one or 
 several teams in the club. Maybe someone will have access to all teams. I 
 have one table with users info and another with the teams info. I was 

Rather than telling us maybe... why don't you do yourself and all of
us a favor and figure out exactly what kinds of rights system you want.
 We can then help you create a system that is as simple / complex as you
need.

A flexible way of handling this issue: you have a user table that will
store information about each user.  You also have a team table that
stores information about each team.  Then you have a rights table that
will associate a particular user with a particular team and indicate
whether that user has admin rights for that team or not.  Of course I'm
no DB expert...

If you have more database questions, please ask those on the php.db
list.  If you have PHP coding questions though (I am having trouble
building my checkboxes, here is what I tried, etc.) feel free to ask
those questions on this list.


-- 
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://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] which class it is?

2005-03-04 Thread Jason Barnett
Yangshiqi wrote:
 And I do not want all my classes to inherit the debughelper.
 
  
 Best regards,
 Yang Shiqi
  

Yikes!  I swear, some of these mailreader programs that people use... I
thought this was an actual answer to someone's question... anywho...

Have you checked out debug_backtrace() and set_error_handler()
http://php.net/manual/en/function.debug-backtrace.php
http://php.net/manual/en/function.set-error-handler.php

Exceptions in PHP5
http://php.net/exceptions

-- 
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://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] line feed

2005-03-04 Thread Bruno Santos
Hello.
How do i print a line return using the echo command, for when i see the 
page source,
i get the code line by line and not all in the same line.

using double quotes (  ), i can put \n at the end and i get the result 
i want,
but, using sinle quotes ( ' ), \n doesnt work.

if i use double quotes, in a simple html comand i need to use \  and i 
dont want that.

is any way i could use single quotes, and getting the line feed ??
example:
Double quotes:
   echo table border=\1\ width=\800px\\n;
single quotes:
   echo 'table border=1 width=800px';
cheers
Bruno Santos
--
Say no to software patents
www.nosoftwarepatents.com/
--
[EMAIL PROTECTED]
--
Divisao de Informatica
[EMAIL PROTECTED]
Tel: +351 272 000 155
Fax: +351 272 000 257
--
Hospital Amato Lusitano
[EMAIL PROTECTED]
Tel: +351 272 000 272
Fax: +351 272 000 257
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Data Encryption

2005-03-04 Thread trlists
On 2 Mar 2005 Erbacher Karl wrote:

 I'm not sure if this is even a PHP question, but I'm hoping someone can help 
 me. I need to encipher data to be stored in a database and then I need to be 
 able to decipher it to use it.  I was thinking of using DES and I obtained a 
 pair of keys, but I'm not sure where to go from there. I've scoured the 
 internet for help, but I just can't figure out which is the best way to do 
 what I need to do.  

You could look at http://www.php.net/manual/en/ref.mcrypt.php.  mcrypt 
supports a long list of ciphers, including triple DES.  I usually 
Blowfish for the purpose you describe, though I can't remember exactly 
why right this second -- I did some research at one point and concluded 
it was the best for my purposes.

--
Tom

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



Re: [PHP] line feed

2005-03-04 Thread Jason Petersen
On Fri, 04 Mar 2005 14:38:20 +, Bruno Santos
[EMAIL PROTECTED] wrote:
 Hello.
 
 How do i print a line return using the echo command, for when i see the
 page source,
 i get the code line by line and not all in the same line.
 
 using double quotes (  ), i can put \n at the end and i get the result
 i want,
 but, using sinle quotes ( ' ), \n doesnt work.

Maybe you could use the HEREDOC format?

echo END
table border=0 width=100%
  trtdsome table stuff/td/tr
/table

END;

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



Re: [PHP] which class it is?

2005-03-04 Thread anirudh dutt
On Fri, 04 Mar 2005 14:23:29 +0100, Jochem Maas [EMAIL PROTECTED] wrote:
 anirudh dutt wrote:
  On Fri, 04 Mar 2005 12:37:55 +0100, Jochem Maas [EMAIL PROTECTED] wrote:
 
 anirudh dutt wrote:
 
 
 won't debugme be available to all functions/methods?
 
 any function (outside of a class definition of course) you define is available
 everywhere yes.

i know, was clarifying that 'public' needn't be used as u had assumed.

On Fri, 04 Mar 2005 12:37:55 +0100, Jochem Maas [EMAIL PROTECTED] wrote:
 anirudh dutt wrote:
 
 
  create a debug function (public) and use get_class. call that in the
 
 if you are using the 'public' keyword then you have to use php5,.
 
(wasn't using 'public')...just meant a publicly available function ;-)

 have you tried:
 
 var_dump( $obj );
 print_r( $obj );
 print_r( $obj, true );
 var_export( $obj );
 var_export( $obj, true );

i figured the aim was to use a customized debug function and not just
'one' of these. i agree that they can be used. so they'd be stuffed in
there as soon as we figure out how best to define/call it.

[answer]
get_class() to find the object's class in the debug function (which is
passed the object as an argument)
[/answer]

yangshiqi hasn't responded after
http://marc.theaimsgroup.com/?l=php-generalm=110992943630914w=2 so
don't know what he's read/followed/agreed/used...

the archive seems to have mixed up the order of two of our mails even
though the timing is fine and the 'references' and 'message-id' are
what they should be.
http://marc.theaimsgroup.com/?t=11099103961r=1w=2


 also have a look at exceptions again: e.g.
 
 DebugMe extends Exception()

internal class, eh?
http://in.php.net/manual/en/language.exceptions.php
interesting. i think i'll use it.

 
  btw, can't that be done in c++?
 
 probably - that doesn't make a good thing by definition tho. besides php
 is definitely not c++, on top of which php itself is written in c, which isn't
 c++ either ;-)

absolutely ;-)

 
  forgot about the pass by reference default-ness in php5
 
 it just is, there is no alternative, other than to run in
 zend1 compatibility mode (can't remember the ini setting name) which gives you
 the php4 object behaviour but that totally defeats the purpose, and I don't
 really consider it 'proper' php5 (its nice when your moving a complex app 
 from 4 to 5)
 
 and its just so much nicer :-)

yes, _setting_ php5 to php4's object behaviour would be heresy.

the setting is
zend.ze1_compatibility_mode = Off (off is good)

-- 
]#
Anirudh Dutt


...pilot of the storm who leaves no trace
like thoughts inside a dream

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



Re: [PHP] line feed

2005-03-04 Thread tg-php
echo 'table border=1 width=800px' . chr(10);

chr(10) should be line feed and chr(13) is a carriage return (aka \r).  
Unless I got those mixed up.  But yes, you can do that.

Or you could even cheat and do:

echo 'table border=1 width=800px' . \n;

-TG

= = = Original message = = =

Double quotes:
echo table border=\1\ width=\800px\\n;

single quotes:
echo 'table border=1 width=800px';


cheers

Bruno Santos


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



[PHP] Consulta

2005-03-04 Thread J. L. Marcelo Chaparro Bustos
Hola, bueno acabo de incribirme el la lista y queria saber si alguno de ustedes 
tiene un manual PHP basico que me pueda enviar o decir donde poder bajarlo, 
para orientarme un poco. 
gracias

Marcelo


Re: [PHP] Consulta

2005-03-04 Thread Jochem Maas
J. L. Marcelo Chaparro Bustos wrote:
Hola, bueno acabo de incribirme el la lista y queria saber si alguno de ustedes tiene un manual PHP basico que me pueda enviar o decir donde poder bajarlo, para orientarme un poco. 
gracias
Hola, this is an english speaking list
as I don't undertstand the question I will give you a choice of answers, pick 
one that fits best :-)
a. yes
b. no
c. it depends
d. it depends on how much money is involved
Marcelo
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] which class it is?

2005-03-04 Thread Jochem Maas
Jason Barnett wrote:
Yangshiqi wrote:
And I do not want all my classes to inherit the debughelper.
Best regards,
Yang Shiqi

Yikes!  I swear, some of these mailreader programs that people use... I
thought this was an actual answer to someone's question... anywho...
Have you checked out debug_backtrace() and set_error_handler()
http://php.net/manual/en/function.debug-backtrace.php
http://php.net/manual/en/function.set-error-handler.php

I have given up on this thread - the logic is all of a sudden lost on me!
I think we gave Yang some good stuff to chew on - last I read he was going to
dig into exceptions! :-)
hey Yang, if you get stuck with Exceptions somewhere please post to a new 
thread :-)
Exceptions in PHP5
http://php.net/exceptions
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Consulta

2005-03-04 Thread Josué F. Machado
http://www.php.net/docs.php
At 09:58 AM 3/4/2005, J. L. Marcelo Chaparro Bustos wrote:
Hola, bueno acabo de incribirme el la lista y queria saber si alguno de 
ustedes tiene un manual PHP basico que me pueda enviar o decir donde poder 
bajarlo, para orientarme un poco.
gracias

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


Re: [PHP] upload and resize image script

2005-03-04 Thread Robby Russell
On Fri, 2005-03-04 at 03:04 +0100, p80 wrote:
 hey all
 I'm looking for a simple script that would upload an image and resize it to 
 thumbnail using a form to upload the picture. anyone has a good script for 
 that?
 

There is a function in this post for resizing:

http://blog.planetargon.com/archives/44-Image-Watermarks-in-PHP.html


-- 
/***
* 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] Include wierdness.

2005-03-04 Thread Rob Adams
From the manual on 'include':

Files for including are first looked in include_path relative to the 
current working directory and then in include_path relative to the directory 
of current script. E.g. if your include_path is ., current working directory 
is /www/, you included include/a.php and there is include b.php in that 
file, b.php is first looked in /www/ and then in /www/include/.

I have a file in my root dir (we'll call it /www) that includes the file 
/www/lib/test.php as follows:
include('lib/test.php');

test.php looks like this:
?
  echo 'Inside first included file.';
  if (file_exists('lib/test2.php'))
echo 'This file exists.';
  include('lib/test2.php');
  echo 'Ending first included file.';
?

/www/lib/test2.php exists.  Whenever I run this, I get the first two echo 
statements, without getting the third one.  The error log reports that it 
couldn't find lib/test2.php.  If I take out the 'lib/' in the include 
statement, it works.  According to the description from the manual, either 
way should work.  Has anyone ever come across this problem before, and is 
there a config setting that causes it?  I'm stumped here, and I refuse to go 
change all the code when from what I've read it should already be working.

  -- Rob 

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



[PHP] Re: Include wierdness.

2005-03-04 Thread Rob Adams
One correction.  The include('lib/test2.php') is actually a 
require_once('lib/test2.php').  That's why it quits and I don't get the 
third include.

  -- Rob


Rob Adams [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 From the manual on 'include':

 Files for including are first looked in include_path relative to the 
 current working directory and then in include_path relative to the 
 directory of current script. E.g. if your include_path is ., current 
 working directory is /www/, you included include/a.php and there is 
 include b.php in that file, b.php is first looked in /www/ and then in 
 /www/include/.

 I have a file in my root dir (we'll call it /www) that includes the file 
 /www/lib/test.php as follows:
 include('lib/test.php');

 test.php looks like this:
 ?
  echo 'Inside first included file.';
  if (file_exists('lib/test2.php'))
echo 'This file exists.';
  include('lib/test2.php');
  echo 'Ending first included file.';
 ?

 /www/lib/test2.php exists.  Whenever I run this, I get the first two echo 
 statements, without getting the third one.  The error log reports that it 
 couldn't find lib/test2.php.  If I take out the 'lib/' in the include 
 statement, it works.  According to the description from the manual, either 
 way should work.  Has anyone ever come across this problem before, and is 
 there a config setting that causes it?  I'm stumped here, and I refuse to 
 go change all the code when from what I've read it should already be 
 working.

  -- Rob 

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



[PHP] Mass email with php on a windows server

2005-03-04 Thread Reinhart Viane








I use a while loop and the mail function to send email to
all subscribers of a site. This works fine for 50 users but I know there can be
some problems when you do it like this for 1000 users.

Eg. Limit of page execution is exceeded and even server
crashes because each time a mail is send a socket is opened and closed again.



Now I have found some functions (fsock_open of an SMTP
service) and some pear classes 



Unfortunately I have a windows server hosting that site.

Anyone knows how to do mass email on a windows server?



Thx in advance

Reinhart








No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.5.7 - Release Date: 1/03/2005

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

[PHP] mass emailing on windows server

2005-03-04 Thread Reinhart Viane








I use a while loop and the mail function to send email to
all subscribers of a site. This works fine for 50 users but I know there can be
some problems when you do it like this for 1000 users.

Eg. Limit of page execution is exceeded and even server
crashes because each time a mail is send a socket is opened and closed again.



Now I have found some functions (fsock_open of an SMTP
service) and some pear classes 



Unfortunately I have a windows server hosting that site.

Anyone knows how to do mass email on a windows server?



Thx in advance

Reinhart








No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.5.7 - Release Date: 1/03/2005

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

Re: [PHP] Re: Include wierdness.

2005-03-04 Thread Jochem Maas
Rob Adams wrote:
One correction.  The include('lib/test2.php') is actually a 
require_once('lib/test2.php').  That's why it quits and I don't get the 
third include.
you 100% sure your include_path is '.' ? just asking.
also you mention a /www/lib and a /www/include dir - maybe thats
the problem?
maybe you can make the problem go away by setting include_path to
'.:/www/include' or '.:/www/lib'
I must say I think its overkill to use file_exists() on files
you are going to require_once() - although no doubt there is a good
reason to do it sometimes :-)
it is odd though, file_exists() returns true yet the file cannot
be included.
--
any chocolate chips in this cookie jar care to enlighten the crumbs?

  -- Rob
Rob Adams [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

From the manual on 'include':
Files for including are first looked in include_path relative to the 
current working directory and then in include_path relative to the 
directory of current script. E.g. if your include_path is ., current 
working directory is /www/, you included include/a.php and there is 
include b.php in that file, b.php is first looked in /www/ and then in 
/www/include/.

I have a file in my root dir (we'll call it /www) that includes the file 
/www/lib/test.php as follows:
include('lib/test.php');

test.php looks like this:
?
echo 'Inside first included file.';
if (file_exists('lib/test2.php'))
  echo 'This file exists.';
include('lib/test2.php');
echo 'Ending first included file.';
?
/www/lib/test2.php exists.  Whenever I run this, I get the first two echo 
statements, without getting the third one.  The error log reports that it 
couldn't find lib/test2.php.  If I take out the 'lib/' in the include 
statement, it works.  According to the description from the manual, either 
way should work.  Has anyone ever come across this problem before, and is 
there a config setting that causes it?  I'm stumped here, and I refuse to 
go change all the code when from what I've read it should already be 
working.

-- Rob 

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


Re: [PHP] Re: Include wierdness.

2005-03-04 Thread Rob Adams
The scenario I gave is very simplified.  I'm actually trying to get tikiwiki 
working on a server, and the reason it won't run the install is because of 
this problem I've mentioned.  It works as expected on my development server 
(WinXP), but on my production (FreeBSD) it fails.

I don't have a /www/include dir.  The reference to that is just from the 
manual that I quoted.

  -- Rob


Jochem Maas [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Rob Adams wrote:
 One correction.  The include('lib/test2.php') is actually a 
 require_once('lib/test2.php').  That's why it quits and I don't get the 
 third include.

 you 100% sure your include_path is '.' ? just asking.
 also you mention a /www/lib and a /www/include dir - maybe thats
 the problem?

 maybe you can make the problem go away by setting include_path to
 '.:/www/include' or '.:/www/lib'

 I must say I think its overkill to use file_exists() on files
 you are going to require_once() - although no doubt there is a good
 reason to do it sometimes :-)

 it is odd though, file_exists() returns true yet the file cannot
 be included.

 --
 any chocolate chips in this cookie jar care to enlighten the crumbs?



   -- Rob


 Rob Adams [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]

From the manual on 'include':

Files for including are first looked in include_path relative to the 
current working directory and then in include_path relative to the 
directory of current script. E.g. if your include_path is ., current 
working directory is /www/, you included include/a.php and there is 
include b.php in that file, b.php is first looked in /www/ and then in 
/www/include/.

I have a file in my root dir (we'll call it /www) that includes the file 
/www/lib/test.php as follows:
include('lib/test.php');

test.php looks like this:
?
 echo 'Inside first included file.';
 if (file_exists('lib/test2.php'))
   echo 'This file exists.';
 include('lib/test2.php');
 echo 'Ending first included file.';
?

/www/lib/test2.php exists.  Whenever I run this, I get the first two echo 
statements, without getting the third one.  The error log reports that it 
couldn't find lib/test2.php.  If I take out the 'lib/' in the include 
statement, it works.  According to the description from the manual, 
either way should work.  Has anyone ever come across this problem before, 
and is there a config setting that causes it?  I'm stumped here, and I 
refuse to go change all the code when from what I've read it should 
already be working.

 -- Rob
 

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



Re: [PHP] Re: Include wierdness.

2005-03-04 Thread Jason Barnett
Jochem Maas wrote:
 Rob Adams wrote:
...
 
 you 100% sure your include_path is '.' ? just asking.
 also you mention a /www/lib and a /www/include dir - maybe thats
 the problem?
 
 maybe you can make the problem go away by setting include_path to
 '.:/www/include' or '.:/www/lib'

This still sounds like the best place to start... check your
include_path and see if it includes '.' and/or whatever is the root
directory for your tikiwiki installation.

?php var_dump(ini_get('include_path')); ?

 
 I must say I think its overkill to use file_exists() on files
 you are going to require_once() - although no doubt there is a good
 reason to do it sometimes :-)

Well... I seem to recall there is an optional argument for require_once
that searches the include path.  You can try using that parameter if you
don't know the current working directory (why?).

?php require_once('some/relative/include.php', true); ?

 
 it is odd though, file_exists() returns true yet the file cannot
 be included.
 

My guess is the file *is* in the include path, but the current working
directory when require_once() executes is not what the OP thinks it is...


-- 
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://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: mass emailing on windows server

2005-03-04 Thread Jason Barnett
Please do not send attachments to the list... feel free to post source
code on the web though, and we will take a look at what you have.

Actually, I'm afraid that I personally can't help you with this problem,
but we try to keep code at pastebin websites and/or simplified code in
your actual email message.

-- 
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://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] Consulta

2005-03-04 Thread trlists
On 4 Mar 2005 J. L. Marcelo Chaparro Bustos wrote:

 Hola, bueno acabo de incribirme el la lista y queria saber si alguno
 de ustedes tiene un manual PHP basico que me pueda enviar o decir
 donde poder bajarlo, para orientarme un poco. gracias

Translation:  Hi, I just joined this list and I wanted to know if
anyone had a basic PHP manual that you can send me, or if you can tell
me where to download it, so I can get oriented.  Thanks.

Answer:

Los documentos basicos son disponibles en español en
http://www.php.net/manual/es/, y puede bajarlos en la forma .html.gz
de un sitio en Chile en
http://us4.php.net/get/php_manual_es.html.gz/from/cl.php.net/mirror.

The basic documents are available in Spanish at
http://www.php.net/manual/es/, and you can download them in .html.gz
format from a site in Chile at
http://us4.php.net/get/php_manual_es.html.gz/from/cl.php.net/mirror.

--
Tom

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



Re: [PHP] Consulta

2005-03-04 Thread John Nichel
J. L. Marcelo Chaparro Bustos wrote:
Hola, bueno acabo de incribirme el la lista y queria saber si alguno de ustedes tiene un manual PHP basico que me pueda enviar o decir donde poder bajarlo, para orientarme un poco. 
gracias

Marcelo
http://us4.php.net/download-docs.php
Also, this list is pretty much an English speaking list, so to get more 
answers to your questions, you should use English here, or try a 
non-English list (I think there's a Spanish one)...

http://us4.php.net/mailing-lists.php
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Include wierdness.

2005-03-04 Thread Rob Adams

Jason Barnett [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
My guess is the file *is* in the include path, but the current working
directory when require_once() executes is not what the OP thinks it is...

I was hoping this was the case, but just checked it with:
echo `pwd`;
and it gave what I thought should be the correct directory.  (The directory 
where the initial php file is.)

I also checked my include path, and it does have a '.' at the end of it.

I'm using a host called iPowerWeb.  Overall I've liked them a lot, but there 
have been a few glitches like this that drive me nuts.  One is a tendancy 
for the server to rewrite configuration files to turn open_basedir on.  I've 
checked that though, and that hasn't happened in this case (yet.)

  -- Rob

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



RE: [PHP] Document root, preferred way to find it???

2005-03-04 Thread Chris W. Parker
Leif Gregory mailto:[EMAIL PROTECTED]
on Thursday, March 03, 2005 5:31 PM said:

 Hello Richard,
 
 Thursday, March 3, 2005, 1:15:38 PM, you wrote:
 include_path
 
 In the php.ini? But wouldn't that affect every virtual host on the
 server? Meaning I'd have to put all the includes for every virtual
 host in the same place?

.htaccess




Chris.

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



RE: [PHP] Re: mass emailing on windows server

2005-03-04 Thread Reinhart Viane
Strange, I did not send any attachement with the message.
Maybe by anti virus software automatically attached something

-Oorspronkelijk bericht-
Van: Jason Barnett [mailto:[EMAIL PROTECTED] 
Verzonden: vrijdag 4 maart 2005 17:37
Aan: php-general@lists.php.net
Onderwerp: [PHP] Re: mass emailing on windows server

Please do not send attachments to the list... feel free to post source
code on the web though, and we will take a look at what you have.

Actually, I'm afraid that I personally can't help you with this problem,
but we try to keep code at pastebin websites and/or simplified code in
your actual email message.

-- 
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://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+plug
ins



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.5.7 - Release Date: 1/03/2005

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



Re: [PHP] Document root, preferred way to find it???

2005-03-04 Thread Leif Gregory
Hello Chris,

Friday, March 4, 2005, 9:58:05 AM, you wrote:
C .htaccess

Right.. But if you're on a hosted server running Sambar which is
configured to ignore .htaccess, then what? (I'm not being facetious,
this is actually an issue I've run across for a client).

My point I guess, is that there should be a simple way in PHP to
reliably pull the DOC_ROOT for a virtual host that doesn't require
fixing x number of pages if you move the site to another server or
to another folder. PHP is great in terms of portability, but this
seems to be a major sticking point in making it less portable.

A webserver always knows where it is (i.e. external CSS declarations).


-- 
Leif (TB lists moderator and fellow end user).

Using The Bat! 3.0.2.3 Rush under Windows XP 5.1
Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB

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



Re: [PHP] Re: Include wierdness.

2005-03-04 Thread Jochem Maas
Jason Barnett wrote:
Jochem Maas wrote:
Rob Adams wrote:
...
you 100% sure your include_path is '.' ? just asking.
also you mention a /www/lib and a /www/include dir - maybe thats
the problem?
maybe you can make the problem go away by setting include_path to
'.:/www/include' or '.:/www/lib'

This still sounds like the best place to start... check your
include_path and see if it includes '.' and/or whatever is the root
directory for your tikiwiki installation.
?php var_dump(ini_get('include_path')); ?
I must say I think its overkill to use file_exists() on files
you are going to require_once() - although no doubt there is a good
reason to do it sometimes :-)

Well... I seem to recall there is an optional argument for require_once
that searches the include path.  You can try using that parameter if you
don't know the current working directory (why?).
manual doesn't confirm that - besides most of my code wouldn't work if
require_once didn't use the include path...
actually some of my code really doesn't work :-) but when a require fails
its often obvious because there is NO output and NO error logged - but thats
just me. anyway I'm sure require_once uses the include_path.
?php require_once('some/relative/include.php', true); ?
it is odd though, file_exists() returns true yet the file cannot
be included.

My guess is the file *is* in the include path, but the current working
directory when require_once() executes is not what the OP thinks it is...

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


Re: [PHP] Re: mass emailing on windows server

2005-03-04 Thread Jochem Maas
Reinhart Viane wrote:
Strange, I did not send any attachement with the message.
Maybe by anti virus software automatically attached something
yeah it was just cruft.
-Oorspronkelijk bericht-
Van: Jason Barnett [mailto:[EMAIL PROTECTED] 
Verzonden: vrijdag 4 maart 2005 17:37
Aan: php-general@lists.php.net
Onderwerp: [PHP] Re: mass emailing on windows server

Please do not send attachments to the list... feel free to post source
code on the web though, and we will take a look at what you have.
Actually, I'm afraid that I personally can't help you with this problem,
but we try to keep code at pastebin websites and/or simplified code in
your actual email message.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Include wierdness.

2005-03-04 Thread Rob Adams
Jochem Maas [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Jason Barnett wrote:
 Jochem Maas wrote:

Rob Adams wrote:

 ...

you 100% sure your include_path is '.' ? just asking.
also you mention a /www/lib and a /www/include dir - maybe thats
the problem?

maybe you can make the problem go away by setting include_path to
'.:/www/include' or '.:/www/lib'


 This still sounds like the best place to start... check your
 include_path and see if it includes '.' and/or whatever is the root
 directory for your tikiwiki installation.

 ?php var_dump(ini_get('include_path')); ?

I must say I think its overkill to use file_exists() on files
you are going to require_once() - although no doubt there is a good
reason to do it sometimes :-)


 Well... I seem to recall there is an optional argument for require_once
 that searches the include path.  You can try using that parameter if you
 don't know the current working directory (why?).

 manual doesn't confirm that - besides most of my code wouldn't work if
 require_once didn't use the include path...
 actually some of my code really doesn't work :-) but when a require fails

:)  I know the feeling...

 its often obvious because there is NO output and NO error logged - but 
 thats
 just me. anyway I'm sure require_once uses the include_path.

I figured out what the problem was.  Learn something new every ... month or 
so.
In unix, the include_path is separated by a colon (:), not a semi-colon (;). 
My
include_path was set to '.;/path/to/smarty/'.  I changed it to 
'.:/path/to/smarty/' and
the error went away.  Guess I should've read the manual on the configuration 
file
as well. :)

Thanks for the help.

  -- Rob

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



[PHP] Re: mysql problems

2005-03-04 Thread Jon Drukman
Jed R. Brubaker wrote:
I have a PHP script that populates a database table. No big deal. It creates 
mailing labels. However, a weird things keeps happening - every once in a 
while, a query is run twice. It is the same query, same information, even 
the same time (there is a now() in the query - and it is identical).
create a unique index on the table so that it CAN'T possibly create 
duplicate rows.  this will cause the problematic part of your php script 
to start choking with errors about duplicate keys (assuming you're 
checking the return status of your mysql_query()'s which you should 
always be doing!!).  this should help you isolate the problem.

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


Re: [PHP] On Topic - Theoretical Concents of Anti-password trading/sharing solutions

2005-03-04 Thread AdamT
Just saw this on /. and thought it might be of interest in this thread:

http://www.zdnet.com.au/news/security/0,261744,39183346,00.htm
http://www.caida.org/outreach/papers/2005/fingerprinting/

We introduce the area of remote physical device fingerprinting, or
fingerprinting a physical device, as opposed to an operating system or
class of devices, remotely, and without the fingerprinted device's
known cooperation. We accomplish this goal by exploiting small,
microscopic deviations in device hardware: clock skews. Our techniques
do not require any modification to the fingerprinted devices. Our
techniques report consistent measurements when the measurer is
thousands of miles, multiple hops, and tens of milliseconds away from
the fingerprinted device, and when the fingerprinted device is
connected to the Internet from different locations and via different
access technologies

It's overkill, of course, but you can never have too much overkill


-- 
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] establishing a TLS connection to a LDAP server

2005-03-04 Thread Aurélien MAGNIEZ
Hi,

I've read a great article about connecting securely to
LDAP using PHP
(http://www.novell.com/coolsolutions/trench/5838.html).
It works nice :-)

I would like now to authenticate the both sides when
establishing the TLS tunnel. In other words, my
OpenLDAP requires a client certificate.

After searching many hours and trying different
solutions (ldap.conf, environment variables...), I
still have the same problem : the client certificate
isn't sent by my apache server :-((

Do you have any idea in order to solve it ?

Thanks in advance,

Best Regards,

Aurelien

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



RE: [PHP] Document root, preferred way to find it???

2005-03-04 Thread Richard Lynch




Chris W. Parker wrote:
 Leif Gregory mailto:[EMAIL PROTECTED]
 on Thursday, March 03, 2005 5:31 PM said:

 Hello Richard,

 Thursday, March 3, 2005, 1:15:38 PM, you wrote:
 include_path

 In the php.ini? But wouldn't that affect every virtual host on the
 server? Meaning I'd have to put all the includes for every virtual
 host in the same place?

 .htaccess

http://php.net/set_include_path

-- 
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] mass emailing on windows server

2005-03-04 Thread Richard Lynch
Reinhart Viane wrote:
 I use a while loop and the mail function to send email to all subscribers
 of
 a site. This works fine for 50 users but I know there can be some problems
 when you do it like this for 1000 users.

 Eg. Limit of page execution is exceeded and even server crashes because
 each
 time a mail is send a socket is opened and closed again.



 Now I have found some functions (fsock_open of an SMTP service)  and some
 pear classes



 Unfortunately I have a windows server hosting that site.

 Anyone knows how to do mass email on a windows server?

I believe you can install, errr, MS Exchange???, to get an SMTP server.

You could also find a webhost somewhere that provides SMTP service, for a
fee.

You may want to consider sending ONE email with Bcc: but the spam filters
may count that against you in their filtering, and some recipients won't
get it unless the whitelist you first.  [sigh]

There are also some nice mail-sending classes at http://phpclasses.org
which I believe have documentation specifically about this topic.

-- 
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] line feed

2005-03-04 Thread Richard Lynch
Bruno Santos wrote:
 How do i print a line return using the echo command, for when i see the
 page source,
 i get the code line by line and not all in the same line.

 using double quotes (  ), i can put \n at the end and i get the result
 i want,
 but, using sinle quotes ( ' ), \n doesnt work.

 if i use double quotes, in a simple html comand i need to use \  and i
 dont want that.

 is any way i could use single quotes, and getting the line feed ??
 example:
 Double quotes:
 echo table border=\1\ width=\800px\\n;

 single quotes:
 echo 'table border=1 width=800px';

It's horrible code, but:

echo 'table border=1 width=800px
';

is also syntactically correct and it will work...

I *THINK* '...{chr(10)}' might also work in PHP4 and beyond...

But {} might be only inside  [shrug]

If I want \n I just use  myself...

-- 
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] Database engine in PHP

2005-03-04 Thread Gerben
Hi,

I have already asked this question, but I think I wasn't clear enough of my
intentions (thanks for all your responses anyway)

I was wondering if there is any DBMS, like MySQL, which is (fully) 
implemented
in php. That is a database engine written in PHP.
I know this is not the most effecient way, but I'm not planning to use it
for heavy weight database-driven-application.

I just want a way to store simple data and I thought that SQL would be a
nice interface. Since it could be easelly ported to mysql (for which I have 
to pay my host).
Full SQL support is'n needed either. Just some basis queries.

Maybe it very ineffecient, but I think basic SQL will be fast enough (with 
not to many records (say 50)).
Who knows maybe I am crazy :-P

greetings 

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



Re: [PHP] Re: mysql problems

2005-03-04 Thread Richard Lynch
Jed R. Brubaker wrote:
 Thank you both for your responces.

 Unfotuantely there is no form that instantiates this action. So the double
 submit (while a good idea), is not possible.

 As for some sample code, it is part of a rather complicated system that
 makes a number of changes but essentailly what is going on is this:

 1. Grab all items that we need to do some shipping stuff to.
 2. Foreach through the items, giving each item number to a function to
 assign it to a customer and create a mailling label.

 That simple!

 The interesting this is this - the duplicate record is inserted into the
 mailing labels queue. I can see it long before I grab the data for output
 to
 labels. Moreover, I can tell that the problem isn't in the original item
 select statement because the function (executed for each item) would have
 created different insert times in the database based on the now( ).

Show us code excerpts.

We can't second-guess from your description, as good as it is.

Pin-point the code that is doing the double insert, and print out some
debugging info there.

-- 
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] Database engine in PHP

2005-03-04 Thread tg-php
Did anyone recommend SQLite yet?  It comes with PHP5 but I believe you can get 
an extension for PHP4 to do it as well.  It's basically a super light-weight 
SQL based database system.  Loads all the tables into memory if I remember 
right, but great for exactly what you're talking about (if I understand SQLite 
and your requiremrents properly).

-TG

= = = Original message = = =

Hi,

I have already asked this question, but I think I wasn't clear enough of my
intentions (thanks for all your responses anyway)

I was wondering if there is any DBMS, like MySQL, which is (fully) 
implemented
in php. That is a database engine written in PHP.
I know this is not the most effecient way, but I'm not planning to use it
for heavy weight database-driven-application.

I just want a way to store simple data and I thought that SQL would be a
nice interface. Since it could be easelly ported to mysql (for which I have 
to pay my host).
Full SQL support is'n needed either. Just some basis queries.

Maybe it very ineffecient, but I think basic SQL will be fast enough (with 
not to many records (say 50)).
Who knows maybe I am crazy :-P

greetings 

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


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



Re: [PHP] Re: Authentication fails - problem line found

2005-03-04 Thread Richard Lynch
John Swartzentruber wrote:
 I stripped down my original script until it started receiving POST data,
 then I kept modifying it until I figured out where the problem was. I
 found it, but I'm still as clueless as every.

 To summarize: I have a form that posts to the same script that contains
 the form. In its original state, when the script is called after I
 submit the form data, the $_POST[] data is completely empty and the
 _SERVER variable that indicates the type of data is set to GET.

 In the script is the following code:

 if (IsSet($_POST[action])) {
 //$action = $_POST[action];
 } else {
  $action = $_GET[action];
 }


 Normally the second line is not commented. When I comment out that line,
 then the $_POST array has all of the data I would expect it to. When it
 is not commented, then it does not work.

 Just to make sure that I am really confused, this bit of code is *after*
 the call to var_dump($_POST), but *before* the code that creates the form.

 Does anyone have any ideas about why setting this variable has such a
 large and seemingly unrelated affect?

WILD GUESS:
Somewhere in your form and/or the logic, you are sending GET data for
$action as well as POST data for $action, and you are confusing the two.

Show us your stripped-down but still-broken code.

-- 
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] Re: mass emailing on windows server

2005-03-04 Thread Manuel Lemos
Hello,
on 03/04/2005 01:10 PM Reinhart Viane said the following:
Unfortunately I have a windows server hosting that site.
Anyone knows how to do mass email on a windows server?
You may want to try this class for composing and sending mass mailing 
messages.

It comes with several classes specialized on different types of 
delivery. The base class uses the mail() function. There is a sub-class 
for deliverying via SMTP and another for injecting the messages directly 
in the Windows (2000 or better) pickup folder.

If you can use this last one, that would be fastest delivery method. If 
you can't use it because you do not have enough permissions, the SMTP 
delivery class is also fine using the SetBulkMail function to hint the 
class to optimize itself for bulk deliveries.

If you do not want to personalize the message bodies for each recipient, 
the class can perform further optiomizitions and make the delivery even 
faster.

http://www.phpclasses.org/mimemessage
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Database engine in PHP

2005-03-04 Thread Chris W. Parker
Gerben mailto:[EMAIL PROTECTED]
on Friday, March 04, 2005 10:45 AM said:

 I have already asked this question, but I think I wasn't clear enough
 of my intentions (thanks for all your responses anyway)

Yeah you definitely weren't clear enough the first time... but this time
you're definitely *more* clear. Definitely.

?_?

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



[PHP] Image Submits to Forms

2005-03-04 Thread Marquez Design
Greetings,

I am trying to create a form that will do the following:

First, select a page from a select box,
Second, click on a button on the side that will do a specific function.

Select page, then with the delete button, delete the file,
Select page, then with the edit button, edit the page.

Does anyone know how I could do this?

I hope this makes sense.

--
Steve Marquez
Marquez Design

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



Re: [PHP] Re: Authentication fails - problem line found

2005-03-04 Thread phpninja
I think all php functions are case sensitive and must be all
lowercase. try changing IsSet to isset and give it a run. I im not
100% sure because i always type every function in php lowercase and
keep it the same throughout the application so i dont ever have to
worry about that. Just a thought.

-phpninja

-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 04, 2005 11:03 AM
To: John Swartzentruber
Cc: php-general@lists.php.net
Subject: Re: [PHP] Re: Authentication fails - problem line found

John Swartzentruber wrote:
 I stripped down my original script until it started receiving POST data,
 then I kept modifying it until I figured out where the problem was. I
 found it, but I'm still as clueless as every.

 To summarize: I have a form that posts to the same script that contains
 the form. In its original state, when the script is called after I
 submit the form data, the $_POST[] data is completely empty and the
 _SERVER variable that indicates the type of data is set to GET.

 In the script is the following code:

 if (IsSet($_POST[action])) {
 //$action = $_POST[action];
 } else {
  $action = $_GET[action];
 }


 Normally the second line is not commented. When I comment out that line,
 then the $_POST array has all of the data I would expect it to. When it
 is not commented, then it does not work.

 Just to make sure that I am really confused, this bit of code is *after*
 the call to var_dump($_POST), but *before* the code that creates the form.

 Does anyone have any ideas about why setting this variable has such a
 large and seemingly unrelated affect?

WILD GUESS:
Somewhere in your form and/or the logic, you are sending GET data for
$action as well as POST data for $action, and you are confusing the two.

Show us your stripped-down but still-broken code.

-- 
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Authentication fails - problem line found

2005-03-04 Thread dan
phpninja wrote:
I think all php functions are case sensitive and must be all
lowercase. try changing IsSet to isset and give it a run. I im not
100% sure because i always type every function in php lowercase and
keep it the same throughout the application so i dont ever have to
worry about that. Just a thought.
-phpninja
-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 04, 2005 11:03 AM
To: John Swartzentruber
Cc: php-general@lists.php.net
Subject: Re: [PHP] Re: Authentication fails - problem line found

John Swartzentruber wrote:
I stripped down my original script until it started receiving POST data,
then I kept modifying it until I figured out where the problem was. I
found it, but I'm still as clueless as every.
To summarize: I have a form that posts to the same script that contains
the form. In its original state, when the script is called after I
submit the form data, the $_POST[] data is completely empty and the
_SERVER variable that indicates the type of data is set to GET.
In the script is the following code:
if (IsSet($_POST[action])) {
//$action = $_POST[action];
} else {
$action = $_GET[action];
}
Normally the second line is not commented. When I comment out that line,
then the $_POST array has all of the data I would expect it to. When it
is not commented, then it does not work.
Just to make sure that I am really confused, this bit of code is *after*
the call to var_dump($_POST), but *before* the code that creates the form.
Does anyone have any ideas about why setting this variable has such a
large and seemingly unrelated affect?

WILD GUESS:
Somewhere in your form and/or the logic, you are sending GET data for
$action as well as POST data for $action, and you are confusing the two.
Show us your stripped-down but still-broken code.
How about using single quotes around all the action phrases:
if (IsSet($_POST['action'])) {
//$action = $_POST['action'];
} else {
 $action = $_GET['action'];
}
I'm slowly learning, myself, on the proper placement of quotes.
Thanks
-dant
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Image Submits to Forms

2005-03-04 Thread Chris W. Parker
Marquez Design mailto:[EMAIL PROTECTED]
on Friday, March 04, 2005 11:05 AM said:

 Greetings,

voice style=type:alien;Greetings earthling!/voice

 Select page, then with the delete button, delete the file,
 Select page, then with the edit button, edit the page.
 
 Does anyone know how I could do this?

1. Send a command to the filesystem to delete the file. Look in the
manaul for functions.
2. Read the file from the filesystem, store it in a variable, then echo
it to the page. Probably within a textarea. Then save it using a
similar command to #1.



Chris.

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



[PHP] Problems including a url with query string variables

2005-03-04 Thread Brian A. Anderson
I am having a difficulty including a url and passing it to an include
statement between it. The problem is when I have a plain url it works, but
if I try to pass it something to the query string it does not. Is there some
way to format the string differently before including it?

ob_start();
...
$result = ob_get_clean();

The below example works:
--

$URL = http:/-.-.-.-/datachange.asp;
ob_start();
include($URL);
$message = ob_get_clean();


The below example does not work:
--

$URL = http:/-.-.-.-/datachange.asp$queryString;
ob_start();
include($URL);
$message = ob_get_clean();

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



Re: [PHP] Re: Authentication fails - problem line found

2005-03-04 Thread John Swartzentruber
On 3/4/2005 2:23 PM Dan wrote:
phpninja wrote:
I think all php functions are case sensitive and must be all
lowercase. try changing IsSet to isset and give it a run. I im not
100% sure because i always type every function in php lowercase and
keep it the same throughout the application so i dont ever have to
worry about that. Just a thought.
How about using single quotes around all the action phrases:
if (IsSet($_POST['action'])) {
//$action = $_POST['action'];
} else {
 $action = $_GET['action'];
}
I'm slowly learning, myself, on the proper placement of quotes.
Thanks
-dant
I tried that. I also doubt that isset would work any better because that 
condition is being processed correctly.

This script is not something that I wrote, it is something I downloaded. 
I assume that it works correctly for the author on the author's system.

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


Re: [PHP] Problems including a url with query string variables

2005-03-04 Thread Brian A. Anderson
let me try it again...

The below example works:
--

ob_start();
include(http:/-.-.-.-/datachange.asp);
$message = ob_get_clean();


The below example does not work:
--
 $URL = http:/-.-.-.-/datachange.asp$queryString;
ob_start();
include($URL);
$message = ob_get_clean();

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



Re: [PHP] Re: Authentication fails - problem line found

2005-03-04 Thread John Swartzentruber
On 3/4/2005 2:02 PM Richard Lynch wrote:
John Swartzentruber wrote:
I stripped down my original script until it started receiving POST data,
then I kept modifying it until I figured out where the problem was. I
found it, but I'm still as clueless as every.
To summarize: I have a form that posts to the same script that contains
the form. In its original state, when the script is called after I
submit the form data, the $_POST[] data is completely empty and the
_SERVER variable that indicates the type of data is set to GET.
In the script is the following code:
if (IsSet($_POST[action])) {
//$action = $_POST[action];
} else {
$action = $_GET[action];
}
Normally the second line is not commented. When I comment out that line,
then the $_POST array has all of the data I would expect it to. When it
is not commented, then it does not work.
Just to make sure that I am really confused, this bit of code is *after*
the call to var_dump($_POST), but *before* the code that creates the form.
Does anyone have any ideas about why setting this variable has such a
large and seemingly unrelated affect?

WILD GUESS:
Somewhere in your form and/or the logic, you are sending GET data for
$action as well as POST data for $action, and you are confusing the two.
Show us your stripped-down but still-broken code.
Thanks for sticking with me. I tried stripping it down again, but then 
the stripped down version worked (even with the problem line). That 
means I need to take a couple more passes at it and figure out what else 
 is working with this line that causes the problem.

I did determine that it is not the name of the $action variable or the 
action POST value. If I manually set $action to login, it causes the 
problem, but if I set it to loginx, then the post values come through 
correctly.

I didn't write this script, and I'm seeing the same problem in 
phpMyAdmin, so I don't think it is a coding problem unless it is an 
incompatibility between php4 and php5. I still need to track it down 
further. I'll let you know what I find.

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


Re: [PHP] Re: Authentication fails - problem line found

2005-03-04 Thread dan
John Swartzentruber wrote:
On 3/4/2005 2:23 PM Dan wrote:
phpninja wrote:
I think all php functions are case sensitive and must be all
lowercase. try changing IsSet to isset and give it a run. I im not
100% sure because i always type every function in php lowercase and
keep it the same throughout the application so i dont ever have to
worry about that. Just a thought.
How about using single quotes around all the action phrases:
if (IsSet($_POST['action'])) {
//$action = $_POST['action'];
} else {
 $action = $_GET['action'];
}
I'm slowly learning, myself, on the proper placement of quotes.
Thanks
-dant

I tried that. I also doubt that isset would work any better because that 
condition is being processed correctly.

This script is not something that I wrote, it is something I downloaded. 
I assume that it works correctly for the author on the author's system.

what I do sometimes is throw in keywords or the like:
if (IsSet($_POST['action'])) {
//$action = $_POST['action'];
  echo stage 1;
} else {
// $action = $_GET['action'];
  echo stage 2;
}
That helps me to determine the logical order of execution.  I don't 
think case has anything to do with it, as Chris had asked, but I don't 
suppose it would hurt.

YOu can also use phpinfo('INFO_VARIABLES'); to print all env vars to see 
if your var is even coming through.  However, the above example will 
pretty much determine this.

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


Re: [PHP] Problems including a url with query string variables

2005-03-04 Thread kjohnson
Brian A. Anderson [EMAIL PROTECTED] wrote on 03/04/2005 
12:37:29 PM:

 The below example works:
 --
 
 ob_start();
 include(http:/-.-.-.-/datachange.asp);
 $message = ob_get_clean();
 
 
 The below example does not work:
 --
  $URL = http:/-.-.-.-/datachange.asp$queryString;
 ob_start();
 include($URL);
 $message = ob_get_clean();


Does $queryString contain the leading '?', or do you need to add it, as 
below:

$URL = http:/-.-.-.-/datachange.asp?$queryString;

Kirk

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



Re: [PHP] Document root, preferred way to find it???

2005-03-04 Thread Leif Gregory
Hello Richard,

Friday, March 4, 2005, 11:41:29 AM, you wrote:
R http://php.net/set_include_path


Ok... Maybe I should put all this together in one e-mail so that all
the issues can be looked at...

The problem:

Finding a reliable method to include files, keeping in mind the
following:

1. The site could be moved to a completely new host which could be of
   a different OS, and/or web server software, and could either be the
   one and only site on that host (dedicated server), or could be a
   virtual host (shared server).

2. The site could remain on the same host but is required to move to a
   new path. i.e. from htdocs/mysite to htdocs/mynewsite

3. The web host may or may not allow the use of .htaccess (Some Sambar
   configurations for example).

4. The method used would not affect any other virtual hosts. Meaning,
   the method used must be independent for each virtual host.

5. The method used would not utilize a folder where other virtual
   hosts could gain access to the included file (php.ini
   include_path).

6. The method (and this is the important one IMHO) would not require
   editing x number of pages in a site to change some static path
   that was set on each page.

7. The method used would not require a dedicated include file in
   every single folder of the site that could be included because it's
   in the same folder as the page needing it, because those would all
   have to be edited to fix the path if condition 1 or 2 was met.


Previously proposed solutions:

1. PHP.ini include_path
   This affects all virtual hosts and would require administrative
   overhead to prevent the owners of each virtual host from gaining
   access to other virtual host's include files. I suppose you could
   set it to something like: include_path=/php/includes and have a
   separate subfolder under that for each virtual host. But since that
   folder is outside the web folder, there would have to be some
   mechanism (additional FTP account) for each person to gain access
   to their own include folder to add/edit/delete files in that
   folder. Then if the site is moved and they aren't using an
   include_path, you have to fix all your pages.

2. set_include_path
   This means if your site moves, you must edit x number of pages in
   the site to correct the path.

3. An include file in every directory to set the include path.
   You'd have to edit x number of these files to correct the path if
   the site moves. This would be much less work than the previous
   item, but it could be a lot of work on very big sites where you
   don't have shell accounts to do some scripted find/replace with.

4. Use the full URL to the file in the include statement.
   See item 2.

5. $_SERVER[DOCUMENT_ROOT] and $_SERVER['PATH_TRANSLATED']
   Not always available or incorrect see
   mid:[EMAIL PROTECTED]


I may have missed some things, and if I've misunderstood how something
should work, then please let me know. I'm just looking for a more or
less foolproof method which doesn't require fixing code if the site is
moved. The closest I can come to it is the function I wrote but is a
pain because you have to put it in every page where you need an
included file. Granted, you only have to do it once, and then you're
done and a site move wont affect it, but it's still kludgy if you ask
me.

***
?php
function dynRoot() 
{ 
  $levels = substr_count($_SERVER['PHP_SELF'],/); 

  for ($i=0; $i  $levels - 1; $i++) 
  { 
$relativeDir .= ../; 
  } 

  return $relativeDir; 
}
?
***

and then calling it as such:

include(dynRoot() . 'includes/db_connect.php');


I've had to move client sites between Sambar, Apache, IIS and Windows,
Linux. Most times I've had to go in and fix include paths because one
of the above solutions were originally used and wasn't viable on the
new host.

Thanks.
   

-- 
Leif (TB lists moderator and fellow end user).

Using The Bat! 3.0.2.3 Rush under Windows XP 5.1
Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB

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



Re: [PHP] Simple XML

2005-03-04 Thread Uro Gruber
Jochem Maas wrote:
Richard Lynch wrote:
Uro Gruber wrote:
resData
  domain:chkData xmlns:domain=urn:ietf:params:xml:ns:domain-1.0
xsi:schemaLocation=urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd
domain:cd
  domain:name avail=1bar.com/domain:name
/domain:cd
domain:cd
  domain:name avail=1foo.com/domain:name
/domain:cd
  /domain:chkData
/resData
But I cant get to this cd If I print_r complete response object it
out of interest what does print_r() actually output? better yet what does
var_dump() actually output? (i.e. post the output please)
Let say I have
$xml = simplexml_load_string($response);
$domains = $xml-response-resData;
var_dump($domains);
I get output
object(SimpleXMLElement)#5 (1) {
  [chkData]=
  object(SimpleXMLElement)#4 (1) {
[cd]=
array(2) {
  [0]=
  object(SimpleXMLElement)#6 (1) {
[name]=
string(7) foo.com
  }
  [1]=
  object(SimpleXMLElement)#7 (1) {
[name]=
string(7) bar.com
  }
}
  }
}
ok, here I see that foo and bar but.
and then
var_dump($domains-chkData);
var_dump($domains['domain:chkData']);
output this
object(SimpleXMLElement)#8 (0) {
}
NULL
So It seams like object magicaly disapears. But as Jason said 
that namspaces is not fully implemented yet. I tried same code 
with RSS XML and schemas and it does not work either. But with 
one exception.

I can do
$children = $domains-children('schemalocation');
The I can go inside $children. But here with epp xml this doesnt 
work at all, or maybe I'm missing something.


XML bigots are probably ready to turn their flame-throwers on me.  Oh 
well.

I'm all out of gas, oh hang on I don't even like XML that much :-) - 
with php4
I found XML a bit nightmarish, and all that namespace stuff can, well, 
really
screw up your day... I think Uro knows that already :-/

I think XML is great in such ways, but with this one I can't do 
anything about to simplify it, because it standard protocol and 
I have to make a client to comunicate with registrar server :(

I screw about 3 days now, but I found solution with 
PEAR::XML_Parser. It's not clean but It works for now. If anyone 
have same problems I can give a code (it's not finished yet).

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


[PHP] Re: Database engine in PHP

2005-03-04 Thread Manuel Lemos
Hello,
on 03/04/2005 03:45 PM Gerben said the following:
I was wondering if there is any DBMS, like MySQL, which is (fully) 
implemented
in php. That is a database engine written in PHP.
I know this is not the most effecient way, but I'm not planning to use it
for heavy weight database-driven-application.
Yes, you may want to take a look at this flat file database manager 
class that even supports SQL, which seems to be exactly what you are 
looking for:

http://www.phpclasses.org/pdb
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Help with REGEXP please

2005-03-04 Thread Shaun
Hi,

Please could someone tell me how i can extract the information from a string 
that is after 'ID_' and before '_FN'

Thanks for your help. 

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



[PHP] Re: upload and resize image script

2005-03-04 Thread Cristian Lavaque
P80 wrote:
hey all
I'm looking for a simple script that would upload an image and resize it to 
thumbnail using a form to upload the picture. anyone has a good script for 
that?

thanx in advance
Pat
Hi Pat,
I wrote this function to resize pictures to the max width/height, 
preserving proportions:

function resizeImage($src_file, $dst_file, $max_width, $max_height)
{
// Formats we will handle.
$formats = array('1' = 'gif', '2' = 'jpeg', '3' = 'png');
// Get info on the image.
if (!$sizes = getimagesize($src_file))
return false;
	// A known and supported format?
	if (!isset($formats[$sizes[2]]) || !function_exists('imagecreatefrom' . 
$formats[$sizes[2]]))
		return false;

// Create image from file.
$imagecreatefrom = 'imagecreatefrom' . $formats[$sizes[2]];
if (!$src_img = $imagecreatefrom($src_file))
return false;
// Calculate the new size.
$max = array('width' = $max_width, 'height' = $max_height);
$dst['width'] = $src['width'] = $sizes[0];
$dst['height'] = $src['height'] = $sizes[1];
foreach (array('width' = 'height', 'height' = 'width') as $k = $v)
if (!empty($max[$k])  $dst[$k]  $max[$k])
{
$dst[$k] = $max[$k];
$dst[$v] = floor($src[$v] * $max[$k] / $src[$k]);
}
// Create true color image.
$dst_img = imagecreatetruecolor($dst['width'], $dst['height']);
	// Do the resize.
	if(!imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dst['width'], 
$dst['height'], $src['width'], $src['height']))
		return false;

// Save image to file.
imagejpeg($dst_img, $dst_file);
// Free the memory.
imagedestroy($src_img);
imagedestroy($dst_img);
return true;
}
It may not be exactly what you need, but I hope you find it helpful.
Regards,
Cristian
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Problems including a url with query string variables

2005-03-04 Thread Brian A. Anderson
  The below example works:
  --
 
  ob_start();
  include(http:/-.-.-.-/datachange.asp);
  $message = ob_get_clean();
 
 
  The below example does not work:
  --
   $URL = http:/-.-.-.-/datachange.asp$queryString;
  ob_start();
  include($URL);
  $message = ob_get_clean();


 Does $queryString contain the leading '?', or do you need to add it, as
 below:

 $URL = http:/-.-.-.-/datachange.asp?$queryString;

 Kirk


Yes it includes a ?.
I am thinking it might be a problem with the order of processing. Includes
first , then everything else
Is there any way to include a file only after a conditional?

-Brian

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



Re: [PHP] Help with REGEXP please

2005-03-04 Thread Leif Gregory
Hello Shaun,

Friday, March 4, 2005, 12:54:34 PM, you wrote:
S Please could someone tell me how i can extract the information from
S a string that is after 'ID_' and before '_FN'

?php
$myString = ID_723456ABc_FN;

preg_match(/ID_([a-z0-9]+)_FN/i,$myString, $extracted); 

echo $extracted[1];
?

This will match any upper or lowercase letter and number. If you have
other characters like _ , etc, then you'll need to put those in
the [a-z0-9_,] too.


-- 
Leif (TB lists moderator and fellow end user).

Using The Bat! 3.0.2.3 Rush under Windows XP 5.1
Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB

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



RE: [PHP] Help with REGEXP please

2005-03-04 Thread Chris W. Parker
Shaun mailto:[EMAIL PROTECTED]
on Friday, March 04, 2005 11:55 AM said:

 Please could someone tell me how i can extract the information from a
 string that is after 'ID_' and before '_FN'

Get the RegExCoach. It'll be your best friend.


Try: /ID_(.*)_FN/



Chris.

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



Re: [PHP] Document root, preferred way to find it???

2005-03-04 Thread Richard Lynch
 6. The method (and this is the important one IMHO) would not require
editing x number of pages in a site to change some static path
that was set on each page.

I believe you could get x to be 1, if you do this:

1. Set up a config_include_path.inc file in your DocumentRoot (possibly
virtual) directory.

2. Utilize $_SERVER['path_translated'] and $_SERVER{'documentRoot'] in all
the pages to temporarily set_include_path to your [virtual] DocumentRoot. 
If *those* are broken, you might as well just not use that host. :-^

3. In the config_include_path.inc, use set_include_path to set up whatever
you need to use for the new server/configuration.

So every page will set their include_path to DocumentRoot, then include a
file that from there that will change the include_path to whatever you
need for that particular server.

It's a bit of a hack, but cuts the number of config files to one (1) for a
transfer/install.

-- 
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] Problems including a url with query string variables

2005-03-04 Thread Richard Lynch
Brian A. Anderson wrote:
 I am having a difficulty including a url and passing it to an include
 statement between it. The problem is when I have a plain url it works, but
 if I try to pass it something to the query string it does not. Is there
 some
 way to format the string differently before including it?

What is in $queryString?

Are you urlencoding the VALUES of $queryString?

Won't work:
$URL = http://example.com/foo=this is a test;

Should work:
$URL = http://example.com/foo=this+is+a+test;;

-- 
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] Re: Authentication fails - problem line found

2005-03-04 Thread Richard Lynch
phpninja wrote:
 I think all php functions are case sensitive and must be all
 lowercase. try changing IsSet to isset and give it a run. I im not
 100% sure because i always type every function in php lowercase and
 keep it the same throughout the application so i dont ever have to
 worry about that. Just a thought.

PHP functions are case-INsensitive.
PHP variables are case-sensitive.

-- 
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] Help with REGEXP please

2005-03-04 Thread John Nichel
Shaun wrote:
Hi,
Please could someone tell me how i can extract the information from a string 
that is after 'ID_' and before '_FN'

Thanks for your help. 

preg_match ( /ID_(.*)_FN/, $string, $result )
The data will be in $result[1] if there is a match.
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Document root, preferred way to find it???

2005-03-04 Thread Leif Gregory
Hello Richard,

Friday, March 4, 2005, 1:25:35 PM, you wrote:
R If *those* are broken, you might as well just not use that host.
R :-^

Your solution seems to be pretty bulletproof. I definitely appreciate
it. Just wondering though for posterity sake, have you or anyone ever
run into a host that had both $_SERVER['path_translated'] and
$_SERVER{'documentRoot'] broke? I've seen $_SERVER{'documentRoot'] not
being correct, but has anyone seen it not correct and not having
$_SERVER['path_translated'] available? Previously, when I saw
$_SERVER['documentroot'] incorrect, I didn't know about
$_SERVER['path_translated'] so I don't know if it was good or not.


R It's a bit of a hack, but cuts the number of config files to one
R (1) for a transfer/install.

Looks like it'll work. Thanks. Maybe one day the people at PHP will
fix it so we don't have to work around it.


-- 
Leif (TB lists moderator and fellow end user).

Using The Bat! 3.0.2.3 Rush under Windows XP 5.1
Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB

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



Re: [PHP] Re: Authentication fails - SOLVED

2005-03-04 Thread John Swartzentruber
On 3/4/2005 2:02 PM Richard Lynch wrote:
John Swartzentruber wrote:
I stripped down my original script until it started receiving POST data,
then I kept modifying it until I figured out where the problem was. I
found it, but I'm still as clueless as every.
To summarize: I have a form that posts to the same script that contains
the form. In its original state, when the script is called after I
submit the form data, the $_POST[] data is completely empty and the
_SERVER variable that indicates the type of data is set to GET.
In the script is the following code:
if (IsSet($_POST[action])) {
//$action = $_POST[action];
} else {
$action = $_GET[action];
}
Normally the second line is not commented. When I comment out that line,
then the $_POST array has all of the data I would expect it to. When it
is not commented, then it does not work.
Just to make sure that I am really confused, this bit of code is *after*
the call to var_dump($_POST), but *before* the code that creates the form.
Does anyone have any ideas about why setting this variable has such a
large and seemingly unrelated affect?

WILD GUESS:
Somewhere in your form and/or the logic, you are sending GET data for
$action as well as POST data for $action, and you are confusing the two.
Show us your stripped-down but still-broken code.
I think I found it. I was very, very confused by the fact that changing 
a single line seemed to retroactively affect code that was *before* that 
line. Just a bit ago, it struck me that I should look at header() calls, 
since that would make the file reload and in affect retroactively change 
the previous code. I commented out each header() call, and the POST 
variables came through correctly. Then I narrowed it down to a single 
one (which was the one I suspected in the first place). It made sense 
when the header() call caused the page to reload, it wouldn't have POST 
data. Then I needed to figure out what the code was supposed to do.

Voila, right above the header() call and the exit, were four calls to 
session_register(). Aha, now I have something to R in TFM.

Yup, you guessed it. I have register_globals disabled, as is the 
default. The script was written assuming that the session data would be 
global. The session data basically disappeared as far as the script was 
concerned. So it turns out that having the POST data disappear was 
intentionally, but having the session data disappear was the problem.

Another example of the problems a newbie can have when debugging someone 
else's code.

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


Re: [PHP] Re: Authentication fails - problem line found

2005-03-04 Thread Jochem Maas
Richard Lynch wrote:
phpninja wrote:
I think all php functions are case sensitive and must be all
lowercase. try changing IsSet to isset and give it a run. I im not
100% sure because i always type every function in php lowercase and
keep it the same throughout the application so i dont ever have to
worry about that. Just a thought.

PHP functions are case-INsensitive.
PHP variables are case-sensitive.
thats not to say it's not blasphemous to write isset() as IsSet() ;-)
one a more serious not there are some posts a while back about CS. (Coding
Style)...anyhow, I think most people expect php core functions,
language-constructs to be written in lowercase, maybe only in my sector? :-).

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


[PHP] php 4 php 5

2005-03-04 Thread timothy johnson
Is there a way to install two version of php on the same machine, and
use them for two different users?

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



RE: [PHP] php 4 php 5

2005-03-04 Thread Jay Blanchard
[snip]
Is there a way to install two version of php on the same machine, and
use them for two different users?
[/snip]

No.

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



Re: [PHP] php 4 php 5

2005-03-04 Thread John Nichel
Jay Blanchard wrote:
[snip]
Is there a way to install two version of php on the same machine, and
use them for two different users?
[/snip]
No.
Yes. ;)
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


AW: [PHP] php 4 php 5

2005-03-04 Thread Mario Micklisch
 [snip]
 Is there a way to install two version of php on the same machine, and
 use them for two different users?
 [/snip]
 
 No.

Yes!

Having that in my LiteSpeed-Servers configuration with 3 different PHP
Versions. No problem if you use CGI or fastCgi's. On Apache also possible
via the VHost-Settings to assign a version to any selected VirtualHosts.

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



RE: [PHP] php 4 php 5

2005-03-04 Thread Jay Blanchard
[snip]
 No.
 
Yes. ;)
[/snip]

Why?

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



[PHP] pulling content from a URL

2005-03-04 Thread Nicholas W . Miller
I'm writing a script that needs to put the contents of an external URL 
into a variable.  I need to include some sort of error checking that 
will kill this request if for some reason the URL request hangs for 
more then 15 seconds.  In researching this, I think the correct 
function to use is fsockopen, but I can't seem to get it to work.  Can 
someone verify if fsockopen is the best way to grab an external URL, 
but kill the request if it hangs for a certain amount of time ... and 
if so, show me some sample code on how to place this URL's contents 
into a variable that I can then parse.  The URL will be hard coded into 
the script, so I don't need a lot of error checking to insure correct 
URL format, etc.

Thanks,
Nicholas Miller
Intercast Media, Inc.
229 19th Ave.  Suite 4
San Francisco, CA  94121
415-379-9500
415-520-9501 (fax)
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] php 4 php 5

2005-03-04 Thread Jay Blanchard
[snip]
[snip]
 No.
 
Yes. ;)
[/snip]

Why?
[/snip]

Never mind...Friday afternoon...it's five o'clock right here.

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



AW: [PHP] pulling content from a URL

2005-03-04 Thread Mario Micklisch
[..]
 into a variable.  I need to include some sort of error checking that 
 will kill this request if for some reason the URL request hangs for 
 more then 15 seconds.  In researching this, I think the correct 
 function to use is fsockopen, but I can't seem to get it to work.  Can 
 someone verify if fsockopen is the best way to grab an external URL, 
 but kill the request if it hangs for a certain amount of time ... and 
 if so, show me some sample code on how to place this URL's contents 
 into a variable that I can then parse.  The URL will be hard coded into 
[..]

stream_set_timeout should be what you're looking for.

might look like this:

?php
$fp = fsockopen(www.example.com, 80);
if (!$fp) {
   echo Unable to open\n;
} else {

   fwrite($fp, GET / HTTP/1.0\r\n\r\n);
   stream_set_timeout($fp, 2);
   $res = fread($fp, 2000);

   $info = stream_get_meta_data($fp);
   fclose($fp);

   if ($info['timed_out']) {
   echo 'Connection timed out!';
   } else {
   echo $res;
   }

}
?
-- from the manual:
http://us4.php.net/manual/en/function.stream-set-timeout.php

$res will hold the first 2,000 bytes of the result. 

socket blocking would be another way, but the above one looks like exactly
what you're looking for

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



Re: [PHP] php 4 php 5

2005-03-04 Thread Richard Lynch
timothy johnson wrote:
 Is there a way to install two version of php on the same machine, and
 use them for two different users?

Option 1:
Install two copies of Apache, with different httpd.conf files, on two
different ports.
Somebody gets stuck using http://example.com:81 (or any port but 80) but
this gives everything you asked for.

Option 2:
Use --enable-versioning while compiling PHP.  This definitely allowed for
PHP3 and PHP4 and *might* allow for 45...  Or not.  RTFM
But you won't get different Users.

Option 3:
Install at least one of the two as CGI (fastCGI, whatever), and use a
different extension (.php4 or .php5) or use other means (ForceType,
AddHandler, AddType, etc) to change which is used on a per directory
basis.  Use suexec, if you UNDERSTAND THE RAMIFICATIONS to alter the user
of the CGI process.  Mis-use of suexec is incredibly dangerous.  YMMV 
NAIAA  IANAL
The CGI usage will lose some minimal functionality.  HTTP Authentication
springs to mind, but there are 3 or 4 functions/features that just plain
won't work in CGI.  RTFM

Option 4:
In terms of expenses/headaches, you will probably be better off just
buying a second machine.  Problem solved.

-- 
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] Document root, preferred way to find it???

2005-03-04 Thread Richard Lynch
Leif Gregory wrote:
 Friday, March 4, 2005, 1:25:35 PM, you wrote:
 R If *those* are broken, you might as well just not use that host.
 R :-^

 Your solution seems to be pretty bulletproof. I definitely appreciate
 it. Just wondering though for posterity sake, have you or anyone ever
 run into a host that had both $_SERVER['path_translated'] and
 $_SERVER{'documentRoot'] broke? I've seen $_SERVER{'documentRoot'] not
 being correct, but has anyone seen it not correct and not having
 $_SERVER['path_translated'] available? Previously, when I saw
 $_SERVER['documentroot'] incorrect, I didn't know about
 $_SERVER['path_translated'] so I don't know if it was good or not.

Never seen it.

Only your post w/ a reference to a thread I didn't go re-read made me
think it could happen...

I don't really spend a lot of time porting code from server to server,
though.

-- 
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] php 4 php 5

2005-03-04 Thread Hans Zaunere


  Is there a way to install two version of php on the same machine, and
  use them for two different users?
 
 Option 1:
 Install two copies of Apache, with different httpd.conf files, on two
 different ports.
 Somebody gets stuck using http://example.com:81 (or any port but 80) but
 this gives everything you asked for.

Or make Apache listen on two IPs - if your provider will do this, or it's your 
own box, there's not downside.  You could use two domains, or two different 
subdomains.

 Option 4:
 In terms of expenses/headaches, you will probably be better off just
 buying a second machine.  Problem solved.

If you get another machine, you'll need two domains or subdomains anyway.  Just 
put them on the same box, with two IPs.


---
Hans Zaunere
President, Founder

New York PHP
http://www.nyphp.org

AMP Technology
Supporting Apache, MySQL and PHP

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



Re: [PHP] pulling content from a URL

2005-03-04 Thread Matthew Fonda
I would recommend using PEAR::HTTP_Request for this. It does exactly
what you want to do, and can handle error handling very well

http://pear.php.net/package/HTTP_Request

 I'm writing a script that needs to put the contents of an external URL 
 into a variable.  I need to include some sort of error checking that 
 will kill this request if for some reason the URL request hangs for 
 more then 15 seconds.  In researching this, I think the correct 
 function to use is fsockopen, but I can't seem to get it to work.  Can 
 someone verify if fsockopen is the best way to grab an external URL, 
 but kill the request if it hangs for a certain amount of time ... and 
 if so, show me some sample code on how to place this URL's contents 
 into a variable that I can then parse.  The URL will be hard coded into 
 the script, so I don't need a lot of error checking to insure correct 
 URL format, etc.

-- 
Regards,
Matthew Fonda
http://mfonda.info

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



Re: [PHP] Image Submits to Forms

2005-03-04 Thread Marek Kilimajer
Marquez Design wrote:
Greetings,
I am trying to create a form that will do the following:
First, select a page from a select box,
Second, click on a button on the side that will do a specific function.
Select page, then with the delete button, delete the file,
Select page, then with the edit button, edit the page.
Does anyone know how I could do this?
HTML of the buttons:
input type=image src=delete.gif name=delete
input type=image src=edit.gif name=edit
Then in the form handling script:
if(isset($_POST['delete_x'])  isset($_POST['delete_y']) {
// delete
}
if(isset($_POST['edit_x'])  isset($_POST['edit_y']) {
// edit
}
If every browser was standards compliant, you could use:
input type=image src=delete.gif name=action value=delete
input type=image src=edit.gif name=action value=edit
switch($_POST['action']) {
case 'delete':
// delete
break;
case 'edit':
// edit
break;
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] setcookie

2005-03-04 Thread Randy Johnson
setcookie( sess_key,$key,0,/,. . str_replace( 
www,,$_SERVER[SERVER_NAME] ),0 );

Does that look right?
Thanks!
Randy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] setcookie

2005-03-04 Thread Marek Kilimajer
Randy Johnson wrote:
setcookie( sess_key,$key,0,/,. . str_replace( 
www,,$_SERVER[SERVER_NAME] ),0 );

Does that look right?
No.
if $_SERVER[SERVER_NAME] == 'www.domain.com'
. . str_replace(www,,$_SERVER[SERVER_NAME] )
will give you ..domain.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] setcookie

2005-03-04 Thread Randy Johnson
ok I see how that could be an issue.
Here is my big problem that I have not been able to figure out.
I have a client website that I am trying to fix
1.  it has sessions in database, and uses set cookie
2.  I can login with firefox/netscape/mozilla just fine
3.  I cannot login with any version of IE
4.  this is also by going to domain.com  or www.domain.com, neither work
any ideas?
Randy

Marek Kilimajer wrote:
Randy Johnson wrote:
setcookie( sess_key,$key,0,/,. . str_replace( 
www,,$_SERVER[SERVER_NAME] ),0 );

Does that look right?

No.
if $_SERVER[SERVER_NAME] == 'www.domain.com'
. . str_replace(www,,$_SERVER[SERVER_NAME] )
will give you ..domain.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] setcookie

2005-03-04 Thread Randy Johnson
The period was the issue all together,  i took the extra out and it 
worked.  Thanks for your help

Randy
Randy Johnson wrote:
ok I see how that could be an issue.
Here is my big problem that I have not been able to figure out.
I have a client website that I am trying to fix
1.  it has sessions in database, and uses set cookie
2.  I can login with firefox/netscape/mozilla just fine
3.  I cannot login with any version of IE
4.  this is also by going to domain.com  or www.domain.com, neither work
any ideas?
Randy

Marek Kilimajer wrote:
Randy Johnson wrote:
setcookie( sess_key,$key,0,/,. . str_replace( 
www,,$_SERVER[SERVER_NAME] ),0 );

Does that look right?

No.
if $_SERVER[SERVER_NAME] == 'www.domain.com'
. . str_replace(www,,$_SERVER[SERVER_NAME] )
will give you ..domain.com

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


Re[2]: [PHP] Document root, preferred way to find it???

2005-03-04 Thread Tom Rogers
Hi,

Saturday, March 5, 2005, 5:47:07 AM, you wrote:
LG Hello Richard,

LG Friday, March 4, 2005, 11:41:29 AM, you wrote:
R http://php.net/set_include_path


LG Ok... Maybe I should put all this together in one e-mail so that all
LG the issues can be looked at...

LG The problem:

LG Finding a reliable method to include files, keeping in mind the
LG following:

LG 1. The site could be moved to a completely new host which could be of
LGa different OS, and/or web server software, and could either be the
LGone and only site on that host (dedicated server), or could be a
LGvirtual host (shared server).

LG 2. The site could remain on the same host but is required to move to a
LGnew path. i.e. from htdocs/mysite to htdocs/mynewsite

LG 3. The web host may or may not allow the use of .htaccess (Some Sambar
LGconfigurations for example).

LG 4. The method used would not affect any other virtual hosts. Meaning,
LGthe method used must be independent for each virtual host.

LG 5. The method used would not utilize a folder where other virtual
LGhosts could gain access to the included file (php.ini
LGinclude_path).

LG 6. The method (and this is the important one IMHO) would not require
LGediting x number of pages in a site to change some static path
LGthat was set on each page.

LG 7. The method used would not require a dedicated include file in
LGevery single folder of the site that could be included because it's
LGin the same folder as the page needing it, because those would all
LGhave to be edited to fix the path if condition 1 or 2 was met.


LG Previously proposed solutions:

LG 1. PHP.ini include_path
LGThis affects all virtual hosts and would require administrative
LGoverhead to prevent the owners of each virtual host from gaining
LGaccess to other virtual host's include files. I suppose you could
LGset it to something like: include_path=/php/includes and have a
LGseparate subfolder under that for each virtual host. But since that
LGfolder is outside the web folder, there would have to be some
LGmechanism (additional FTP account) for each person to gain access
LGto their own include folder to add/edit/delete files in that
LGfolder. Then if the site is moved and they aren't using an
LGinclude_path, you have to fix all your pages.

LG 2. set_include_path
LGThis means if your site moves, you must edit x number of pages in
LGthe site to correct the path.

LG 3. An include file in every directory to set the include path.
LGYou'd have to edit x number of these files to correct the path if
LGthe site moves. This would be much less work than the previous
LGitem, but it could be a lot of work on very big sites where you
LGdon't have shell accounts to do some scripted find/replace with.

LG 4. Use the full URL to the file in the include statement.
LGSee item 2.

LG 5. $_SERVER[DOCUMENT_ROOT] and $_SERVER['PATH_TRANSLATED']
LGNot always available or incorrect see
LGmid:[EMAIL PROTECTED]


LG I may have missed some things, and if I've misunderstood how something
LG should work, then please let me know. I'm just looking for a more or
LG less foolproof method which doesn't require fixing code if the site is
LG moved. The closest I can come to it is the function I wrote but is a
LG pain because you have to put it in every page where you need an
LG included file. Granted, you only have to do it once, and then you're
LG done and a site move wont affect it, but it's still kludgy if you ask
LG me.

LG ***
LG ?php
LG function dynRoot() 
LG { 
LG   $levels = substr_count($_SERVER['PHP_SELF'],/); 

LG   for ($i=0; $i  $levels - 1; $i++) 
LG   { 
LG $relativeDir .= ../; 
LG   } 

LG   return $relativeDir; 
LG }
?
LG ***

LG and then calling it as such:

LG include(dynRoot() . 'includes/db_connect.php');


LG I've had to move client sites between Sambar, Apache, IIS and Windows,
LG Linux. Most times I've had to go in and fix include paths because one
LG of the above solutions were originally used and wasn't viable on the
LG new host.

LG Thanks.
   

LG -- 
LG Leif (TB lists moderator and fellow end user).

LG Using The Bat! 3.0.2.3 Rush under Windows XP 5.1
LG Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB


This will set the include path just before the document root:

if(isset($_SERVER[SCRIPT_FILENAME])){
$root = $_SERVER['SCRIPT_FILENAME'];
//echo Root: $rootbr;

$script = $_SERVER['SCRIPT_NAME'];
$document_root = str_replace($script,'',$root);
//echo Document root: $document_rootbr;

$base = basename($document_root);
//echo Base: $basebr;

$include = str_replace($base,'include',$document_root);
//echo Include: $includebr;

$os = strtolower(PHP_OS);
//echo OS: $osbr;

$lk = ':';
$org_include = ini_get(include_path);

Re[3]: [PHP] Document root, preferred way to find it???

2005-03-04 Thread Tom Rogers
Hi,

TR This will set the include path just before the document root:

TR if(isset($_SERVER[SCRIPT_FILENAME])){
TR $root = $_SERVER['SCRIPT_FILENAME'];
TR //echo Root: $rootbr;

TR $script = $_SERVER['SCRIPT_NAME'];
TR $document_root = str_replace($script,'',$root);
TR //echo Document root: $document_rootbr;

TR $base = basename($document_root);
TR //echo Base: $basebr;

TR $include = str_replace($base,'include',$document_root);
TR //echo Include: $includebr;

TR $os = strtolower(PHP_OS);
TR //echo OS: $osbr;

TR $lk = ':';
TR $org_include = ini_get(include_path);
TR if(preg_match('/^win/i',$os))   $lk = ';';

TR ini_set(include_path,$include.$lk.$org_include);
TR //echo Include: .ini_get(include_path).br;
TR }

TR -- 
TR regards,
TR Tom


Forgot to tell you to put it in the auto_prepend file and it will work
for all files :)

-- 
regards,
Tom

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



  1   2   >