[PHP] Global vars

2002-06-02 Thread Anzak Wolf

I have a question about global vars.  Why is it that I have to declare a var 
global if I'm using it across included files.  For example the only why I 
can get this var to work is by making it global.

main.php
?php
include loader.inc;
include builder.inc;
include render.inc;
?

loader.inc
?php
global $obj;
$obj = new Whiz_bang();
?

builder.inc
?php
global $obj;
$obj-build_whizzer();
?

render.inc
?php
render-html();
?

considering that if you took the could and just inserted the code form the 
included files into the main you would not need to make the var global why 
is that I need to when I cross files.  I don't think I have  read a good 
reasoning for this anywhere.  My goal is simple to use as few global vars as 
possible which is why I ask.

_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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




[PHP] Alguine me puede Ayudar...S.O.S...mi PHP no sube .....

2002-06-02 Thread omora

Hola
 Resulta que tengo problemas para que funcione PHP en un
servidor NT 4.0 con IIS 3.0 y este no funciona PHP ver. 4.2.1) ya que al
hacer alguno de los ejemplos que adjunte (codigos) ninguno funciona.
Hicela prueba con Apache/Win98/PHP y ahí me funciono.
No entinedo que es lo que pasa?; ademas segui instruciones de
la pagina Web http://www.php.net/manual/fi/configuration.php y aun asi no
Funciono.
  Si alguien me puede Ayudar se lo agradecería, ya que esto me tiene
muy complicado.

Saludos.
Oscar Mora

PD: Con este codigo, hago test con una pagina llamada prueba.php y me di
cuenta de que en NT no funcionó, pero si en W98.

?php $myvar = Hola. Este es mi primer script en PHP \n;
//es mi primer script en PHP \n;
echo $myvar; ?
BR
trtdForma 1/a/td
? echo Hola, este es un mensaje de Prueba con PHP; ?
BR
trtdForma 2/a/td
?php echo Hola, este es un mensaje de Prueba con PHP;?
BR
trtdForma 3/a/td
script language=php echo Hola, este es un mensaje de
Prueba
con PHP; /script
BR
trtdForma4/a/td
% echo Hola, este es un mensaje de Prueba con PHP; %
BRBR
? php phpinfo() ?


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




[PHP] Alguine me puede Ayudar...S.O.S...mi PHP no sube .....

2002-06-02 Thread omora

Hola
 Resulta que tengo problemas para que funcione PHP en un
servidor NT 4.0 con IIS 3.0 y este no funciona PHP ver. 4.2.1) ya que al
hacer alguno de los ejemplos que adjunte (codigos) ninguno funciona.
Hicela prueba con Apache/Win98/PHP y ahí me funciono.
No entinedo que es lo que pasa?; ademas segui instruciones de
la pagina Web http://www.php.net/manual/fi/configuration.php y aun asi no
Funciono.
  Si alguien me puede Ayudar se lo agradecería, ya que esto me tiene
muy complicado.

Saludos.
Oscar Mora

PD: Con este codigo, hago test con una pagina llamada prueba.php y me di
cuenta de que en NT no funcionó, pero si en W98.

?php $myvar = Hola. Este es mi primer script en PHP \n;
//es mi primer script en PHP \n;
echo $myvar; ?
BR
trtdForma 1/a/td
? echo Hola, este es un mensaje de Prueba con PHP; ?
BR
trtdForma 2/a/td
?php echo Hola, este es un mensaje de Prueba con PHP;?
BR
trtdForma 3/a/td
script language=php echo Hola, este es un mensaje de
Prueba
con PHP; /script
BR
trtdForma4/a/td
% echo Hola, este es un mensaje de Prueba con PHP; %
BRBR
? php phpinfo() ?


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




Re: [PHP] Problems with Multi-Uploads (AGAIN)

2002-06-02 Thread Jason Wong

On Sunday 02 June 2002 05:54, Nick Patsaros wrote:
 Okay so this is what I'm trying, basically for the
 purposes of posting a news article I want to be able
 to upload supporting text files with the content of
 the article.  Here's what I've got so far... I think
 I've totally missed the mark or understood the
 documentation in the manual on this... Someone please
 set me straight:

[snip]

I'm sorry if I missed it, but what is your problem? Posting a bunch of code 
without saying what is wrong with it does not help us to help you. I'm 
assuming (from the subject of your post) that this is a follow-up to one of 
your previous posts. In that case you should've continued with your previous 
thread because:

a) it is logical to do so
b) people who have been helping you before would know what was happening and 
the story so far.
c) when people search on the list archives in the months and years to come 
they would have one complete thread with the problem and solution that they 
can refer to.

But as you have started a new thread you shouldn't assume people have read 
your previous threads and know about whatever problems you may have. Thus you 
should state your problem clearly and explicitly.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
It's union rules. There's nothing we can do about it. Sorry.
*/


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




[PHP] Going Crazy Logic.

2002-06-02 Thread r

Hi PPL,
Please see if you can solve this problem as its driving me crazy..its for a
small affiliate program.

I have a table with the folling structure:
** table stats(Id bigint,Month tinyint,Year int,Hits bigint)



The client will be given a link like this
** http://mysite.com/affiliates/hit.php?id=155



then this will execute in the script (the connection part is done)
** update table stats set hits=hits+1 where Id=$Id and MONTH(now())=Month
and YEAR(current_date)=Year

/*The logic in the above is that I am updating hits by one only if month
and Year match up, so I can track which affiliate has given me the most
traffic, just 12 records for each client per year and excellient dynamic
tracking..? */



but if the fields Month or Year do not match the update will not work
and will not return anything right? so I want to execute this SQL then
** insert into stats values($Id,MONTH(now()),YEAR(CURRENT_DATE),1)


Either i'm brain dead,tired,dumb,just overworked, or this one great
problembut I cant figure it out..

Any help appreciated, thanks in advance.
-Ryan.


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




Re: [PHP] Global vars

2002-06-02 Thread Philip Olson


global $var; does nothing outside of a function.  You 
do not need to use global for this.

$foo = 'bar';
include 'something_that_uses_foo.inc';

http://www.php.net/manual/en/language.variables.scope.php

regards,
Philip Olson


On Sun, 2 Jun 2002, Anzak Wolf wrote:

 I have a question about global vars.  Why is it that I have to declare a var 
 global if I'm using it across included files.  For example the only why I 
 can get this var to work is by making it global.
 
 main.php
 ?php
 include loader.inc;
 include builder.inc;
 include render.inc;
 ?
 
 loader.inc
 ?php
 global $obj;
 $obj = new Whiz_bang();
 ?
 
 builder.inc
 ?php
 global $obj;
 $obj-build_whizzer();
 ?
 
 render.inc
 ?php
 render-html();
 ?
 
 considering that if you took the could and just inserted the code form the 
 included files into the main you would not need to make the var global why 
 is that I need to when I cross files.  I don't think I have  read a good 
 reasoning for this anywhere.  My goal is simple to use as few global vars as 
 possible which is why I ask.
 
 _
 Send and receive Hotmail on your mobile device: http://mobile.msn.com
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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




RE: [PHP] Going Crazy Logic.

2002-06-02 Thread John Holmes

MySQL_affected_rows()

---John Holmes...

 -Original Message-
 From: r [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, June 02, 2002 3:39 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Going Crazy Logic.
 
 Hi PPL,
 Please see if you can solve this problem as its driving me crazy..its
for
 a
 small affiliate program.
 
 I have a table with the folling structure:
 ** table stats(Id bigint,Month tinyint,Year int,Hits bigint)
 
 
 
 The client will be given a link like this
 ** http://mysite.com/affiliates/hit.php?id=155
 
 
 
 then this will execute in the script (the connection part is done)
 ** update table stats set hits=hits+1 where Id=$Id and
MONTH(now())=Month
 and YEAR(current_date)=Year
 
 /*The logic in the above is that I am updating hits by one only if
 month
 and Year match up, so I can track which affiliate has given me the
most
 traffic, just 12 records for each client per year and excellient
dynamic
 tracking..? */
 
 
 
 but if the fields Month or Year do not match the update will not
work
 and will not return anything right? so I want to execute this SQL then
 ** insert into stats values($Id,MONTH(now()),YEAR(CURRENT_DATE),1)
 
 
 Either i'm brain dead,tired,dumb,just overworked, or this one great
 problembut I cant figure it out..
 
 Any help appreciated, thanks in advance.
 -Ryan.
 
 
 --
 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




[PHP] Thumb Drive Web Server?

2002-06-02 Thread John Holmes

Maybe a little off-topic, but does anyone have one of those USB thumb
drives? Is it possible to load up Apache, PHP, and MySQL onto one of
them? If you stripped things down, could it be installed on a 64MB drive
(with a little space left over for MySQL data and PHP scripts)? Does
anyone know if this works?
 
It seems like this would be a great way to give presentations and demos
of scripts you wrote. Just plug it into their USB port and show them
what you made.
 
Thanks for any info.
 
---John Holmes.



[PHP] php sessions

2002-06-02 Thread Michal Dvoracek

Hello,

i'm using sessions in my application but i found something strange.

when creating new session:

define('S_USER', 0);
define('S_USER_ID', 0);
define('S_USER_NAME', 1);

session_start();
$_SESSION[S_USER][S_USER_ID] = 1;
$_SESSION[S_USER][S_USER_NAME] = 'Michal';

when redirect on next page - session is empty but when a change first define to:
define('S_USER', 'user');

everything works ok.

So in session isn't possible use numeric indexes ?

Regards,
Michal Dvoracek  [EMAIL PROTECTED]

Sorry if this question was here answered.


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




[PHP] cant start apache after compiling PHP with LDAP

2002-06-02 Thread Andy

Hi there,

I did configure php with ldap and everything worked fine!

Then I stoped apache and started it. This cause folloving error:

Syntax error on line 205 of /usr/local/apache/conf/httpd.conf:
Cannot load /usr/local/apache/libexec/libphp4.so into server:
/usr/local/apache/libexec/libphp4.so: undefined symbol: ldap_first_reference
/usr/local/apache/bin/apachectl start: httpd could not be started

Can anybody help me in this case?

Any help is appreciated,

Andy



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




[PHP] still running the old version after recompiling??

2002-06-02 Thread Andy

Hi there,

I did recompile php with different flags. Phpinfo() tells me that I am still
running the old insatllation! I did restart apache after compiling. So whats
wrong. Did I forget something?

I did
configure with some flags
make
make install

restart apache

Thanx for any help,

Andy





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




Re: [PHP] still running the old version after recompiling??

2002-06-02 Thread Jason Wong

On Sunday 02 June 2002 17:32, Andy wrote:
 Hi there,

 I did recompile php with different flags. Phpinfo() tells me that I am
 still running the old insatllation! I did restart apache after compiling.
 So whats wrong. Did I forget something?

 I did
 configure with some flags
 make
 make install

 restart apache

1) To avoid any complications I always compile from a freshly unpacked tar.gz.
2) Stop apache before doing make install (not sure whether it makes any 
difference but it doesn't hurt to do so).

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
There are two ways of disliking poetry; one way is to dislike it, the
other is to read Pope.
-- Oscar Wilde
*/


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




Re: [PHP] Alguine me puede Ayudar...S.O.S...mi PHP no sube .....

2002-06-02 Thread Michael Hall


Hola:

Tienes la misma version de PHP en el servidor Win98?

Sabes que hay diferencias importantes en versiones de PHP mas de 4.1.0
(creo ... seguramente, mas de 4.2.0)? Estas diferencias tienen que ver con 
'arrays' superglobales y 'register globals' etc.

Puede ser que una programa PHP que se escribio con version 4.0.1 por
ejemplo no funcionara con version 4.2.1 sin cambios al codigo o al
servidor.

Miguel 


On Sun, 2 Jun 2002 [EMAIL PROTECTED] wrote:

 Hola
  Resulta que tengo problemas para que funcione PHP en un
 servidor NT 4.0 con IIS 3.0 y este no funciona PHP ver. 4.2.1) ya que al
 hacer alguno de los ejemplos que adjunte (codigos) ninguno funciona.
 Hicela prueba con Apache/Win98/PHP y ahí me funciono.
 No entinedo que es lo que pasa?; ademas segui instruciones de
 la pagina Web http://www.php.net/manual/fi/configuration.php y aun asi no
 Funciono.
   Si alguien me puede Ayudar se lo agradecería, ya que esto me tiene
 muy complicado.
 
 Saludos.
 Oscar Mora
 
 PD: Con este codigo, hago test con una pagina llamada prueba.php y me di
 cuenta de que en NT no funcionó, pero si en W98.
 
 ?php $myvar = Hola. Este es mi primer script en PHP \n;
 //es mi primer script en PHP \n;
 echo $myvar; ?
 BR
 trtdForma 1/a/td
 ? echo Hola, este es un mensaje de Prueba con PHP; ?
 BR
 trtdForma 2/a/td
 ?php echo Hola, este es un mensaje de Prueba con PHP;?
 BR
 trtdForma 3/a/td
 script language=php echo Hola, este es un mensaje de
 Prueba
 con PHP; /script
 BR
 trtdForma4/a/td
 % echo Hola, este es un mensaje de Prueba con PHP; %
 BRBR
 ? php phpinfo() ?
 
 
 

-- 

n   i   n   t   i  .   c   o   m
php-python-perl-mysql-postgresql

Michael Hall [EMAIL PROTECTED]



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




[PHP] Smart URLs

2002-06-02 Thread Scott 'INtense!' Reismanis

Hey all,

I was recently trying my luck at dabbling in some mod_rewrite
stuff, and I have run into numerious errors. Basically my aim is to
re-write my sites URLs so instead of being say,
mysite.com/thumbnails?type=funnygallery=4 the URL is neat, similar to
many sites who would have something like mysite.com/thumbnails/funny/4

What ways are there of achieving this (excluding, redirecting the URL
and creating the page say index.htm automatically)? I have tried
mod_rewrite for two days solid to no avail. I am not sure if it is my
poor coding or the fact that I am running apache2 on a Windows platform
which are said not to support such a module well. If any alternatives
could be proposed or even better someone could suggest a mod_rewrite
routine which would transparently transform any url like
mysite.com/whatever/4/6 to mysite.com/whatever.php it would be greatly
appreciated. So far the rewrite you see below will work with
mysite.com/whatever/ however the minute you add something onto the end
i.e. mysite.com/whatever/4/ it will raise the error Premature end of
script headers: php.exe, instead of loading whatever.php as intended.

RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteRule ^/(.+)/(.+) $1.php [L]

Thanks for your time and hopefully someone understands what I am trying
to say :), and as always any suggestions at all would be awesome!

Regards,
 
 
   Scott 'INtense!' Reismanis
   Mod Database System Administrator
   [EMAIL PROTECTED]
   http://www.moddb.com/ - Every Game, Every Mod, One
Site... Go Figure!




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




Re: [PHP] massive words

2002-06-02 Thread Michael Davey

Also, if you are really worried about placing too much load on the server,
you could use JavaScript to check the form submission on the client side
using the same technique...

Mikey

Bogdan Stancescu [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 First, you don't need to explode and then implode - just use a different
 var for the exploded array and use the original after the test.

 My suggestion for testing (but you really must test it and see if it's
 faster or slower than your method) is using wordwrap() with your max
 word length and then check if any line is longer than your max allowed
 length. The advantage may be that you probably use 10-15 as the max
 length in real life and you would skip quite a few checks because you're
 going to end up with several words on a typical line. I guess it *might*
 be slightly fatser because wordwrap() is native to PHP - the job however
 is more complicated, so you may end up with a slower version than your
 current one.

 Bogdan

 Justin French wrote:

 hi all,
 
 looking for some advice on the best way to approach this:
 
 i have a guestbook running on a few sites, and occasionally we get
 creative people who think it's a good idea to post messages with really
 long words or URLs into the text, which totally mess up the layout of the
 page.
 
 what I need is an efficient way of checking the input for extremely long
 words (say about 60-odd characters +)
 
 I assume I just split the input by   (space) into an array, and check
that
 each word isn't longer than 60 chars, but this seems like a lot of work
 for the server... although I am limiting the entire input to 2000 chars,
so
 maybe this isn't too much work for the server?
 
 
 this is what I'm using:
 ?
 $word_length = 5;
 $error = 0;
 
 $str = cat dog bird mouse elephant; // illegal
 $str = explode( , $str);
 
 foreach($str as $key = $word)
 {
 if(strlen($word)  $word_length)
 { $error = 1; }
 }
 if($error)
 { echo sorry; }
 else
 {
 $str = implode( , $str);
 echo $str.BR;
 }
 ?
 
 any ways to improve it?
 
 
 Justin
 
 
 
 






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




[PHP] Payflow Extension Support

2002-06-02 Thread Justin Felker

Does anyone know exactly what the status is on the Verisign Payflow Pro 
support for Windows?  I've read the manual and all the user submitted 
comments.  I keep seeing some reference made to a php_pfpro.dll that 
doesn't seem to exist.  Is it still in development?

It seems most people just exec() the PFPRO.exe, passing the arguments on 
the command line.  This seems less than ideal and I would much rather use 
straight API calls if I can.

For anyone else in this situation, what was the best 
solution?  Unfortunately, I am tied pretty much to Windows for the 
forseeable future.  What about coding a Java object to do the dirty work 
and letting PHP interact with it?

By the way, where is a good place to find out the status on current 
development on the PHP language?

Thanks!

Justin


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




Re: [PHP] Smart URLs

2002-06-02 Thread Andrew Brampton

You can do this with just PHP, but I think php must be installed as a
module.
Basically place a file called thumbnails.php in your site route, then
whenever a URL like
mysite.com/thumbnails/funny/4
i called the thumbnails.php is excuted, in which you chop up the URL, and
find all your varibles...

Here is a example of some URL chopping (some code I stole from my source)
/*
Sample URLs:
/s/1/2/SchoolName/StudentName/ -Shows Student Page (with ID 2)
/s/1/0/SchoolName/-Shows Students At School (with school ID 1)
/s/1/2/   -would work as well (name in URL for search engines)
/s/1/0/   -would work as well
/s/-Shows Schools
*/

$url_array=explode(/,$REQUEST_URI);  //BREAK UP THE URL PATH
   //USING '/' as delimiter
if ($url_array[1] == 's')
 {
 if (isSet($url_array[2]))
  $url_sID=$url_array[2];  //School ID
 if (isSet($url_array[3]))
  $url_stID=$url_array[3];//Student ID
 if (isSet($url_array[4]))
  $url_sName=$url_array[4];  //School Name (not used)
 if (isSet($url_array[5]))
  $url_stName=$url_array[5];//Student Name (not used)
 }
/*

There was a article on phpbuilder.com that explains the benefits and
pitfalls of this idea... Here is the URL:
http://www.phpbuilder.com/columns/tim19990117.php3 and I think there was a
follow up article as well

Enjoy
Andrew

- Original Message -
From: Scott 'INtense!' Reismanis [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, June 03, 2002 5:28 AM
Subject: [PHP] Smart URLs


 Hey all,

 I was recently trying my luck at dabbling in some mod_rewrite
 stuff, and I have run into numerious errors. Basically my aim is to
 re-write my sites URLs so instead of being say,
 mysite.com/thumbnails?type=funnygallery=4 the URL is neat, similar to
 many sites who would have something like mysite.com/thumbnails/funny/4

 What ways are there of achieving this (excluding, redirecting the URL
 and creating the page say index.htm automatically)? I have tried
 mod_rewrite for two days solid to no avail. I am not sure if it is my
 poor coding or the fact that I am running apache2 on a Windows platform
 which are said not to support such a module well. If any alternatives
 could be proposed or even better someone could suggest a mod_rewrite
 routine which would transparently transform any url like
 mysite.com/whatever/4/6 to mysite.com/whatever.php it would be greatly
 appreciated. So far the rewrite you see below will work with
 mysite.com/whatever/ however the minute you add something onto the end
 i.e. mysite.com/whatever/4/ it will raise the error Premature end of
 script headers: php.exe, instead of loading whatever.php as intended.

 RewriteEngine On
 Options +FollowSymlinks
 RewriteBase /
 RewriteRule ^/(.+)/(.+) $1.php [L]

 Thanks for your time and hopefully someone understands what I am trying
 to say :), and as always any suggestions at all would be awesome!

 Regards,


Scott 'INtense!' Reismanis
Mod Database System Administrator
[EMAIL PROTECTED]
http://www.moddb.com/ - Every Game, Every Mod, One
 Site... Go Figure!




 --
 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] Include question

2002-06-02 Thread Bogdan Stancescu

You're right, that wouldn't prove my point. However, you might try a 
little piece of code like the following:

?
  $a=foo;
  $b=bar;
  $c=foobar;
  if ($a==foo) {
include($b.php);
  } else {
include($c.php);
  }
?

I hope this proves that includes are included at runtime because PHP 
wouldn't know what $b and $c are beforehand. Apart from that, I'm 
positive I read about it in a man page, but can't recall which, that's 
why I didn't direct you to it ;-)

Bogdan

John Holmes wrote:

The global var wouldn't work. Even if both are loaded into memory before
the script is ran, only one include will actually be executed along with
the code, so only one would end up affecting a global var either way. 

What I'm looking at is if each include .html file is 50K, am I loading
100K into memory and then running the script, or running the script and
only loading the appropriate 50K into memory when it's needed?

---John Holmes...

  

-Original Message-
From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]]
Sent: Saturday, June 01, 2002 11:12 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Include question

Your second guess. But you could've tested it easily with two includes
appending stuff to the same global var.

Bogdan

John Holmes wrote:



Hi. When I've got code like the following:

if($this) { include(this.html); }
elseif($that) { include(that.html); }

When are the includes() evaluated? Does the Zend engine do the
  

includes
  

first, pull in all of the code, then process it and produce output.
  

Or
  

does the engine start processing the code and only load the includes
when it gets to them?

Thanks for any explanations.

---John Holmes.



  




  





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




php-general Digest 2 Jun 2002 13:13:58 -0000 Issue 1381

2002-06-02 Thread php-general-digest-help


php-general Digest 2 Jun 2002 13:13:58 - Issue 1381

Topics (messages 100265 through 100309):

PHP Coding Problem
100265 by: Christopher J. Crane

Re: New to PHP- Form Validation Logic/Design Question
100266 by: John Holmes

Re: help meS.O.S...my php doesn't ascend
100267 by: John Holmes

Re: Newman Says: Only one value from a msSQL field.
100268 by: Leif K-Brooks
100269 by: John Holmes

Include question
100270 by: John Holmes
100274 by: Bogdan Stancescu
100280 by: John Holmes
100309 by: Bogdan Stancescu

Determine overhead of PHP script.
100271 by: John Holmes
100273 by: Bogdan Stancescu

massive words
100272 by: Justin French
100275 by: Bogdan Stancescu
100278 by: Justin French
100306 by: Michael Davey

Baffled, line producing error
100276 by: Craig Vincent
100279 by: Jonathan Rosenberg
100283 by: John Holmes
100285 by: Craig Vincent
100288 by: Philip Olson
100289 by: Craig Vincent

Re: displaying client IP address
100277 by: Bogdan Stancescu

Re: Problems with upload
100281 by: Aaron Ott

simple email validation ereg
100282 by: Justin French
100284 by: Clay Loveless

Re: Apache, html, php and global variables
100286 by: Peter Goggin
100287 by: John Holmes
100290 by: Jason Wong
100291 by: John Holmes

Global vars
100292 by: Anzak Wolf
100297 by: Philip Olson

Alguine me puede Ayudar...S.O.S...mi PHP no sube .
100293 by: omora.arauco.cl
100294 by: omora.arauco.cl
100304 by: Michael Hall

Re: Problems with Multi-Uploads (AGAIN)
100295 by: Jason Wong

Going Crazy Logic.
100296 by: r
100298 by: John Holmes

Thumb Drive Web Server?
100299 by: John Holmes

php sessions
100300 by: Michal Dvoracek

cant start apache after compiling PHP with LDAP
100301 by: Andy

still running the old version after recompiling??
100302 by: Andy
100303 by: Jason Wong

Smart URLs
100305 by: Scott 'INtense!' Reismanis
100308 by: Andrew Brampton

Payflow Extension Support
100307 by: Justin Felker

Administrivia:

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

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

To post to the list, e-mail:
[EMAIL PROTECTED]


--

---BeginMessage---

Here is a piece of code, that is close to doing what I want it to.
The end result I would like to have is an array that is simple to work with.
If the XML tag was issue-nameRED HAT/issue-name, I would like something
like the following:

$Tags['issue-name']. So I could print it out. Something like, print
$Tags['issue-name']br\n;

I was able to get a numerical representation of the array like, $Tags[5] and
the value of that tag was RED HAT, but then I would have to know what the
position of the data I am looking for in the array. I would prefer to know
the tag name and the array and get to the data that way. I know there is a
way to do this, but I just can't figure it out. There is a lot of
information on Parsing the XML file but not getting into a useful array, or
at least that I have found easily to understand.


if(!isset($Sym)) { $Sym = 'IKN'; }
$URI = 'http://quotes.nasdaq.com/quote.dll?page=xmlmode=stocksymbol=';
$simple = implode( '', file($URI$Sym));

$p = xml_parser_create();
xml_parse_into_struct($p,$simple,$vals,$index);
xml_parser_free($p);
file://echo Index array\n;
file://print_r($index);
file://echo \nVals array\n;
file://print_r($vals);






---End Message---
---BeginMessage---

if($REQUEST_METHOD == post)
{
  //do validation of data
  if($validated == yes)
  {
//do queries
  }
  else
  { 
echo not validated; 
include(form.html);
  }
}
else
{include(form.html);}

Maybe that'll work. I'm trying to follow your logic. That will check for
the request method first. If it's POST, go on to validation. If it's not
POST, show the form. If the validation succeeds (validation == yes),
then do your queries, otherwise give an error message and show the form
again. 

Works?

---John Holmes...

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, June 01, 2002 5:11 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] New to PHP- Form Validation Logic/Design Question
 
 
 I am *very* new to PHP  am trying to write a tool where a user can
add
 books to a library MySQL database.
 
 The user fills out an HTML form. I do some form validation  if the
form
 entries are ok, I need to run some SQL queries using the form
variables.
 
 I have the HTML form posting back to itself to do the error checking.
The
 part I am unclear on is how to handle the SQL queries.
 
 I was thinking that if the user filled out the form correctly, I could
 redirect to a 

[PHP] mail ( ) and $to

2002-06-02 Thread Henry

just installed the win32 cgi 4.2.1 last night and discovered this strange thing with 
the $to string
in the mail function.

it crashes and gives me a Server Error Warning.

where usually i could go:
$to = Mary[EMAIL PROTECTED] ;

now it wants:
$to = [EMAIL PROTECTED] ;

$from formatting is ok though.

what's happening here?

cheers
Henry




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




Re: [PHP] still running the old version after recompiling??

2002-06-02 Thread Andy

Hello Jason,

you have been right, I did a new one on a fresh php untared dir. And the new
php install is recognized.

But I am still fighting with the installation. I need freetype2 and I did
configure it ok, compiled freetype, gd2 but still I am getting a:
function: imagettfbbox()  not found

Php did not complain about not finding freetype. Maybe php compiled with
freetype 1 but how come?
This drives me cracy! I did install php on several machines at home running
the same operating system like my provider is offering. It always worked
fine.

do u have a good advice?

Thank you for your help,

Andy




Jason Wong [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Sunday 02 June 2002 17:32, Andy wrote:
  Hi there,
 
  I did recompile php with different flags. Phpinfo() tells me that I am
  still running the old insatllation! I did restart apache after
compiling.
  So whats wrong. Did I forget something?
 
  I did
  configure with some flags
  make
  make install
 
  restart apache

 1) To avoid any complications I always compile from a freshly unpacked
tar.gz.
 2) Stop apache before doing make install (not sure whether it makes any
 difference but it doesn't hurt to do so).

 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *

 /*
 There are two ways of disliking poetry; one way is to dislike it, the
 other is to read Pope.
 -- Oscar Wilde
 */




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




Re: [PHP] Apache, html, php and global variables

2002-06-02 Thread Peter Goggin

I certainly read your reply and tried it with the session_start as the first
line of the php secion. I have since remove the HTML etc.   The script
appears to work with out error .

I was able to set session vars etc and the script completed with out error
and the session vars could be printed out at the end of the script.

I then called another php script from my menu frame and was not able to find
the _session vars which showed as blanks. I put the session_start() as first
line of php block but this still did not make it possible to read the
session vars.

Do I need to use names sessions or what?  Is there some setting that is
required in the php.ini or apache to make this work?


As I stated at the beigining of the e-mail saga what i want to be able to do
is to set global variables which will be available to any php script. In
particular i want to ensure that each user has an individual connection to
data abse and that this is maintained through out the session. I have set
the connection up to use the mysql_pconnect function, but I still need to
reconnect in every script which uses the database.  I therefore need to be
able to caryy the username/password from onepage to the next.

Is the start_session and session variables the corect way to do this or is
there a better way?

Regards

Peter Goggin
- Original Message -
From: John Holmes [EMAIL PROTECTED]
To: 'Peter Goggin' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Sunday, June 02, 2002 3:31 PM
Subject: RE: [PHP] Apache, html, php and global variables


 Did you read my reply at all? Call session_start() before any output to
 the browser.

 ---John Holmes...

  -Original Message-
  From: Peter Goggin [mailto:[EMAIL PROTECTED]]
  Sent: Sunday, June 02, 2002 1:20 AM
  To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Subject: Re: [PHP] Apache, html, php and global variables
 
  My script is:
  html
  body
  ?php
  session_start();
  printf(P loggin on as );
  printf (Puser name: );
  printf ($HTTP_POST_VARS['User']);
  printf (PPassword: );printf ($HTTP_POST_VARS['Password']);
  printf (P);
 
 
  /* Connecting, selecting database */
  $link = mysql_pconnect(localhost, $HTTP_POST_VARS['User'],
  $HTTP_POST_VARS['Password'])
  or die(Could not connect);
  print Connected successfullyP;
  printf (BR);
  print Setting Global variablesBR;
  $_SESSION_VARS[dbauser]=($HTTP_POST_VARS['User']);
  $_SESSION_VARS[dbapassword]=($HTTP_POST_VARS['Password']);
  printf ($_SESSION_VARS[dbauser]);
  printf (BR);
  printf ($_SESSION_VARS[dbapassword],BR);
  ?
  P
  /body
  /html
The errors I get are:
  Warning: Cannot send session cookie - headers already sent by (output
  started at c:\usr\www\my-domain\databaselogin.php:3) in
  c:\usr\www\my-domain\databaselogin.php on line 4
 
  Warning: Cannot send session cache limiter - headers already sent
 (output
  started at c:\usr\www\my-domain\databaselogin.php:3) in
  c:\usr\www\my-domain\databaselogin.php on line 4
 
  loggin on as
 
  user name: stampuser
 
  Password: vantwest
 
  Connected successfully
 
 
  Obviously I have something not configured correctly, or I am calling
 the
  function in the wrong place.  Any advice on how to overcome this would
 be
  very useful.
 
 
  Regards
 
 
  Peter Goggin
 
  - Original Message -
  From: John Holmes [EMAIL PROTECTED]
  To: 'Peter Goggin' [EMAIL PROTECTED]; php-
  [EMAIL PROTECTED]
  Sent: Sunday, June 02, 2002 12:09 AM
  Subject: RE: [PHP] Apache, html, php and global variables
 
 
   Sessions use cookies, which use headers, which have to be sent
 before
   any output. html is output. So, put session_start() before that.
  
   ?
   Session_start();
  
   ...
  
   ?
   html
   body
   ...
  
   Where are you putting dbauser and dbapassword into the session?
  
   Your sessions still aren't going to work because the
 session.save_path
   isn't set correctly in your PHP.ini. Set it to a directory on your
   computer that the web server has access to write to.
  
   ---John Holmes...
  
-Original Message-
From: Peter Goggin [mailto:[EMAIL PROTECTED]]
Sent: Saturday, June 01, 2002 9:54 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] Apache, html, php and global variables
   
I am not clear what you mean by this. I have set session_start()
 on in
   the
php script that logs onto the database initially.  i then call a
 test
   php
script from a button on the menu frame. This is the output it
 gives:
   
Test php variables
   
Warning: Cannot send session cookie - headers already sent by
 (output
started at c:\usr\www\my-domain\maintenance.php:4) in
c:\usr\www\my-domain\maintenance.php on line 5
   
Warning: Cannot send session cache limiter - headers already sent
   (output
started at c:\usr\www\my-domain\maintenance.php:4) in
c:\usr\www\my-domain\maintenance.php on line 5
   
Warning: 

Re: [PHP] Smart URLs

2002-06-02 Thread Adrian Murphy

 whenever a URL like
 mysite.com/thumbnails/funny/4
 i called the thumbnails.php is excuted, in which you

I think if you call it thumbnails.php it won't work.
however if the script is simply called thumbnails then it'll
work.of course you then must make sure that 'thumbnails'
is parsed as php.do this with a .htaccess file :

Files thumbnails
ForceType application/x-httpd-php
/Files

- Original Message -
From: Andrew Brampton [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Sunday, June 02, 2002 1:20 PM
Subject: Re: [PHP] Smart URLs


 You can do this with just PHP, but I think php must be installed as a
 module.
 Basically place a file called thumbnails.php in your site route, then
 whenever a URL like
 mysite.com/thumbnails/funny/4
 i called the thumbnails.php is excuted, in which you chop up the URL, and
 find all your varibles...

 Here is a example of some URL chopping (some code I stole from my source)
 /*
 Sample URLs:
 /s/1/2/SchoolName/StudentName/ -Shows Student Page (with ID 2)
 /s/1/0/SchoolName/-Shows Students At School (with school ID 1)
 /s/1/2/   -would work as well (name in URL for search engines)
 /s/1/0/   -would work as well
 /s/-Shows Schools
 */

 $url_array=explode(/,$REQUEST_URI);  //BREAK UP THE URL PATH
//USING '/' as delimiter
 if ($url_array[1] == 's')
  {
  if (isSet($url_array[2]))
   $url_sID=$url_array[2];  //School ID
  if (isSet($url_array[3]))
   $url_stID=$url_array[3];//Student ID
  if (isSet($url_array[4]))
   $url_sName=$url_array[4];  //School Name (not used)
  if (isSet($url_array[5]))
   $url_stName=$url_array[5];//Student Name (not used)
  }
 /*

 There was a article on phpbuilder.com that explains the benefits and
 pitfalls of this idea... Here is the URL:
 http://www.phpbuilder.com/columns/tim19990117.php3 and I think there was a
 follow up article as well

 Enjoy
 Andrew

 - Original Message -
 From: Scott 'INtense!' Reismanis [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, June 03, 2002 5:28 AM
 Subject: [PHP] Smart URLs


  Hey all,
 
  I was recently trying my luck at dabbling in some mod_rewrite
  stuff, and I have run into numerious errors. Basically my aim is to
  re-write my sites URLs so instead of being say,
  mysite.com/thumbnails?type=funnygallery=4 the URL is neat, similar to
  many sites who would have something like mysite.com/thumbnails/funny/4
 
  What ways are there of achieving this (excluding, redirecting the URL
  and creating the page say index.htm automatically)? I have tried
  mod_rewrite for two days solid to no avail. I am not sure if it is my
  poor coding or the fact that I am running apache2 on a Windows platform
  which are said not to support such a module well. If any alternatives
  could be proposed or even better someone could suggest a mod_rewrite
  routine which would transparently transform any url like
  mysite.com/whatever/4/6 to mysite.com/whatever.php it would be greatly
  appreciated. So far the rewrite you see below will work with
  mysite.com/whatever/ however the minute you add something onto the end
  i.e. mysite.com/whatever/4/ it will raise the error Premature end of
  script headers: php.exe, instead of loading whatever.php as intended.
 
  RewriteEngine On
  Options +FollowSymlinks
  RewriteBase /
  RewriteRule ^/(.+)/(.+) $1.php [L]
 
  Thanks for your time and hopefully someone understands what I am trying
  to say :), and as always any suggestions at all would be awesome!
 
  Regards,
 
 
 Scott 'INtense!' Reismanis
 Mod Database System Administrator
 [EMAIL PROTECTED]
 http://www.moddb.com/ - Every Game, Every Mod, One
  Site... Go Figure!
 
 
 
 
  --
  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



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




RE: [PHP] Apache, html, php and global variables

2002-06-02 Thread John Holmes

Page1:

?
Session_start();
$_SESSION['dbauser'] = john;
$_SESSION['dbapassword'] = password;
?
html
body
Variables set
/body
/html

Page2:
?
Session_start();
?
html
body
User: ?=$_SESSION['dbauser']?
Password: ?=$_SESSION['dbapassword']?
/body
/html

Does that work for you?

Normally all PHP scripts just use the same username and password for the
database. You create a web user that's used in the scripts. I don't
know if you don't want to / can't do this. 

Just a simple script like this:

?
MySQL_connect(localhost,user,password);
MySQL_select_db(db_name);
?

Name that database.php and include it at the beginning of every script
and you've got a database connection in every script. 

---John Holmes...

 -Original Message-
 From: Peter Goggin [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, June 02, 2002 9:54 AM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: [PHP] Apache, html, php and global variables
 
 I certainly read your reply and tried it with the session_start as the
 first
 line of the php secion. I have since remove the HTML etc.   The script
 appears to work with out error .
 
 I was able to set session vars etc and the script completed with out
error
 and the session vars could be printed out at the end of the script.
 
 I then called another php script from my menu frame and was not able
to
 find
 the _session vars which showed as blanks. I put the session_start() as
 first
 line of php block but this still did not make it possible to read the
 session vars.
 
 Do I need to use names sessions or what?  Is there some setting that
is
 required in the php.ini or apache to make this work?
 
 
 As I stated at the beigining of the e-mail saga what i want to be able
to
 do
 is to set global variables which will be available to any php script.
In
 particular i want to ensure that each user has an individual
connection to
 data abse and that this is maintained through out the session. I have
set
 the connection up to use the mysql_pconnect function, but I still need
to
 reconnect in every script which uses the database.  I therefore need
to be
 able to caryy the username/password from onepage to the next.
 
 Is the start_session and session variables the corect way to do this
or is
 there a better way?
 
 Regards
 
 Peter Goggin
 - Original Message -
 From: John Holmes [EMAIL PROTECTED]
 To: 'Peter Goggin' [EMAIL PROTECTED]; php-
 [EMAIL PROTECTED]
 Sent: Sunday, June 02, 2002 3:31 PM
 Subject: RE: [PHP] Apache, html, php and global variables
 
 
  Did you read my reply at all? Call session_start() before any output
to
  the browser.
 
  ---John Holmes...
 
   -Original Message-
   From: Peter Goggin [mailto:[EMAIL PROTECTED]]
   Sent: Sunday, June 02, 2002 1:20 AM
   To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
   Subject: Re: [PHP] Apache, html, php and global variables
  
   My script is:
   html
   body
   ?php
   session_start();
   printf(P loggin on as );
   printf (Puser name: );
   printf ($HTTP_POST_VARS['User']);
   printf (PPassword: );printf ($HTTP_POST_VARS['Password']);
   printf (P);
  
  
   /* Connecting, selecting database */
   $link = mysql_pconnect(localhost, $HTTP_POST_VARS['User'],
   $HTTP_POST_VARS['Password'])
   or die(Could not connect);
   print Connected successfullyP;
   printf (BR);
   print Setting Global variablesBR;
   $_SESSION_VARS[dbauser]=($HTTP_POST_VARS['User']);
   $_SESSION_VARS[dbapassword]=($HTTP_POST_VARS['Password']);
   printf ($_SESSION_VARS[dbauser]);
   printf (BR);
   printf ($_SESSION_VARS[dbapassword],BR);
   ?
   P
   /body
   /html
 The errors I get are:
   Warning: Cannot send session cookie - headers already sent by
(output
   started at c:\usr\www\my-domain\databaselogin.php:3) in
   c:\usr\www\my-domain\databaselogin.php on line 4
  
   Warning: Cannot send session cache limiter - headers already sent
  (output
   started at c:\usr\www\my-domain\databaselogin.php:3) in
   c:\usr\www\my-domain\databaselogin.php on line 4
  
   loggin on as
  
   user name: stampuser
  
   Password: vantwest
  
   Connected successfully
  
  
   Obviously I have something not configured correctly, or I am
calling
  the
   function in the wrong place.  Any advice on how to overcome this
would
  be
   very useful.
  
  
   Regards
  
  
   Peter Goggin
  
   - Original Message -
   From: John Holmes [EMAIL PROTECTED]
   To: 'Peter Goggin' [EMAIL PROTECTED]; php-
   [EMAIL PROTECTED]
   Sent: Sunday, June 02, 2002 12:09 AM
   Subject: RE: [PHP] Apache, html, php and global variables
  
  
Sessions use cookies, which use headers, which have to be sent
  before
any output. html is output. So, put session_start() before
that.
   
?
Session_start();
   
...
   
?
html
body
...
   
Where are you putting dbauser and dbapassword into the session?
   
Your sessions still aren't going to work because the
  session.save_path
isn't set correctly 

Re[2]: [PHP] Apache, html, php and global variables

2002-06-02 Thread Stuart Dallas

On Sunday, June 2, 2002 at 2:53:30 PM, you wrote:
 I certainly read your reply and tried it with the session_start as the first
 line of the php secion. I have since remove the HTML etc.   The script
 appears to work with out error .

session_start must be called before any output in the script, not just in the
PHP section. The easiest way to do this is to have the following as the first
line in each script...

?php start_session(); ?

 I was able to set session vars etc and the script completed with out error
 and the session vars could be printed out at the end of the script.

 I then called another php script from my menu frame and was not able to find
 the _session vars which showed as blanks. I put the session_start() as first
 line of php block but this still did not make it possible to read the
 session vars.

Where is the session started? In the frameset page, or in one of the frames?
Basically, a link to a page that uses the session should be created by a
script that also calls start_session().

 Do I need to use names sessions or what?  Is there some setting that is
 required in the php.ini or apache to make this work?

I think your main problem is that you are not using the correct name for the
session array. You are using $_SESSION_VARS which is a mix between the two
options which are $HTTP_SESSION_VARS and $_SESSION. $_SESSION is the one you
should be using since $HTTP_SESSION_VARS is deprecated.

 Is the start_session and session variables the corect way to do this or is
 there a better way?

Not really. Sessions are the established way of persisting data across page
requests.

-- 
Stuart


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




[PHP] lots of trouble installing php on linux

2002-06-02 Thread Andy

Hi there,

I am having trouble to get a php installations working on suse72 with
following configure command:

./configure' '--with-gd=/home/andy/sw/gd-2.0.1' '--with-freetype=/usr/lib'
'--enable-gd-native-ttf' '--enable-gd-imgstrttf' '--with-jpeg-dir=/usr'
'--with-png-dir=/usr/lib' '--with-zlib'
'--with-apxs=/usr/local/apache/bin/apxs' '--with-ftp' '--with-mysql'
'--with-pdflib' '--with-lmap' '--with-gettext=/usr/local/bin' '--with-xml'

Everything is working except freetype, imap, ftp

The php page tells for imap to install a client from washington university,
but is this something like cypress? I am not familar to imap clients, just
want to get new email adresses running on this system. PHP page tells as
follows:

To get these functions to work, you have to compile PHP with --with-imap.
That requires the c-client library to be installed. Grab the latest version
from ftp://ftp.cac.washington.edu/imap/ and compile it.

Then copy c-client/c-client.a to /usr/local/lib/libc-client.a or some other
directory on your link path and copy c-client/*.h to /usr/local/include or
some other directory in your include path.

  Huomaa: Depending how the c-client was configured, you might also need to
add --with-imap-ssl=/path/to/openssl/ and/or --with-kerberos into the PHP
configure line





  Do I need to get this c library too? And cypress? How about ftp and
freetype?

  Thanx for any help,

  Andy




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




RE: [PHP] php sessions

2002-06-02 Thread John Holmes

You have to define the constants on each page. The second page doesn't
know what S_USER, S_USER_ID, or S_USER_NAME are...unless you define them
again.

---John Holmes...

 -Original Message-
 From: Michal Dvoracek [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, June 02, 2002 3:59 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] php sessions
 
 Hello,
 
 i'm using sessions in my application but i found something strange.
 
 when creating new session:
 
 define('S_USER', 0);
 define('S_USER_ID', 0);
 define('S_USER_NAME', 1);
 
 session_start();
 $_SESSION[S_USER][S_USER_ID] = 1;
 $_SESSION[S_USER][S_USER_NAME] = 'Michal';
 
 when redirect on next page - session is empty but when a change first
 define to:
 define('S_USER', 'user');
 
 everything works ok.
 
 So in session isn't possible use numeric indexes ?
 
 Regards,
 Michal Dvoracek  [EMAIL PROTECTED]
 
 Sorry if this question was here answered.
 
 
 --
 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




[PHP] Compilation error

2002-06-02 Thread Richard Fox

Hi,

I am compiling PHP 4.2.0 on a RedHat 7.1 system with mnogosearch 3.2.3. I am
running into a problem that I have not seen on my other RedHat systems with
the same configuration (except Redhat 7.2 instead of 7.1), and that is that
the link does not work because there are some symbols that are multiply
defined. Specifically, ftp_login. The linker tells me that the symbol was
first definied in mnogosearch-3.2.3/src/ftp.c, and also found in
php-4.2.0/ext/ftp/ftp.c (the are other ftp_xx functions multiply defined
also, e.g. ftp_close, ftp_list, same files).

If I remove --ftp_enable from my config then there is no error. I cannot
figure out how to have ftp support in PHP and mnogosearch also! This does
not occur when building PHP on my other RedHat system, where
both --enable-ftp and --with-mnogosearch=/usr/local/mnogosearch are used and
the linker is happy.

Can anyone give some advice? Has anyone encountered the same problem?

Thanks, I'm stuck!

Rich



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




Re: [PHP] Smart URLs

2002-06-02 Thread Andrew Brampton

Hey try it, it works when are running the PHP Module in apache.
I have a server with proxy.php yet I access it via
myserver.com/proxy/whatever and it works with no special changes to the
config files.

Andrew
- Original Message -
From: Adrian Murphy [EMAIL PROTECTED]
To: Andrew Brampton [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Sunday, June 02, 2002 3:24 PM
Subject: Re: [PHP] Smart URLs


  whenever a URL like
  mysite.com/thumbnails/funny/4
  i called the thumbnails.php is excuted, in which you

 I think if you call it thumbnails.php it won't work.
 however if the script is simply called thumbnails then it'll
 work.of course you then must make sure that 'thumbnails'
 is parsed as php.do this with a .htaccess file :

 Files thumbnails
 ForceType application/x-httpd-php
 /Files

 - Original Message -
 From: Andrew Brampton [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Sunday, June 02, 2002 1:20 PM
 Subject: Re: [PHP] Smart URLs


  You can do this with just PHP, but I think php must be installed as a
  module.
  Basically place a file called thumbnails.php in your site route, then
  whenever a URL like
  mysite.com/thumbnails/funny/4
  i called the thumbnails.php is excuted, in which you chop up the URL,
and
  find all your varibles...
 
  Here is a example of some URL chopping (some code I stole from my
source)
  /*
  Sample URLs:
  /s/1/2/SchoolName/StudentName/ -Shows Student Page (with ID 2)
  /s/1/0/SchoolName/-Shows Students At School (with school ID 1)
  /s/1/2/   -would work as well (name in URL for search engines)
  /s/1/0/   -would work as well
  /s/-Shows Schools
  */
 
  $url_array=explode(/,$REQUEST_URI);  //BREAK UP THE URL PATH
 //USING '/' as delimiter
  if ($url_array[1] == 's')
   {
   if (isSet($url_array[2]))
$url_sID=$url_array[2];  //School ID
   if (isSet($url_array[3]))
$url_stID=$url_array[3];//Student ID
   if (isSet($url_array[4]))
$url_sName=$url_array[4];  //School Name (not used)
   if (isSet($url_array[5]))
$url_stName=$url_array[5];//Student Name (not used)
   }
  /*
 
  There was a article on phpbuilder.com that explains the benefits and
  pitfalls of this idea... Here is the URL:
  http://www.phpbuilder.com/columns/tim19990117.php3 and I think there was
a
  follow up article as well
 
  Enjoy
  Andrew
 
  - Original Message -
  From: Scott 'INtense!' Reismanis [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Monday, June 03, 2002 5:28 AM
  Subject: [PHP] Smart URLs
 
 
   Hey all,
  
   I was recently trying my luck at dabbling in some mod_rewrite
   stuff, and I have run into numerious errors. Basically my aim is to
   re-write my sites URLs so instead of being say,
   mysite.com/thumbnails?type=funnygallery=4 the URL is neat, similar to
   many sites who would have something like mysite.com/thumbnails/funny/4
  
   What ways are there of achieving this (excluding, redirecting the URL
   and creating the page say index.htm automatically)? I have tried
   mod_rewrite for two days solid to no avail. I am not sure if it is my
   poor coding or the fact that I am running apache2 on a Windows
platform
   which are said not to support such a module well. If any alternatives
   could be proposed or even better someone could suggest a mod_rewrite
   routine which would transparently transform any url like
   mysite.com/whatever/4/6 to mysite.com/whatever.php it would be greatly
   appreciated. So far the rewrite you see below will work with
   mysite.com/whatever/ however the minute you add something onto the end
   i.e. mysite.com/whatever/4/ it will raise the error Premature end of
   script headers: php.exe, instead of loading whatever.php as intended.
  
   RewriteEngine On
   Options +FollowSymlinks
   RewriteBase /
   RewriteRule ^/(.+)/(.+) $1.php [L]
  
   Thanks for your time and hopefully someone understands what I am
trying
   to say :), and as always any suggestions at all would be awesome!
  
   Regards,
  
  
  Scott 'INtense!' Reismanis
  Mod Database System Administrator
  [EMAIL PROTECTED]
  http://www.moddb.com/ - Every Game, Every Mod, One
   Site... Go Figure!
  
  
  
  
   --
   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
 


 --
 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] php sessions

2002-06-02 Thread Alexander Skwar

Michal Dvoracek wrote:

when creating new session:

define('S_USER', 0);
define('S_USER_ID', 0);
define('S_USER_NAME', 1);

session_start();
$_SESSION[S_USER][S_USER_ID] = 1;
$_SESSION[S_USER][S_USER_NAME] = 'Michal';


Hm, you're defining a session variable called 0?  Because PHP will 
translate the [S_USER] to [0] because S_USER is a constant defined as 0.

PHP doesn't allow variables to start with a digit, and I don't think it 
will work in this case either.


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




Re: [PHP] Smart URLs

2002-06-02 Thread Philip Olson

For tips on doing these things, read this faqt:

  http://www.faqts.com/knowledge_base/view.phtml/aid/124

Regards,
Philip Olson


On Sun, 2 Jun 2002, Andrew Brampton wrote:

 Hey try it, it works when are running the PHP Module in apache.
 I have a server with proxy.php yet I access it via
 myserver.com/proxy/whatever and it works with no special changes to the
 config files.
 
 Andrew
 - Original Message -
 From: Adrian Murphy [EMAIL PROTECTED]
 To: Andrew Brampton [EMAIL PROTECTED]; [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Sent: Sunday, June 02, 2002 3:24 PM
 Subject: Re: [PHP] Smart URLs
 
 
   whenever a URL like
   mysite.com/thumbnails/funny/4
   i called the thumbnails.php is excuted, in which you
 
  I think if you call it thumbnails.php it won't work.
  however if the script is simply called thumbnails then it'll
  work.of course you then must make sure that 'thumbnails'
  is parsed as php.do this with a .htaccess file :
 
  Files thumbnails
  ForceType application/x-httpd-php
  /Files
 
  - Original Message -
  From: Andrew Brampton [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Sent: Sunday, June 02, 2002 1:20 PM
  Subject: Re: [PHP] Smart URLs
 
 
   You can do this with just PHP, but I think php must be installed as a
   module.
   Basically place a file called thumbnails.php in your site route, then
   whenever a URL like
   mysite.com/thumbnails/funny/4
   i called the thumbnails.php is excuted, in which you chop up the URL,
 and
   find all your varibles...
  
   Here is a example of some URL chopping (some code I stole from my
 source)
   /*
   Sample URLs:
   /s/1/2/SchoolName/StudentName/ -Shows Student Page (with ID 2)
   /s/1/0/SchoolName/-Shows Students At School (with school ID 1)
   /s/1/2/   -would work as well (name in URL for search engines)
   /s/1/0/   -would work as well
   /s/-Shows Schools
   */
  
   $url_array=explode(/,$REQUEST_URI);  //BREAK UP THE URL PATH
  //USING '/' as delimiter
   if ($url_array[1] == 's')
{
if (isSet($url_array[2]))
 $url_sID=$url_array[2];  //School ID
if (isSet($url_array[3]))
 $url_stID=$url_array[3];//Student ID
if (isSet($url_array[4]))
 $url_sName=$url_array[4];  //School Name (not used)
if (isSet($url_array[5]))
 $url_stName=$url_array[5];//Student Name (not used)
}
   /*
  
   There was a article on phpbuilder.com that explains the benefits and
   pitfalls of this idea... Here is the URL:
   http://www.phpbuilder.com/columns/tim19990117.php3 and I think there was
 a
   follow up article as well
  
   Enjoy
   Andrew
  
   - Original Message -
   From: Scott 'INtense!' Reismanis [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Monday, June 03, 2002 5:28 AM
   Subject: [PHP] Smart URLs
  
  
Hey all,
   
I was recently trying my luck at dabbling in some mod_rewrite
stuff, and I have run into numerious errors. Basically my aim is to
re-write my sites URLs so instead of being say,
mysite.com/thumbnails?type=funnygallery=4 the URL is neat, similar to
many sites who would have something like mysite.com/thumbnails/funny/4
   
What ways are there of achieving this (excluding, redirecting the URL
and creating the page say index.htm automatically)? I have tried
mod_rewrite for two days solid to no avail. I am not sure if it is my
poor coding or the fact that I am running apache2 on a Windows
 platform
which are said not to support such a module well. If any alternatives
could be proposed or even better someone could suggest a mod_rewrite
routine which would transparently transform any url like
mysite.com/whatever/4/6 to mysite.com/whatever.php it would be greatly
appreciated. So far the rewrite you see below will work with
mysite.com/whatever/ however the minute you add something onto the end
i.e. mysite.com/whatever/4/ it will raise the error Premature end of
script headers: php.exe, instead of loading whatever.php as intended.
   
RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteRule ^/(.+)/(.+) $1.php [L]
   
Thanks for your time and hopefully someone understands what I am
 trying
to say :), and as always any suggestions at all would be awesome!
   
Regards,
   
   
   Scott 'INtense!' Reismanis
   Mod Database System Administrator
   [EMAIL PROTECTED]
   http://www.moddb.com/ - Every Game, Every Mod, One
Site... Go Figure!
   
   
   
   
--
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
  
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 

[PHP] php to generate statiscs

2002-06-02 Thread Rodrigo Peres

Hi list,

Sorry if this is a off-topic, but I really don't know where to begin. I 
have a mysql database with about 20.000 records, now I need to build a 
statistics panel to show for example how many of this record are male, 
female, lives in determinated city, school graduation etc, everything 
grouped by sex and alone too, present the respectives percentages etc... 
How do I begin??? Can someone help??

thank's in advance

Rodrigo Peres


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




[PHP] Re: Variables - Using The Contents Of A Varibale Name Built Dynamically

2002-06-02 Thread Jason Teagle


Michael Davey [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 You could give the button the same name in each form - only the fields in
 between the form/form tags is actually submitted, then put a hidden
field
 in the form that uniquely identifies the data being submitted.

 Just a thought... it is what I usually do...

Won't that treat all radio buttons on the page as one group, instead of
being separate groups for each form?


--

_ _
o oJason Teagle
   [EMAIL PROTECTED]
 v




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




[PHP] mysql_select_db problem

2002-06-02 Thread PossumPal

Hi, 

I'm a newbie, so please have mercy on my silliness...

I've checked my formats, and can't seem to understand why I can connect to the db, but 
not select the db that I want to use.  The following code always returns the Couldn't 
select database error. 

If I use the mysql monitor, I can select the database directly without any problems. 

Could someone point out what I'm missing? 
?
$db_name=mydb;
$table_name=my_table;
$connection = mysql_connect(localhost, user, password) or die (Couldn't 
connect.);
$db = mysql_select_db($db_name) or die (Couldn't select database);
?


Regards,

Carol






RE: [PHP] php to generate statiscs

2002-06-02 Thread John Holmes

Look into cross-tab queries (I think that's what they are called). There
is a good article on Devshed.com about it. You can do a query like this

SELECT SUM(IF(Gender='M'),1,0)) AS Male, SUM(IF(Gender='F',1,0)) AS
Female FROM table

That'll give you two columns, one named Male, one named Female, in the
result set. The result set will have one row, containing the number of
males in the database in the Male column, the number of females in the
database in the second.

You could probably do the majority of your statistic queries this way.

---John Holmes...

 -Original Message-
 From: Rodrigo Peres [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, June 02, 2002 2:02 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] php to generate statiscs
 
 Hi list,
 
 Sorry if this is a off-topic, but I really don't know where to begin.
I
 have a mysql database with about 20.000 records, now I need to build a
 statistics panel to show for example how many of this record are male,
 female, lives in determinated city, school graduation etc, everything
 grouped by sex and alone too, present the respectives percentages
etc...
 How do I begin??? Can someone help??
 
 thank's in advance
 
 Rodrigo Peres
 
 
 --
 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] pcntl functions for task manager - comments?

2002-06-02 Thread Clay Loveless

After playing around with this further, here is more functional pseudo-code
... Primary change in the placement and method of the waidpid routine.

I'm still open to comments on this ... Otherwise, I hope this snippet is
useful to someone! : )

// run forever if necessary
set_time_limit(0);

// detatch from the controlling terminal
if (!posix_setsid()) {
die('could not detach from terminal');
}

// setup signal handlers
pcntl_signal(SIGTERM, sig_handler);
pcntl_signal(SIGHUP, sig_handler);

// loop forever waiting on jobs
while(1) {

// check queue for pending jobs
// (db lookup omitted, let's assume jobs are waiting)
$jobs_waiting = true;

if($jobs_waiting) {
$pid = pcntl_fork();
if($pid == -1) {
die('could not fork');
} else if ($pid) {
// parent
} else {
// child
// perform task on jobs waiting
// when job(s) complete, quit
exit();
}
}

// call waitpid to collect children that
// have already terminated
$tpid = pcntl_waitpid(-1,$status,WNOHANG);
//verbose output
//if($tpid  0) echo Parent collected child $tpid\n;

// wait two seconds before checking queue again
sleep(2);
unset($jobs_waiting);
}

function sig_handler($signo) {
// blah blah
}


-Clay


 From: Clay Loveless [EMAIL PROTECTED]
 Date: Sat, 01 Jun 2002 12:38:18 -0700
 To: PHP-General [EMAIL PROTECTED]
 Subject: [PHP] pcntl functions for task manager - comments?
 
 I'm experimenting with PHP's pcntl_* functions using the PHP cgi ... I've
 never written a daemon before, and there doesn't seem to be a lot of
 information out there about how to do this with the pcntl functions.
 
 So, I've read what I can find on the subject as it deals with UNIX
 programming. The goal is a script that will run forever, checking a job
 queue ... If jobs are waiting, use pcntl_fork() to handle the jobs.
 
 To this end, I've come up with this pseudo-code ...  Before going WAY off in
 this direction, I'd like to submit this for comments by those who've had
 more experience with this sort of thing.
 
 --
 // run forever if necessary
 set_time_limit(0);
 
 // detatch from the controlling terminal
 if (!posix_setsid()) {
   die('could not detach from terminal');
 }
 
 // setup signal handlers
 pcntl_signal(SIGTERM, sig_handler);
 pcntl_signal(SIGHUP, sig_handler);
 
 // loop forever waiting on jobs
 while(1) {
 
   // check queue for pending jobs
   // (db lookup omitted, let's assume jobs are waiting)
   $jobs_waiting = true;
   
   if($jobs_waiting) {
   
   $pid = pcntl_fork();
   if($pid == -1) {
   die('could not fork');
   } else if ($pid) {
   
   // parent
   // call waitpid to reap children that
   // have already terminated
   do {
   $tpid = pcntl_waitpid(-1,$status,WNOHANG);
   if($tpid == -1)
   die('error occurred while waiting for child');
   } while (!$tpid);
   
   } else {
   // child
   // perform task on jobs waiting
   
   // when job(s) complete, quit
   exit();
   }
 
   }
   // wait two seconds before checking queue again
   sleep(2);
   unset($jobs_waiting);
 }
   
 function sig_handler($signo) {
   // blah blah
 }
 
 
 
 I am open to suggestions or comments on this approach! Please let me know if
 you think this looks nuts.
 
 Thanks,
 Clay
 
 
 -- 
 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] still running the old version after recompiling??

2002-06-02 Thread savaidis

I have one similar problem.

I had a directory Php under my root directory that was the root for
Apache.
Then I rename Php to php but after restart, reset ecc - some months now-
still recognize only Php and NOT php.

What's wrong?

Makis


 -Original Message-
 From: Andy [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, June 02, 2002 4:51 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] still running the old version after recompiling??


 Hello Jason,

 you have been right, I did a new one on a fresh php untared dir.
 And the new
 php install is recognized.

 But I am still fighting with the installation. I need freetype2 and I did
 configure it ok, compiled freetype, gd2 but still I am getting a:
 function: imagettfbbox()  not found

 Php did not complain about not finding freetype. Maybe php compiled with
 freetype 1 but how come?
 This drives me cracy! I did install php on several machines at
 home running
 the same operating system like my provider is offering. It always worked
 fine.

 do u have a good advice?

 Thank you for your help,

 Andy




 Jason Wong [EMAIL PROTECTED] schrieb im Newsbeitrag
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  On Sunday 02 June 2002 17:32, Andy wrote:
   Hi there,
  
   I did recompile php with different flags. Phpinfo() tells me that I am
   still running the old insatllation! I did restart apache after
 compiling.
   So whats wrong. Did I forget something?
  
   I did
   configure with some flags
   make
   make install
  
   restart apache
 
  1) To avoid any complications I always compile from a freshly unpacked
 tar.gz.
  2) Stop apache before doing make install (not sure whether it
 makes any
  difference but it doesn't hurt to do so).
 
  --
  Jason Wong - Gremlins Associates - www.gremlins.com.hk
  Open Source Software Systems Integrators
  * Web Design  Hosting * Internet  Intranet Applications Development *
 
  /*
  There are two ways of disliking poetry; one way is to dislike it, the
  other is to read Pope.
  -- Oscar Wilde
  */
 



 --
 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] simple email validation ereg

2002-06-02 Thread Analysis Solutions

Hi Justin:

On Sun, Jun 02, 2002 at 02:13:40PM +1000, Justin French wrote:
 
 (anything)(anything) followed by 1 or more (.anything)

So, what ereg expressions have you tried thus far?  It's far cooler to 
come to the list saying, I tried x, and it's generating error y, does 
anyone have an idea?

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

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




Re: [PHP] simple email validation ereg

2002-06-02 Thread Alexander Skwar

Justin French wrote:

my aim will be to strip out anything that doesn't at least LOOK like like an
email address.


Well, instead of coming up with some clever regexp, I'd suggest to 
completely dump syntax checks.  Instead, I only check if the host has a 
MX entry associated.  If not, then this host either does not exist, or 
mails wouldn't get through.  At any rate, it's not a valid adress.


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




RE: [PHP] Re: Parsing file's

2002-06-02 Thread Scott

Ok, this did not work, but I have a new idea.  From the top

1)Read in the csv file, take the first 18 records and insert them into a
temp db.Ie:  $output = array_slice ($fields, 0, 17);

2)Then do a count on the line to see how many records are after 17 and
somehow loop through them 34 at a time.  

It is easy if there is only one set, but I am not sure how to take the
remaining elements in the array and break them out 34 at a time until I
reach the end of the line.  

Help, my head hurts and I have a habit of over thinking :)

-Scott




-Original Message-
From: Mark Heintz PHP Mailing Lists [mailto:[EMAIL PROTECTED]] 
Sent: Friday, May 31, 2002 4:43 PM
To: Scott
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: Parsing file's

You may have been heading in the right direction originally with
array_slice...  This is off the top of my head, I don't guaruntee it
will
work...

$start = 34;
$interval = 15;
$max = 303;
// hop across orig. array 15 columns at a time
for($offset = $start;
$offset  $max  isset($array[$offset]);
$offset += $interval){
  // slice off $interval many columns starting at $offset
  $sub_array = array_slice($array, $i, $interval);
  // handle your $interval many key-value pairs
  foreach ($sub_array as $key = $value){
$policyWriter = $quoteKey|$key|$value;
// ...
  }
}


mh.




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




Re: [PHP] mysql_select_db problem

2002-06-02 Thread Nathan

Do some error checking. You're turning off all the errors produced by the mysql 
statements, so how
are you supposed to know what's wrong?

You could also try:

$db = mysql_select_db($db_name) or exit(mysql_error());

I'm not sure if mysql_error works for selecting the db, but it couldn't hurt to try :-)

Cheers,

# Nathan

- Original Message -
From: PossumPal [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, June 02, 2002 12:40 PM
Subject: [PHP] mysql_select_db problem


Hi,

I'm a newbie, so please have mercy on my silliness...

I've checked my formats, and can't seem to understand why I can connect to the db, but 
not select
the db that I want to use.  The following code always returns the Couldn't select 
database error.

If I use the mysql monitor, I can select the database directly without any problems.

Could someone point out what I'm missing?
?
$db_name=mydb;
$table_name=my_table;
$connection = @mysql_connect(localhost, user, password) or die (Couldn't 
connect.);
$db = @mysql_select_db($db_name) or die (Couldn't select database);
?


Regards,

Carol






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




[PHP] Sessions

2002-06-02 Thread r

Hey Everyone,

Been going through the manual and the book PHP BlackBook and am totally
confused about sessions.

Searched google and found a couple of places that seem to be offering
lessons but dont know which is good as there are so many results.

Has anybody here used an online turoral that they feel is good for a newbie
or has done wonders in helping you on when you were learning php? if so
please send me the website name / URL.

Something that will take me baby steps.:-0)

Thanks in advance.
-Ryan.


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




Re: [PHP] Sessions

2002-06-02 Thread Justin French

sitepoint.com has a nice one on restricting pages with login/sessions, etc
by Kevin Yank.

Justin French


on 03/06/02 8:38 PM, r ([EMAIL PROTECTED]) wrote:

 Hey Everyone,
 
 Been going through the manual and the book PHP BlackBook and am totally
 confused about sessions.
 
 Searched google and found a couple of places that seem to be offering
 lessons but dont know which is good as there are so many results.
 
 Has anybody here used an online turoral that they feel is good for a newbie
 or has done wonders in helping you on when you were learning php? if so
 please send me the website name / URL.
 
 Something that will take me baby steps.:-0)
 
 Thanks in advance.
 -Ryan.
 


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




RE: [PHP] Sessions

2002-06-02 Thread David Freeman


  Has anybody here used an online turoral that they feel is 
  good for a newbie or has done wonders in helping you on when 
  you were learning php? if so please send me the website name / URL.

http://www.devshed.com/Server_Side/PHP/UserAuth/page1.html

I found this one quite good - not so much sessions by themselves but
rather a practical application that works and that gave me something to
play around with.

CYA, Dave


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




[PHP] Re: Variables - Using The Contents Of A Varibale Name Built Dynamically

2002-06-02 Thread Michael Davey

 Won't that treat all radio buttons on the page as one group, instead of
 being separate groups for each form?

No - the form/form tags enclose the data that is being submitted -
nothing outside of the tags will reach the script that handles the request.

Mikey



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




Re: [PHP] still running the old version after recompiling??

2002-06-02 Thread Evan Nemerson

Do echo $PATH from a shell. This will output a list of several folders, 
seperated by a semi-colon. Check each of these folders for a file named 
Php. Rename to php. That should do the trick.



On Sunday 02 June 2002 11:01 am, savaidis wrote:
 I have one similar problem.

 I had a directory Php under my root directory that was the root for
 Apache.
 Then I rename Php to php but after restart, reset ecc - some months
 now- still recognize only Php and NOT php.

 What's wrong?

 Makis

  -Original Message-
  From: Andy [mailto:[EMAIL PROTECTED]]
  Sent: Sunday, June 02, 2002 4:51 PM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] still running the old version after recompiling??
 
 
  Hello Jason,
 
  you have been right, I did a new one on a fresh php untared dir.
  And the new
  php install is recognized.
 
  But I am still fighting with the installation. I need freetype2 and I did
  configure it ok, compiled freetype, gd2 but still I am getting a:
  function: imagettfbbox()  not found
 
  Php did not complain about not finding freetype. Maybe php compiled with
  freetype 1 but how come?
  This drives me cracy! I did install php on several machines at
  home running
  the same operating system like my provider is offering. It always worked
  fine.
 
  do u have a good advice?
 
  Thank you for your help,
 
  Andy
 
 
 
 
  Jason Wong [EMAIL PROTECTED] schrieb im Newsbeitrag
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 
   On Sunday 02 June 2002 17:32, Andy wrote:
Hi there,
   
I did recompile php with different flags. Phpinfo() tells me that I
am still running the old insatllation! I did restart apache after
 
  compiling.
 
So whats wrong. Did I forget something?
   
I did
configure with some flags
make
make install
   
restart apache
  
   1) To avoid any complications I always compile from a freshly unpacked
 
  tar.gz.
 
   2) Stop apache before doing make install (not sure whether it
 
  makes any
 
   difference but it doesn't hurt to do so).
  
   --
   Jason Wong - Gremlins Associates - www.gremlins.com.hk
   Open Source Software Systems Integrators
   * Web Design  Hosting * Internet  Intranet Applications Development *
  
   /*
   There are two ways of disliking poetry; one way is to dislike it, the
   other is to read Pope.
   -- Oscar Wilde
   */
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php

-- 
I am prepared to meet anyone, but whether anyone is prepared for the great 
ordeal of meeting me is another matter.

Samuel Clemens


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




RE: [PHP] Re: Parsing file's (SOLVED)

2002-06-02 Thread Scott

The next time I stare at something so long I can't think straight remind
me to take a walk and pull out Rasmus' book!  Page 121 array_chunk is my
friend!

Code is ugly, but I am smiling now!   Thank you everyone!

$policy = array_slice ($fields, 18, $lineCount);  
// I am taking the array from position 18 to the end
$chunks = array_chunk ($policy, 34);  
// Using array_chunk I break the array into pieces of 34
foreach ($chunks as $key = $value){
print_r($chunks);
sleep(5);
}
// The sleep is for me to watch it fly by the screen :)

Thanks again everyone.

-Scott



-Original Message-
From: Scott [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, June 02, 2002 4:57 PM
To: 'Mark Heintz PHP Mailing Lists'
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] Re: Parsing file's

Ok, this did not work, but I have a new idea.  From the top

1)Read in the csv file, take the first 18 records and insert them into a
temp db.Ie:  $output = array_slice ($fields, 0, 17);

2)Then do a count on the line to see how many records are after 17 and
somehow loop through them 34 at a time.  

It is easy if there is only one set, but I am not sure how to take the
remaining elements in the array and break them out 34 at a time until I
reach the end of the line.  

Help, my head hurts and I have a habit of over thinking :)

-Scott




-Original Message-
From: Mark Heintz PHP Mailing Lists [mailto:[EMAIL PROTECTED]] 
Sent: Friday, May 31, 2002 4:43 PM
To: Scott
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: Parsing file's

You may have been heading in the right direction originally with
array_slice...  This is off the top of my head, I don't guaruntee it
will
work...

$start = 34;
$interval = 15;
$max = 303;
// hop across orig. array 15 columns at a time
for($offset = $start;
$offset  $max  isset($array[$offset]);
$offset += $interval){
  // slice off $interval many columns starting at $offset
  $sub_array = array_slice($array, $i, $interval);
  // handle your $interval many key-value pairs
  foreach ($sub_array as $key = $value){
$policyWriter = $quoteKey|$key|$value;
// ...
  }
}


mh.




-- 
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] Sessions

2002-06-02 Thread Glenn Sieb

At 08:32 AM 6/3/2002 +1000, Justin French posted the following...
sitepoint.com has a nice one on restricting pages with login/sessions, etc
by Kevin Yank.


http://www.WebmasterBase.com/article/319

Is that the one you're referring to, Justin? It seems pretty good.. :)

Glenn


---
The original portions of this message are the copyright of the author
(c)1998-2002 Glenn E. Sieb.ICQ UIN: 300395IRC Nick: Rainbear
All acts of Love and Pleasure are Her rituals-Charge of the Goddess



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




[PHP] 'Pure' php vs 'mixed' (html + php)

2002-06-02 Thread Andre Dubuc

I've noticed that many people on the list code in 'pure' php, i.e.

?
print input type='text' name='fname' size='50';

// etc
?

Since most of my code is a mixture (the early stuff is 'mixed' html + php), 
I've been wondering why code in 'pure' php? Is there some compelling reason 
(that I'm unaware of) for doing so? Should I rewrite all my earlier code into 
its 'pure' form? If so, what do I do with the '! DOCTYPE . . .  statement 
-- put it in quotes too?

I would like to understand the reasons for writing code in this manner, when 
all my code works fine, displays great: am I missing something important 
here? Btw, I use the 'php' ending for all file names.

Your thoughts, opinions and suggestions would be greatly appreciated -- I'd 
like to do what is best.

Tia,
Andre

-- 
Please pray the Holy Rosary to end the holocaust of abortion.
Remember in your prayers the Holy Souls in Purgatory.

May God bless you abundantly in His love!
For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/

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




[PHP] newbie help please

2002-06-02 Thread Christopher J. Crane

$Tags['issue-name']. So I could print it out. Something like, print
$Tags['issue-name']br\n;

I was able to get a numerical representation of the array like, $Tags[5] and
the value of that tag was RED HAT, but then I would have to know what the
position of the data I am looking for in the array. I would prefer to know
the tag name and the array and get to the data that way. I know there is a
way to do this, but I just can't figure it out. There is a lot of
information on Parsing the XML file but not getting into a useful array, or
at least that I have found easily to understand.


if(!isset($Sym)) { $Sym = 'IKN'; }
$URI = 'http://quotes.nasdaq.com/quote.dll?page=xmlmode=stocksymbol=';
$simple = implode( '', file($URI$Sym));

$p = xml_parser_create();
xml_parse_into_struct($p,$simple,$vals,$index);
xml_parser_free($p);




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




Re: [PHP] 'Pure' php vs 'mixed' (html + php)

2002-06-02 Thread Bogdan Stancescu

No *real* reason - just two not-so-important ones:

1. Clarity
Please compare these two:
-- MIXED
td bgcolor=?php echo $td_col; ? class=?php echo $prefclass; ?
?php $fldcontent=$myrow[0]?$myrow[0]:no data; ?
input type=text name=fname size=50 value=?php echo $fldcontent; 
?
/td

-- PURE
?php
  echo(td bgcolor='$td_col' class='$prefclass'\n);
  $fldcontent=$myrow[0]?$myrow[0]:no data;
  echo(input type='text' name='fname' size='50' value='$fldcontent'\n);
?

The second is much easier to read and understand, you must agree.

2. Speed
There's an urban legend saying that switching php tags on and off would 
slow parsing down. I don't know if that's true and try to write pure 
php as you call it due to the first reason.

Bogdan

Andre Dubuc wrote:

I've noticed that many people on the list code in 'pure' php, i.e.

?
print input type='text' name='fname' size='50';

// etc
?

Since most of my code is a mixture (the early stuff is 'mixed' html + php), 
I've been wondering why code in 'pure' php? Is there some compelling reason 
(that I'm unaware of) for doing so? Should I rewrite all my earlier code into 
its 'pure' form? If so, what do I do with the '! DOCTYPE . . .  statement 
-- put it in quotes too?

I would like to understand the reasons for writing code in this manner, when 
all my code works fine, displays great: am I missing something important 
here? Btw, I use the 'php' ending for all file names.

Your thoughts, opinions and suggestions would be greatly appreciated -- I'd 
like to do what is best.

Tia,
Andre

  





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




[PHP] Setting PHP Include Dir

2002-06-02 Thread Tim Thorburn

Hi,

I'm trying to set a PHP include directory for one of my sites.  I'm on a 
shared hosting system, so I don't have access to the php.ini file.

My plan was to do it using a .htaccess file in Apache - however I must be 
doing something very much wrong, as it isn't working.

Here is what I've tried:

php_value include_dir = .:/data/sites/site_name/htdocs/includes

I've checked the above path by running phpinfo(); on my site to determine 
where its located on my servers hard drive.

When I add the above line to my .htaccess file - I get a 500 Internal 
Server Error.

My site is using Apache 1.3.12 and PHP 3.0.18, any thoughts on how I might 
get this to work?

Thanks
-Tim



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




Re: [PHP] 'Pure' php vs 'mixed' (html + php)

2002-06-02 Thread Andre Dubuc

Thanks Bogdan,

That's what I thought, but I was beginning to feel 'guilty' the more I 
understood php. It seems to me, from my limited experience, that there's much 
mor chance for error using 'pure' php (as in forgetting ' or  or closing 
with ; -- but . . . 

Actually I've found that the 'mixed' is easier to read and understand -- less 
quotes, less 'print' to read with every line. But that's just personal taste 
on my part.

While I'm at it, I've also noticed that coders tend to integrate 'result' 
pages with the 'calling' page. (That is, I have a text input, and use a php 
function to verify it on the same page). I've tended to keep them separate 
for de-bugging purposes. Should I consider re-writing them as well?

Regards,
Andre

On Sunday 02 June 2002 08:16 pm, you wrote:
 No *real* reason - just two not-so-important ones:

 1. Clarity
 Please compare these two:
 -- MIXED
 td bgcolor=?php echo $td_col; ? class=?php echo $prefclass; ?
 ?php $fldcontent=$myrow[0]?$myrow[0]:no data; ?
 input type=text name=fname size=50 value=?php echo $fldcontent;
 ?
 /td

 -- PURE
 ?php
   echo(td bgcolor='$td_col' class='$prefclass'\n);
   $fldcontent=$myrow[0]?$myrow[0]:no data;
   echo(input type='text' name='fname' size='50' value='$fldcontent'\n);
 ?

 The second is much easier to read and understand, you must agree.

 2. Speed
 There's an urban legend saying that switching php tags on and off would
 slow parsing down. I don't know if that's true and try to write pure
 php as you call it due to the first reason.

 Bogdan

 Andre Dubuc wrote:
 I've noticed that many people on the list code in 'pure' php, i.e.
 
 ?
 print input type='text' name='fname' size='50';
 
 // etc
 ?
 
 Since most of my code is a mixture (the early stuff is 'mixed' html +
  php), I've been wondering why code in 'pure' php? Is there some
  compelling reason (that I'm unaware of) for doing so? Should I rewrite
  all my earlier code into its 'pure' form? If so, what do I do with the
  '! DOCTYPE . . .  statement -- put it in quotes too?
 
 I would like to understand the reasons for writing code in this manner,
  when all my code works fine, displays great: am I missing something
  important here? Btw, I use the 'php' ending for all file names.
 
 Your thoughts, opinions and suggestions would be greatly appreciated --
  I'd like to do what is best.
 
 Tia,
 Andre

-- 
Please pray the Holy Rosary to end the holocaust of abortion.
Remember in your prayers the Holy Souls in Purgatory.

May God bless you abundantly in His love!
For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/

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




Re: [PHP] 'Pure' php vs 'mixed' (html + php)

2002-06-02 Thread Andre Dubuc

On Sunday 02 June 2002 08:13 pm, you wrote:
 On Sun, Jun 02, 2002 at 07:55:09PM -0400, Andre Dubuc wrote:
  I've noticed that many people on the list code in 'pure' php, i.e.
 
  ?
  print input type='text' name='fname' size='50';
 
  // etc
  ?
 
  Since most of my code is a mixture (the early stuff is 'mixed' html +
  php), I've been wondering why code in 'pure' php? Is there some
  compelling reason (that I'm unaware of) for doing so? Should I rewrite
  all my earlier code into its 'pure' form? If so, what do I do with the
  '! DOCTYPE . . .  statement -- put it in quotes too?
 
  I would like to understand the reasons for writing code in this manner,
  when all my code works fine, displays great: am I missing something
  important here? Btw, I use the 'php' ending for all file names.
 
  Your thoughts, opinions and suggestions would be greatly appreciated --
  I'd like to do what is best.
 
  Tia,
  Andre

 ---end quoted text---

 I don't know, but i prefer coding in mixed way.. to avoid excessive
 escaping at html tags and other..

 []'s


Thanks Marcelo,

Precisely my feelings as well. Looks cleaner since I can spot the divisions 
quite readily (no print . . .  ; in the code).

Regards,
Andre


-- 
Please pray the Holy Rosary to end the holocaust of abortion.
Remember in your prayers the Holy Souls in Purgatory.

May God bless you abundantly in His love!
For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/

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




[PHP] Encryption without Mcrypt?

2002-06-02 Thread Jonathan Rosenberg

I need to do some encryption/decryption of data in PHP.  I don't
need anything heavy duty.  Just some scheme that obscures strings
in a non-trivial manner.

I am on a shared hosting site which doesn't have the mcrypt suite
installed with PHP ( they won't install it).

Does anyone know of any functions written in PHP that could serve
this purpose?

--
JR


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




Re: [PHP] 'Pure' php vs 'mixed' (html + php)

2002-06-02 Thread Bogdan Stancescu

I'm not sure what you mean... Is it checking that you fill in the 
correct values via PHP or that the submission works - or something else?

Bogdan

Andre Dubuc wrote:

Thanks Bogdan,

That's what I thought, but I was beginning to feel 'guilty' the more I 
understood php. It seems to me, from my limited experience, that there's much 
mor chance for error using 'pure' php (as in forgetting ' or  or closing 
with ; -- but . . . 

Actually I've found that the 'mixed' is easier to read and understand -- less 
quotes, less 'print' to read with every line. But that's just personal taste 
on my part.

While I'm at it, I've also noticed that coders tend to integrate 'result' 
pages with the 'calling' page. (That is, I have a text input, and use a php 
function to verify it on the same page). I've tended to keep them separate 
for de-bugging purposes. Should I consider re-writing them as well?

Regards,
Andre

On Sunday 02 June 2002 08:16 pm, you wrote:
  

No *real* reason - just two not-so-important ones:

1. Clarity
Please compare these two:
-- MIXED
td bgcolor=?php echo $td_col; ? class=?php echo $prefclass; ?
?php $fldcontent=$myrow[0]?$myrow[0]:no data; ?
input type=text name=fname size=50 value=?php echo $fldcontent;
?
/td

-- PURE
?php
  echo(td bgcolor='$td_col' class='$prefclass'\n);
  $fldcontent=$myrow[0]?$myrow[0]:no data;
  echo(input type='text' name='fname' size='50' value='$fldcontent'\n);
?

The second is much easier to read and understand, you must agree.

2. Speed
There's an urban legend saying that switching php tags on and off would
slow parsing down. I don't know if that's true and try to write pure
php as you call it due to the first reason.

Bogdan

Andre Dubuc wrote:


I've noticed that many people on the list code in 'pure' php, i.e.

?
print input type='text' name='fname' size='50';

// etc
?

Since most of my code is a mixture (the early stuff is 'mixed' html +
php), I've been wondering why code in 'pure' php? Is there some
compelling reason (that I'm unaware of) for doing so? Should I rewrite
all my earlier code into its 'pure' form? If so, what do I do with the
'! DOCTYPE . . .  statement -- put it in quotes too?

I would like to understand the reasons for writing code in this manner,
when all my code works fine, displays great: am I missing something
important here? Btw, I use the 'php' ending for all file names.

Your thoughts, opinions and suggestions would be greatly appreciated --
I'd like to do what is best.

Tia,
Andre
  


  





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




Re: [PHP] 'Pure' php vs 'mixed' (html + php)

2002-06-02 Thread Michael Davey

However...

From the point of view of someone who has worked in a company where diesign
is separated from development, it is much better to have separate files with
HTML templates with special markers (in the library I use, it is HTML
comments !--element_to_replace--) so that the two processes are adequately
separated.

When all of the HTML is embedded in PHP staements, minor changes to HTML
layout involve a PHP developer, whereas with template based strategies all
they have to do is change the template.

I believe that 'smarty' is the approved template libray, but there are
several other worth investigating.

Mikey
Bogdan Stancescu [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 No *real* reason - just two not-so-important ones:

 1. Clarity
 Please compare these two:
 -- MIXED
 td bgcolor=?php echo $td_col; ? class=?php echo $prefclass; ?
 ?php $fldcontent=$myrow[0]?$myrow[0]:no data; ?
 input type=text name=fname size=50 value=?php echo $fldcontent;
 ?
 /td

 -- PURE
 ?php
   echo(td bgcolor='$td_col' class='$prefclass'\n);
   $fldcontent=$myrow[0]?$myrow[0]:no data;
   echo(input type='text' name='fname' size='50'
value='$fldcontent'\n);
 ?

 The second is much easier to read and understand, you must agree.

 2. Speed
 There's an urban legend saying that switching php tags on and off would
 slow parsing down. I don't know if that's true and try to write pure
 php as you call it due to the first reason.

 Bogdan

 Andre Dubuc wrote:

 I've noticed that many people on the list code in 'pure' php, i.e.
 
 ?
 print input type='text' name='fname' size='50';
 
 // etc
 ?
 
 Since most of my code is a mixture (the early stuff is 'mixed' html +
php),
 I've been wondering why code in 'pure' php? Is there some compelling
reason
 (that I'm unaware of) for doing so? Should I rewrite all my earlier code
into
 its 'pure' form? If so, what do I do with the '! DOCTYPE . . . 
statement
 -- put it in quotes too?
 
 I would like to understand the reasons for writing code in this manner,
when
 all my code works fine, displays great: am I missing something important
 here? Btw, I use the 'php' ending for all file names.
 
 Your thoughts, opinions and suggestions would be greatly appreciated --
I'd
 like to do what is best.
 
 Tia,
 Andre
 
 
 






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




Re: [PHP] 'Pure' php vs 'mixed' (html + php)

2002-06-02 Thread Andre Dubuc

That's what I meant. I was referring to verification/validation scripts for 
user inputs. I've made a separate page that runs these routines. I have a 
feeling I should have incorporated them on the user input page  . . . but 
does it really amtter if they're on another page?

Andre

On Sunday 02 June 2002 08:32 pm, you wrote:
 I'm not sure what you mean... Is it checking that you fill in the
 correct values via PHP or that the submission works - or something else?

 Bogdan

 Andre Dubuc wrote:
 Thanks Bogdan,
 
 That's what I thought, but I was beginning to feel 'guilty' the more I
 understood php. It seems to me, from my limited experience, that there's
  much mor chance for error using 'pure' php (as in forgetting ' or  or
  closing with ; -- but . . .
 
 Actually I've found that the 'mixed' is easier to read and understand --
  less quotes, less 'print' to read with every line. But that's just
  personal taste on my part.
 
 While I'm at it, I've also noticed that coders tend to integrate 'result'
 pages with the 'calling' page. (That is, I have a text input, and use a
  php function to verify it on the same page). I've tended to keep them
  separate for de-bugging purposes. Should I consider re-writing them as
  well?
 
 Regards,
 Andre
 
 On Sunday 02 June 2002 08:16 pm, you wrote:
 No *real* reason - just two not-so-important ones:
 
 1. Clarity
 Please compare these two:
 -- MIXED
 td bgcolor=?php echo $td_col; ? class=?php echo $prefclass; ?
 ?php $fldcontent=$myrow[0]?$myrow[0]:no data; ?
 input type=text name=fname size=50 value=?php echo $fldcontent;
 ?
 /td
 
 -- PURE
 ?php
   echo(td bgcolor='$td_col' class='$prefclass'\n);
   $fldcontent=$myrow[0]?$myrow[0]:no data;
   echo(input type='text' name='fname' size='50'
  value='$fldcontent'\n); ?
 
 The second is much easier to read and understand, you must agree.
 
 2. Speed
 There's an urban legend saying that switching php tags on and off would
 slow parsing down. I don't know if that's true and try to write pure
 php as you call it due to the first reason.
 
 Bogdan
 
 Andre Dubuc wrote:
 I've noticed that many people on the list code in 'pure' php, i.e.
 
 ?
 print input type='text' name='fname' size='50';
 
 // etc
 ?
 
 Since most of my code is a mixture (the early stuff is 'mixed' html +
 php), I've been wondering why code in 'pure' php? Is there some
 compelling reason (that I'm unaware of) for doing so? Should I rewrite
 all my earlier code into its 'pure' form? If so, what do I do with the
 '! DOCTYPE . . .  statement -- put it in quotes too?
 
 I would like to understand the reasons for writing code in this manner,
 when all my code works fine, displays great: am I missing something
 important here? Btw, I use the 'php' ending for all file names.
 
 Your thoughts, opinions and suggestions would be greatly appreciated --
 I'd like to do what is best.
 
 Tia,
 Andre

-- 
Please pray the Holy Rosary to end the holocaust of abortion.
Remember in your prayers the Holy Souls in Purgatory.

May God bless you abundantly in His love!
For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/


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




Re: [PHP] 'Pure' php vs 'mixed' (html + php)

2002-06-02 Thread Simon Troup

I would ask the question How much HTML before you break out of PHP and into
HTML. My answer is any. Surely you're making the engine work just to echo
stuff out? But are you asking for more by making it jump in and out between
all those tags?!

Short tags ...

td bgcolor=?=$td_col? class=?=$prefclass?

... easier to read in Mixed? I think so.

Also, pure coding breaks the HTML syntax coloring in my text editor!

Simon

 Thanks Bogdan,
 
 That's what I thought, but I was beginning to feel 'guilty' the more I
 understood php. It seems to me, from my limited experience, that there's much
 mor chance for error using 'pure' php (as in forgetting ' or  or closing
 with ; -- but . . .
 
 Actually I've found that the 'mixed' is easier to read and understand -- less
 quotes, less 'print' to read with every line. But that's just personal taste
 on my part.
 
 While I'm at it, I've also noticed that coders tend to integrate 'result'
 pages with the 'calling' page. (That is, I have a text input, and use a php
 function to verify it on the same page). I've tended to keep them separate
 for de-bugging purposes. Should I consider re-writing them as well?
 
 Regards,
 Andre
 
 On Sunday 02 June 2002 08:16 pm, you wrote:
 No *real* reason - just two not-so-important ones:
 
 1. Clarity
 Please compare these two:
 -- MIXED
 td bgcolor=?php echo $td_col; ? class=?php echo $prefclass; ?
 ?php $fldcontent=$myrow[0]?$myrow[0]:no data; ?
 input type=text name=fname size=50 value=?php echo $fldcontent;
 ?
 /td
 
 -- PURE
 ?php
 echo(td bgcolor='$td_col' class='$prefclass'\n);
 $fldcontent=$myrow[0]?$myrow[0]:no data;
 echo(input type='text' name='fname' size='50' value='$fldcontent'\n);
 ?
 
 The second is much easier to read and understand, you must agree.
 
 2. Speed
 There's an urban legend saying that switching php tags on and off would
 slow parsing down. I don't know if that's true and try to write pure
 php as you call it due to the first reason.
 
 Bogdan
 
 Andre Dubuc wrote:
 I've noticed that many people on the list code in 'pure' php, i.e.
 
 ?
 print input type='text' name='fname' size='50';
 
 // etc
 ?
 
 Since most of my code is a mixture (the early stuff is 'mixed' html +
 php), I've been wondering why code in 'pure' php? Is there some
 compelling reason (that I'm unaware of) for doing so? Should I rewrite
 all my earlier code into its 'pure' form? If so, what do I do with the
 '! DOCTYPE . . .  statement -- put it in quotes too?
 
 I would like to understand the reasons for writing code in this manner,
 when all my code works fine, displays great: am I missing something
 important here? Btw, I use the 'php' ending for all file names.
 
 Your thoughts, opinions and suggestions would be greatly appreciated --
 I'd like to do what is best.
 
 Tia,
 Andre


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




Re: [PHP] 'Pure' php vs 'mixed' (html + php)

2002-06-02 Thread Andre Dubuc

Thanks Michael,

Point well-made. I suppose doing it the mixed way might have repercussions 
later on if/when the site grows. Perhaps while the code is still fresh in my 
mid, it might be worth the effort to separate it.

However, for a good part of the site, I've used CSS for appearance details, 
and controlling a lot of stuff that changes from page-to-page. It's very easy 
to change all or some of the pages from the CSS scripts. But, for the most 
part, not much of the actual php scripts COULD change, so that's why I've 
never bothered to separate html from php. Perhaps I wrong, but  . . .

Regards,
Andre

On Sunday 02 June 2002 08:36 pm, you wrote:
 However...

 From the point of view of someone who has worked in a company where diesign
 is separated from development, it is much better to have separate files
 with HTML templates with special markers (in the library I use, it is HTML
 comments !--element_to_replace--) so that the two processes are
 adequately separated.

 When all of the HTML is embedded in PHP staements, minor changes to HTML
 layout involve a PHP developer, whereas with template based strategies all
 they have to do is change the template.

 I believe that 'smarty' is the approved template libray, but there are
 several other worth investigating.

 Mikey
 Bogdan Stancescu [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

  No *real* reason - just two not-so-important ones:
 
  1. Clarity
  Please compare these two:
  -- MIXED
  td bgcolor=?php echo $td_col; ? class=?php echo $prefclass; ?
  ?php $fldcontent=$myrow[0]?$myrow[0]:no data; ?
  input type=text name=fname size=50 value=?php echo $fldcontent;
  ?
  /td
 
  -- PURE
  ?php
echo(td bgcolor='$td_col' class='$prefclass'\n);
$fldcontent=$myrow[0]?$myrow[0]:no data;
echo(input type='text' name='fname' size='50'

 value='$fldcontent'\n);

  ?
 
  The second is much easier to read and understand, you must agree.
 
  2. Speed
  There's an urban legend saying that switching php tags on and off would
  slow parsing down. I don't know if that's true and try to write pure
  php as you call it due to the first reason.
 
  Bogdan
 
  Andre Dubuc wrote:
  I've noticed that many people on the list code in 'pure' php, i.e.
  
  ?
  print input type='text' name='fname' size='50';
  
  // etc
  ?
  
  Since most of my code is a mixture (the early stuff is 'mixed' html +

 php),

  I've been wondering why code in 'pure' php? Is there some compelling

 reason

  (that I'm unaware of) for doing so? Should I rewrite all my earlier code

 into

  its 'pure' form? If so, what do I do with the '! DOCTYPE . . . 

 statement

  -- put it in quotes too?
  
  I would like to understand the reasons for writing code in this manner,

 when

  all my code works fine, displays great: am I missing something important
  here? Btw, I use the 'php' ending for all file names.
  
  Your thoughts, opinions and suggestions would be greatly appreciated --

 I'd

  like to do what is best.
  
  Tia,
  Andre

-- 
Please pray the Holy Rosary to end the holocaust of abortion.
Remember in your prayers the Holy Souls in Purgatory.

May God bless you abundantly in His love!
For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/

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




RE: [PHP] 'Pure' php vs 'mixed' (html + php)

2002-06-02 Thread David Freeman


  I've noticed that many people on the list code in 'pure' php, i.e.
  
  ?
  print input type='text' name='fname' size='50';
  
  // etc
  ?

Personally, it depends on what I'm doing.  I find that excessive use of
? And ? in my code gets distracting so if I need a lot of php code I
will usually put the straight html into echo/print strings.  If I'm
doing something that is predominantly html with only a few php variables
or some such then I'll do it mostly in html.

Often if there's just a php code block I'll move it into an include and
then just include it in normal html.  This helps readability and lets me
separate some of the layout aspects from the code logic aspects.

In the end if it's valid it will work.  My only real decision is based
on readability for my own purposes.

CYA, Dave



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




Re: [PHP] Sessions

2002-06-02 Thread Justin French

YES

It's been the basis of everything I've done so far with sessions.

Justin


on 03/06/02 9:05 AM, Glenn Sieb ([EMAIL PROTECTED]) wrote:

 At 08:32 AM 6/3/2002 +1000, Justin French posted the following...
 sitepoint.com has a nice one on restricting pages with login/sessions, etc
 by Kevin Yank.
 
 
 http://www.WebmasterBase.com/article/319
 
 Is that the one you're referring to, Justin? It seems pretty good.. :)
 
 Glenn


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




[PHP] resolution

2002-06-02 Thread reapern66

I was wondering if theres a server side variable that i can find the web brower 
resolution.



Re: [PHP] resolution

2002-06-02 Thread Bogdan Stancescu

JavaScript does something in this direction - you can use a little 
JavaScript trick to get it - check some JS docs and mail me if 
interested and unable to make it. What you basically need to do is use a 
link such as a href=javascript:bla()Continue/a or, more transparent, 
create an intermediary page which only contains some JS which takes the 
user to the real page. The real page would receive the screen 
resolution either from function bla() in the first example of from the 
global code in the second. I believe screen was the object you had to 
look for in JS (as in screen.width and screen.height).

HTH

Bogdan

reapern66 wrote:

I was wondering if theres a server side variable that i can find the web brower 
resolution.

  





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




Re: [PHP] 'Pure' php vs 'mixed' (html + php)

2002-06-02 Thread Bogdan Stancescu

No, it doesn't - just go with whatever's simpler for you... and with 
what matches your application better - I don't think this does matter at 
all.

Bogdan

Andre Dubuc wrote:

That's what I meant. I was referring to verification/validation scripts for 
user inputs. I've made a separate page that runs these routines. I have a 
feeling I should have incorporated them on the user input page  . . . but 
does it really amtter if they're on another page?

Andre

On Sunday 02 June 2002 08:32 pm, you wrote:
  

I'm not sure what you mean... Is it checking that you fill in the
correct values via PHP or that the submission works - or something else?

Bogdan

Andre Dubuc wrote:


Thanks Bogdan,

That's what I thought, but I was beginning to feel 'guilty' the more I
understood php. It seems to me, from my limited experience, that there's
much mor chance for error using 'pure' php (as in forgetting ' or  or
closing with ; -- but . . .

Actually I've found that the 'mixed' is easier to read and understand --
less quotes, less 'print' to read with every line. But that's just
personal taste on my part.

While I'm at it, I've also noticed that coders tend to integrate 'result'
pages with the 'calling' page. (That is, I have a text input, and use a
php function to verify it on the same page). I've tended to keep them
separate for de-bugging purposes. Should I consider re-writing them as
well?

Regards,
Andre

On Sunday 02 June 2002 08:16 pm, you wrote:
  

No *real* reason - just two not-so-important ones:

1. Clarity
Please compare these two:
-- MIXED
td bgcolor=?php echo $td_col; ? class=?php echo $prefclass; ?
?php $fldcontent=$myrow[0]?$myrow[0]:no data; ?
input type=text name=fname size=50 value=?php echo $fldcontent;
?
/td

-- PURE
?php
 echo(td bgcolor='$td_col' class='$prefclass'\n);
 $fldcontent=$myrow[0]?$myrow[0]:no data;
 echo(input type='text' name='fname' size='50'
value='$fldcontent'\n); ?

The second is much easier to read and understand, you must agree.

2. Speed
There's an urban legend saying that switching php tags on and off would
slow parsing down. I don't know if that's true and try to write pure
php as you call it due to the first reason.

Bogdan

Andre Dubuc wrote:


I've noticed that many people on the list code in 'pure' php, i.e.

?
print input type='text' name='fname' size='50';

// etc
?

Since most of my code is a mixture (the early stuff is 'mixed' html +
php), I've been wondering why code in 'pure' php? Is there some
compelling reason (that I'm unaware of) for doing so? Should I rewrite
all my earlier code into its 'pure' form? If so, what do I do with the
'! DOCTYPE . . .  statement -- put it in quotes too?

I would like to understand the reasons for writing code in this manner,
when all my code works fine, displays great: am I missing something
important here? Btw, I use the 'php' ending for all file names.

Your thoughts, opinions and suggestions would be greatly appreciated --
I'd like to do what is best.

Tia,
Andre
  


  





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




[PHP] Newbie Question - InstallShield PHP Installation with PWS

2002-06-02 Thread Jesse Segovia

Here's a newbie question.  I installed the Windows CGI InstallShield
version of PHP to use with the MS Personal Web Server I already have
working perfectly on my system.

On restarting my PC and trying a very simple php script, I get the error
at the bottom of this email.  Unfortunately there isn't much help for
the InstallShield version of PHP on the web site.  I'd rather get this
version working rather than install the manual version.

Can anyone help?


Security Alert! The PHP CGI cannot be accessed directly. 
This PHP CGI binary was compiled with force-cgi-redirect enabled. This
means that a page will only be served up if the REDIRECT_STATUS CGI
variable is set, e.g. via an Apache Action directive.

For more information as to why this behaviour exists, see the manual
page for CGI security.

For more information about changing this behaviour or re-enabling this
webserver, consult the installation file that came with this
distribution, or visit the manual page.


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




Re: [PHP] 'Pure' php vs 'mixed' (html + php)

2002-06-02 Thread Bogdan Stancescu

I fell for this some time ago - but the trick is that
1. You don't do for ($i=0; $i999; $i++) { echo Line $ibr\n; 
} in real life - you do stuff, call object methods, run queries, 
whatever, and in between those you have both html and php - and the 
remote machine waits for you to do all the extra stuff and _then_ 
waits for you to switch in and out of php for several times. I'm 
thinking about switching in and out of php in a really-mixed context - 
such as having blocks of html inside if() and while() blocks, stuff like 
that where you get to parse quite a number of php tags.
2. Your server doesn't only serve one client at a time - I'm surprised 
that you're starting with commercial sites and this piece of information 
isn't *always* present in your mind.

However, as I said in my original mail, there's an urban legend saying 
that [...] I don't know if that's true. So... I don't know if it 
actually slows things down or not.

Bogdan

Marcelo Leitner wrote:

On Mon, Jun 03, 2002 at 03:16:10AM +0300, Bogdan Stancescu wrote:
  

2. Speed
There's an urban legend saying that switching php tags on and off would 
slow parsing down. I don't know if that's true and try to write pure 
php as you call it due to the first reason.



I don't mind about this.. I'm starting with comercial pages now and before that
I noted that any script you run at the server, you will only see this latency
if the output is buffered or you have a ultra-fast machine with a
super-powerfull navigator that can renderize the page before it's fully sent to
the browser..
Try doing something like for ($i=0; $i999; $i++) { echo Line $ibr\n; }
Run the script in one machine and the browser at another.. you'll see that the
client machine has the cpu burned much more then the server..
You can see this when you're trying to open that big-flat-forums
all-in-one-page.. you'll get sometime 1. to receive that, 2. to renderize..
Note that you can only see the renderizing time if you're on a fast connection..

What I do take care is about excessive database searchs.. that can slow down
the things since I'll probably will not have a reserved server..

  

Bogdan


---end quoted text---

[]'s
  





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




Re: [PHP] 'Pure' php vs 'mixed' (html + php)

2002-06-02 Thread Michael Davey

 Point well-made. I suppose doing it the mixed way might have repercussions
 later on if/when the site grows. Perhaps while the code is still fresh in
my
 mid, it might be worth the effort to separate it.

 However, for a good part of the site, I've used CSS for appearance
details,
 and controlling a lot of stuff that changes from page-to-page. It's very
easy
 to change all or some of the pages from the CSS scripts. But, for the most
 part, not much of the actual php scripts COULD change, so that's why I've
 never bothered to separate html from php. Perhaps I wrong, but  . . .

I think it is a case of horses for courses - you are working on what sounds
like a fairly small project, and templatizing your code may be more
trouble than it is worth, so whatever feels best for you...



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




Re: [PHP] 'Pure' php vs 'mixed' (html + php)

2002-06-02 Thread Bogdan Stancescu

This whole discussion made me really curious - so you might want to 
check the attachments (access mixtest.php) for a very surprising result 
(please note mixed.php and pure.php are exactly the same size so this 
doesn't affect the test).

Bogdan

Marcelo Leitner wrote:

On Mon, Jun 03, 2002 at 04:42:46AM +0300, Bogdan Stancescu wrote:
  

I fell for this some time ago - but the trick is that
1. You don't do for ($i=0; $i999; $i++) { echo Line $ibr\n; 
} in real life - you do stuff, call object methods, run queries, 
whatever, and in between those you have both html and php - and the 
remote machine waits for you to do all the extra stuff and _then_ 
waits for you to switch in and out of php for several times. I'm 
thinking about switching in and out of php in a really-mixed context - 
such as having blocks of html inside if() and while() blocks, stuff like 
that where you get to parse quite a number of php tags.
2. Your server doesn't only serve one client at a time - I'm surprised 
that you're starting with commercial sites and this piece of information 
isn't *always* present in your mind.

However, as I said in my original mail, there's an urban legend saying 
that [...] I don't know if that's true. So... I don't know if it 
actually slows things down or not.

Bogdan


---end quoted text---

I gave that example to be a create a huge final page with the less time
as possible..
You never do that loop, but what about logfiles analysing? You have tons of
lines, probably splited by day, of all the accesses and whatever were done..
I did a some time ago a database of the itens from a MUD game.. I allowed
users to list the whole database, so they could read that and search for new
items for them.. but each item had 6 lines displayed, without tables or
anything, neither li/li.. only br and p..
when it got about 400 items, my PIII-733 321MB ram got under it's knees to
render that page.. it didn't have any fig or whatever that would need more
time to render..
I now that I'll not have a dedicated http server, but loosing microseconds
at each page on a server that has one thousand accesses per day is nothing..
And even if you're going to have that traffic you'll have better servers
that will deal with that and will probably run more processes at a time, so
a script that is coded slowly wouldn't break the other..
What I don't do is
...
if ($a == $x) { ?
  trtd align=center?echo $a?/td/tr
? } else { ?
  trtd align=right?echo $a?/td/tr
? }
...

That's really ugly! :)

[]'s
  





?
  if ($foo==bar) { ?
tdBla-bla - testing/td
?
$bar=$foo;
?
td?=$bar ?/td?
  }
?


?php
  if ($foo==bar) {
echo(tdBla-bla - testing/td\n);
$bar=$foo;
echo(td$bar/td\n);
  }
?


?php
  ini_set('max_execution_time', 600);
  function gettime() {
list($usec, $sec) = explode( , microtime());
return ((float)$usec + (float)$sec);
  }

  $t1=gettime();
  for ($i=0;$i!=1;$i++) {
include(mixed.php);
  }
  $t2=gettime();
  for ($i=0;$i!=1;$i++) {
include(pure.php);
  }
  $t3=gettime();

  echo(($t2-$t1).s for mixed code;br\n);
  echo(($t3-$t2).s for pure code.br\n);
  echo(round((($t3-$t2)/($t2-$t1)-1)*100,2).% more time used for bPURE/b 
code.br\n);
?



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


Re: [PHP] Setting PHP Include Dir

2002-06-02 Thread Bogdan Stancescu

That REALLY is a tricky one because it's documented the way you wrote it 
in most places, except where you (and I) should've looked: 
http://www.php.net/manual/en/configuration.php

The trick is that you must remove the equal sign.

Bogdan

Tim Thorburn wrote:

 Hi,

 I'm trying to set a PHP include directory for one of my sites.  I'm on 
 a shared hosting system, so I don't have access to the php.ini file.

 My plan was to do it using a .htaccess file in Apache - however I must 
 be doing something very much wrong, as it isn't working.

 Here is what I've tried:

 php_value include_dir = .:/data/sites/site_name/htdocs/includes

 I've checked the above path by running phpinfo(); on my site to 
 determine where its located on my servers hard drive.

 When I add the above line to my .htaccess file - I get a 500 Internal 
 Server Error.

 My site is using Apache 1.3.12 and PHP 3.0.18, any thoughts on how I 
 might get this to work?

 Thanks
 -Tim







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




[PHP] Re: simple email validation ereg

2002-06-02 Thread Manuel Lemos

Hello,

On 06/02/2002 01:13 AM, Justin French wrote:
 Hi,
 
 I know that there are more complex functions and classes out there for
 validating email address', but some of them do return invalid on
 *technically* valid, although uncommon email address', so all I want is a
 simple test for:

Instead of reinventing the wheel, you may want to try this PHP Classes 
that provides different levels of e-mail address validation.

http://www.phpclasses.org/emailvalidation
-- 

Regards,
Manuel Lemos


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




[PHP] session security

2002-06-02 Thread Giancarlo Pinerolo

Why can a user force php to create a session he's giving the name in the
URL?
Do you want me to list an half a dozen ways to get rich now with this
holes?
Does anyone understand the malice of this? 
Anyone can offer you a click on a session he's going to visit later and
hijack from you?
Anyone can post data in a black hole of his own and pass it around
secretly?
Anyone can place precise strings in a precise file location on a server?
How is it that a user can force to have any session string, passed in
the URL, being created, even when cookies are fully funcional and
enabled?
Is it possible that there is no policy on creating a new session? There
so much fuzz about register_globals, and we let the user create the
sessions they want?
Shouldn't we check that's us who issued the ticket? 

How is it that I cannot find a decent reply to these questions?

Giancarlo

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




Re: [PHP] 'Pure' php vs 'mixed' (html + php)

2002-06-02 Thread Bogdan Stancescu

I was getting a typical 2.5% more for pure PHP with the original order - 
switching them increases the difference to about 6.5% more for pure PHP. 
Make sure you run it several times before drawing any conclusions, BTW. 
Strange...

Bogdan

Marcelo Leitner wrote:

On Mon, Jun 03, 2002 at 05:18:50AM +0300, Bogdan Stancescu wrote:
  

This whole discussion made me really curious - so you might want to 
check the attachments (access mixtest.php) for a very surprising result 
(please note mixed.php and pure.php are exactly the same size so this 
doesn't affect the test).

Bogdan


---end quoted text---

But try inverting the order of the test, first test the pure, then the
mixed.. they will get almost equal..

[]'s
  





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




Re: [PHP] Include question

2002-06-02 Thread Analysis Solutions

Hey John:

On Sun, Jun 02, 2002 at 12:10:27AM -0400, John Holmes wrote:
 
 What I'm looking at is if each include .html file is 50K, am I loading
 100K into memory and then running the script, or running the script and
 only loading the appropriate 50K into memory when it's needed?

As of 4.0.2, stuff is only loaded when it's needed.  So, in your 
example, only 50k is brought in.

Note, this is yet another case where it pays for me to read the manual
before posting!  I was still thinking in the old way, where include() 
was conditional and require() was always done.

Ciao!

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

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




Re: [PHP] simple email validation ereg

2002-06-02 Thread Jason Wong

On Monday 03 June 2002 04:42, Alexander Skwar wrote:
 Justin French wrote:
 my aim will be to strip out anything that doesn't at least LOOK like like
  an email address.

 Well, instead of coming up with some clever regexp, I'd suggest to
 completely dump syntax checks.  Instead, I only check if the host has a
 MX entry associated.  If not, then this host either does not exist, or
 mails wouldn't get through.  At any rate, it's not a valid adress.

The lack of an MX record doesn't necessarily mean mail will not get through, 
so you cannot use that as a test for whether the address is valid.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Who needs friends when you can sit alone in your room and drink?
*/


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




Re: [PHP] Determine overhead of PHP script.

2002-06-02 Thread Analysis Solutions

JH:

On Sat, Jun 01, 2002 at 10:29:38PM -0400, John Holmes wrote:
 Is there a way to determine the overhead or memory usage of a PHP script
 as it runs? 

You could do some sort of exec() or system() type call.  For example, on 
a NetBSD (and similar unix type machines) you can do ps -o rss,command

Enjoy,

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

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




Re: [PHP] Determine overhead of PHP script.

2002-06-02 Thread Rasmus Lerdorf

PHP has a built-in mechanism for logging high-watermark memory usage by
scripts.  Make sure you compile PHP using --enable-memory-limit then you
can modify your Apache LogFormat and stick %{mod_php_memory_usage}n in
there somewhere which will be replaced with the peak memory usage for that
script in bytes.

-Rasmus

On Mon, 3 Jun 2002, Analysis  Solutions wrote:

 JH:

 On Sat, Jun 01, 2002 at 10:29:38PM -0400, John Holmes wrote:
  Is there a way to determine the overhead or memory usage of a PHP script
  as it runs?

 You could do some sort of exec() or system() type call.  For example, on
 a NetBSD (and similar unix type machines) you can do ps -o rss,command

 Enjoy,

 --Dan

 --
PHP classes that make web design easier
 SQL Solution  |   Layout Solution   |  Form Solution
 sqlsolution.info  | layoutsolution.info |  formsolution.info
  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
  4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

 --
 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




[PHP] Code dilema -- '.NULL.' or '.NULL.' or ...

2002-06-02 Thread Ricardo Fitzgerald

Hi,

I'm having troubles trying to insert form data into a mysql db, the
thing is my client wants table data to be splitted, I mean some data 
comes from the first form, and the rest from another form.
Then this is a portion of the php script.

// Add together proper fields to enter birth date
$fecha_nac = $ano_nac  + - + $mes_nac + - + $dia_nac;

// Open mysql db
mysql_select_db(intertur);

// SQL query insert all data into a table
$query = insert into RegistroPersonas values
('.NULL.','.$nombre.', '.$apellido.', '.NULL.', 
'.$direccion.', 
'.$ciudad.', '.NULL.',   '.NULL.', '.$pais.', '.$telefono.', 
'.$fax.', '.$email.', '.$login_usuario.', '.$clave.', 
'.$fecha_nac.',  '.NULL.',  '.NULL.' '.$sexo.',  '.NULL.',  
'.NULL.', '.NULL.', '.NULL.' );
 My problem is NOTHING gets inserted !!! 
 I filled all empty fields with NULL values
 It connects to the db but does nothing else
// Do query  
$result = mysql_query($query);

// this script has a form at the end, where the remaining fields are
// filled
// and calls the next script, where the tables are altered
// there and the empty fields filled with the values retrieved

I suppose to use Update in the next script , to enter remaining
data, but I'm not sure because the first field auto increments, 
and is the primary key.

TIA

Rick
AXIS Computers

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




Re: [PHP] Code dilema -- '.NULL.' or '.NULL.' or ...

2002-06-02 Thread Jason Wong

On Thursday 01 January 1970 08:00, Ricardo Fitzgerald wrote:

Your clock is broken!

 I'm having troubles trying to insert form data into a mysql db, the
 thing is my client wants table data to be splitted, I mean some data
 comes from the first form, and the rest from another form.
 Then this is a portion of the php script.

 // Add together proper fields to enter birth date
 $fecha_nac = $ano_nac  + - + $mes_nac + - + $dia_nac;

 // Open mysql db
 mysql_select_db(intertur);

 // SQL query insert all data into a table
 $query = insert into RegistroPersonas values
 ('.NULL.','.$nombre.', '.$apellido.', '.NULL.',
 '.$direccion.', '.$ciudad.', '.NULL.',   '.NULL.', '.$pais.',
 '.$telefono.', '.$fax.', '.$email.', '.$login_usuario.',
 '.$clave.',
 '.$fecha_nac.',  '.NULL.',  '.NULL.' '.$sexo.',  '.NULL.',
 '.NULL.', '.NULL.', '.NULL.' );
  My problem is NOTHING gets inserted !!!
  I filled all empty fields with NULL values
  It connects to the db but does nothing else

MySQL has it's own NULL, you should probably be using that rather than PHP's.

 // Do query
 $result = mysql_query($query);

Do some error checking -- how would you know what's going on if you don't 
check!?!

1) echo $query; // to check that it looks OK
2) $result = mysql_query($query) or die(mysql_error()); // to display any 
errors

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Bennett's Laws of Horticulture:
(1) Houses are for people to live in.
(2) Gardens are for plants to live in.
(3) There is no such thing as a houseplant.
*/


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




[PHP] preg_match_all href|src function

2002-06-02 Thread Michael Elms

Hi All,

I have being working on PHP perl compaitable regular expressions for the last 
month and cannot work out how to program a preg_match_all that will get the 
file.html from the following examples:

a href=file.html
a href='file.html'
a href=file.html
frame src=file.html
frame src='file.html'
frame src=file.html


The preg_match_all I have below only works for a href=file.html but not for 
the other variations...

preg_match_all(|href=\?([^\' ]+)|i, $data, $links);


I tried the preg_match_all below, but that didn't work...

preg_match_all(|(href|src)=([^\']+)?([^\' ]+)|i, $data, $links);


Any help would be greatly appreciated.

Regards,

Michael.

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