[PHP] ZEND_SET_SYMBOL compilation error

2003-03-12 Thread Joe Wong
Hi, I am writing a PHP extension on Win32. I put a ZEND_SET_SYMBOL in the
php_init_xxx_globals() and it failed to compile under Win32 using VC++ 5.0,
the error I got:

Y:\php-4.3.0\ext\wmcphp\wmcphp.c(138) : error C2065: 'tsrm_ls' : undeclared
identifier

Which corresponds to:

ZEND_SET_SYMBOL(EG(active_symbol_table), wmc_sort_by_uid, uid);

Any idea? It can be compiled under Linux without any problem..

Thanks!



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



[PHP] Re: ZEND_SET_SYMBOL compilation error

2003-03-12 Thread Joel Colombo
might want to post this to the developers group.
php.dev

Joel


Joe Wong [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi, I am writing a PHP extension on Win32. I put a ZEND_SET_SYMBOL in the
 php_init_xxx_globals() and it failed to compile under Win32 using VC++
5.0,
 the error I got:

 Y:\php-4.3.0\ext\wmcphp\wmcphp.c(138) : error C2065: 'tsrm_ls' :
undeclared
 identifier

 Which corresponds to:

 ZEND_SET_SYMBOL(EG(active_symbol_table), wmc_sort_by_uid, uid);

 Any idea? It can be compiled under Linux without any problem..

 Thanks!





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



[PHP] Making a Loop.

2003-03-12 Thread Philip J. Newman
I have this code to make this form list $x amount of times.

  for ($i = 1; $i = $number; $i++) {

  echoselect name=\$number\ size=\1\;

   // LIST ALL PRODUCTS IN DATABASE.

   $sql = SELECT * FROM products ORDER BY productCode ASC;
  $sql_result = mysql_query($sql, $connection) or die (Could not
get Query);

  while ($row = mysql_fetch_array($sql_result)) {

   $productCode=$row[productCode];
   echo option value=\$productCode\$productCode/optionbr;

   } // END WHILE.

 echo/select;


  }

and it dose not work any help?

--
Philip J. Newman.
Head Developer
[EMAIL PROTECTED]

+64 (9) 576 9491
+64 021-048-3999

--
Friends are like stars
You can't allways see them,
but they are always there.

--
Websites:

PhilipNZ.com - Design.
http://www.philipnz.com/
[EMAIL PROTECTED]

Philip's Domain // Internet Project.
http://www.philipsdomain.com/
[EMAIL PROTECTED]

Vital Kiwi / NEWMAN.NET.NZ.
http://www.newman.net.nz/
[EMAIL PROTECTED]



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



Re: [PHP] recently I meet a problem as follow ,I want to ask you

2003-03-12 Thread Chris Hewitt
jiahuo xiao wrote:

?phpinfo();?,it show many tables,it means I config
correctly.but why when I post pamameter to an action
page,all the pamaeter which I get is blank that is
.so the action page run incorrectly,how could I do? 
thank you for replying me 


It sounds as though you have register_globals off in php.ini. Either
turn it on, or better still, get at your variables on your action page
with $GET['var'] for get method or $POST['var'] for post variables. Look
this up in the fine manual.

HTH
Chris


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



[PHP] Weird slowdown using complex functions in a loop

2003-03-12 Thread pgcd
Hi,
I'm trying to write a script to do some basic XML validation - nothing
fancy, basically I just close open tags and check the arguments.
The script runs fine, except that, when I use it in a loop (I need to
validate roughly 200.000 posts), it gets progressively slower - like, the
first ten calls to the function need around 0.01 seconds, next ten take
0.03, then it's 0.1 and so on.
I've tried disabling parts of the code, I've tried profiling with dbg, I've
tried manually optimizing: nothing. I managed to reduce the slowdown a bit,
but it's still there, and very evident (as soon as I reach around a hundred
posts, a single function call takes as long as 10 seconds).

It may be interesting to note that I had to recode it from scratch: I wrote
a class to do the same processing, and *that* ate memory like crazy, ending
up with nearly 2 GB of used memory (according to XP taskman).

If anybody has come across a similar problem, I'd love to know what did they
do to solve it, but a suggestion on how to pinpoint the cause of the
slowdown would be great as well.

Uh, yes: I'm using PHP 4.2.2 and Apache 1.3.24 on an XP machine (but I've
tried using PHP 4.3.0 and Apache 2, with the same results).

pgcd




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



RE: [PHP] Making a Loop.[Scanned]

2003-03-12 Thread Michael Egan
Philip,

I might be missing something but just looking at the top few lines of your code the 
$number variable has no value.

The loop will run on howver many times corresponds to this value - with the value 
being null it's not going to run.

You'll need to pass in a value from elsewhere.

Michael Egan

-Original Message-
From: Philip J. Newman [mailto:[EMAIL PROTECTED]
Sent: 12 March 2003 08:21
To: [EMAIL PROTECTED]
Subject: [PHP] Making a Loop.[Scanned]


I have this code to make this form list $x amount of times.

  for ($i = 1; $i = $number; $i++) {

  echoselect name=\$number\ size=\1\;

   // LIST ALL PRODUCTS IN DATABASE.

   $sql = SELECT * FROM products ORDER BY productCode ASC;
  $sql_result = mysql_query($sql, $connection) or die (Could not
get Query);

  while ($row = mysql_fetch_array($sql_result)) {

   $productCode=$row[productCode];
   echo option value=\$productCode\$productCode/optionbr;

   } // END WHILE.

 echo/select;


  }

and it dose not work any help?

--
Philip J. Newman.
Head Developer
[EMAIL PROTECTED]

+64 (9) 576 9491
+64 021-048-3999

--
Friends are like stars
You can't allways see them,
but they are always there.

--
Websites:

PhilipNZ.com - Design.
http://www.philipnz.com/
[EMAIL PROTECTED]

Philip's Domain // Internet Project.
http://www.philipsdomain.com/
[EMAIL PROTECTED]

Vital Kiwi / NEWMAN.NET.NZ.
http://www.newman.net.nz/
[EMAIL PROTECTED]



-- 
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] Making a Loop.[Scanned]

2003-03-12 Thread Philip J. Newman
assuming the value is 10, I stall can't get it to work


- Original Message -
From: Michael Egan [EMAIL PROTECTED]
To: Philip J. Newman [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 9:29 PM
Subject: RE: [PHP] Making a Loop.[Scanned]


Philip,

I might be missing something but just looking at the top few lines of your
code the $number variable has no value.

The loop will run on howver many times corresponds to this value - with the
value being null it's not going to run.

You'll need to pass in a value from elsewhere.

Michael Egan

-Original Message-
From: Philip J. Newman [mailto:[EMAIL PROTECTED]
Sent: 12 March 2003 08:21
To: [EMAIL PROTECTED]
Subject: [PHP] Making a Loop.[Scanned]


I have this code to make this form list $x amount of times.

  for ($i = 1; $i = $number; $i++) {

  echoselect name=\$number\ size=\1\;

   // LIST ALL PRODUCTS IN DATABASE.

   $sql = SELECT * FROM products ORDER BY productCode ASC;
  $sql_result = mysql_query($sql, $connection) or die (Could not
get Query);

  while ($row = mysql_fetch_array($sql_result)) {

   $productCode=$row[productCode];
   echo option value=\$productCode\$productCode/optionbr;

   } // END WHILE.

 echo/select;


  }

and it dose not work any help?

--
Philip J. Newman.
Head Developer
[EMAIL PROTECTED]

+64 (9) 576 9491
+64 021-048-3999

--
Friends are like stars
You can't allways see them,
but they are always there.

--
Websites:

PhilipNZ.com - Design.
http://www.philipnz.com/
[EMAIL PROTECTED]

Philip's Domain // Internet Project.
http://www.philipsdomain.com/
[EMAIL PROTECTED]

Vital Kiwi / NEWMAN.NET.NZ.
http://www.newman.net.nz/
[EMAIL PROTECTED]



--
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] Making a Loop.

2003-03-12 Thread Larry_Li

Where is $number assignment? Because $number is ZERO, your code will not
run any statements in loop statement.

Larry



   
---
 
   

   To: [EMAIL PROTECTED] 

   cc: 

   Philip J. Newman  Subject:  [PHP] Making a Loop.  

   [EMAIL PROTECTED] 

   03/12/03 04:20 PM   

   

   






I have this code to make this form list $x amount of times.

  for ($i = 1; $i = $number; $i++) {

  echoselect name=\$number\ size=\1\;

   // LIST ALL PRODUCTS IN DATABASE.

   $sql = SELECT * FROM products ORDER BY productCode ASC;
  $sql_result = mysql_query($sql, $connection) or die (Could not
get Query);

  while ($row = mysql_fetch_array($sql_result)) {

   $productCode=$row[productCode];
   echo option value=\$productCode\$productCode/optionbr;

   } // END WHILE.

 echo/select;


  }

and it dose not work any help?

--
Philip J. Newman.
Head Developer
[EMAIL PROTECTED]

+64 (9) 576 9491
+64 021-048-3999

--
Friends are like stars
You can't allways see them,
but they are always there.

--
Websites:

PhilipNZ.com - Design.
http://www.philipnz.com/
[EMAIL PROTECTED]

Philip's Domain // Internet Project.
http://www.philipsdomain.com/
[EMAIL PROTECTED]

Vital Kiwi / NEWMAN.NET.NZ.
http://www.newman.net.nz/
[EMAIL PROTECTED]



--
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] recently I meet a problem as follow ,I want to ask you

2003-03-12 Thread Chris Hayes
At 03:56 12-3-03, you wrote:
web master engineer:
recently I encounter a problem as follow  ,I want
to ask you
My system is windows xp sp1, now I set up Apache
server V1.3.27 as localhost server and download
PHP4.3,I have configured PHP as SAPI Module.it can
work correctly as common php file which example for
?phpinfo();?,it show many tables,it means I config
correctly.but why when I post pamameter to an action
page,all the pamaeter which I get is blank that is
.so the action page run incorrectly,how could I do?
thank you for replying me
You did nothing wrong with the configuration, but PHP has changed the way 
it handles incoming variables now. The change happened with PHP 4.1.0. Form 
fields and parts of the url like page.php?var=1var2=2 are not 
automatically changed to variables anymore. When the form has an element 
such as

input name=fieldname

   you can read the value in the next page now with:

   $_POST['fieldname']

The reason for this new input mechanism is explained on 
http://www.php.net/release_4_1_0.php. There are ways to tell PHP to use the 
old way, i _think_ that was setting
   register_globals=On
in the php.ini file.



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


Re: [PHP] Making a Loop.[Scanned]

2003-03-12 Thread Hugh Danaher
 echoselect name=\$number\ size=\1\;  // in this statement you are
asking that a number be a variable in php and that is not permitted.
try:
for ($i=0;$i=10;$i++)
{
echo select name=\var_name[$i]\ ;  // this way your select name is
var_name[1] and not 1

also,
echo option value=\$productCode\$productCode/optionbr;

try instead,
echo option$productCode;  // no br needed here and the option doesn't
need a value

- Original Message -
From: Philip J. Newman [EMAIL PROTECTED]
To: Michael Egan [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 12:32 AM
Subject: Re: [PHP] Making a Loop.[Scanned]


 assuming the value is 10, I stall can't get it to work


 - Original Message -
 From: Michael Egan [EMAIL PROTECTED]
 To: Philip J. Newman [EMAIL PROTECTED];
[EMAIL PROTECTED]
 Sent: Wednesday, March 12, 2003 9:29 PM
 Subject: RE: [PHP] Making a Loop.[Scanned]


 Philip,

 I might be missing something but just looking at the top few lines of your
 code the $number variable has no value.

 The loop will run on howver many times corresponds to this value - with
the
 value being null it's not going to run.

 You'll need to pass in a value from elsewhere.

 Michael Egan

 -Original Message-
 From: Philip J. Newman [mailto:[EMAIL PROTECTED]
 Sent: 12 March 2003 08:21
 To: [EMAIL PROTECTED]
 Subject: [PHP] Making a Loop.[Scanned]


 I have this code to make this form list $x amount of times.

   for ($i = 1; $i = $number; $i++) {

   echoselect name=\$number\ size=\1\;

// LIST ALL PRODUCTS IN DATABASE.

$sql = SELECT * FROM products ORDER BY productCode ASC;
   $sql_result = mysql_query($sql, $connection) or die (Could not
 get Query);

   while ($row = mysql_fetch_array($sql_result)) {

$productCode=$row[productCode];
echo option value=\$productCode\$productCode/optionbr;

} // END WHILE.

  echo/select;


   }

 and it dose not work any help?

 --
 Philip J. Newman.
 Head Developer
 [EMAIL PROTECTED]

 +64 (9) 576 9491
 +64 021-048-3999

 --
 Friends are like stars
 You can't allways see them,
 but they are always there.

 --
 Websites:

 PhilipNZ.com - Design.
 http://www.philipnz.com/
 [EMAIL PROTECTED]

 Philip's Domain // Internet Project.
 http://www.philipsdomain.com/
 [EMAIL PROTECTED]

 Vital Kiwi / NEWMAN.NET.NZ.
 http://www.newman.net.nz/
 [EMAIL PROTECTED]



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



[PHP] what problem in this sql

2003-03-12 Thread Alawi
  SELECT type_id, type_name, cont_id, type_id, cont_title, cat_id, cat_name
  FROM cont_data, cont_cats, cont_types
  WHERE contdata.cont_id = $cont_id
  AND cont_data.type_id = cont_types.type_id
  AND cont_data.cat_id = cont_cats.cat_id


-
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online

[PHP] PHP Books

2003-03-12 Thread Chris Blake
Greetings learned PHP(eople),

Can anyone offer comment on the following books on PHP.
I`m in the early stages of PHP and am looking for a suitable guide to
begin with.
=
Sams Teach Yourself PHP MYSQL and Apache in 24 Hours
Publisher:  Sams Publishing
ISBN:  067232489X
Publishing Date:  2003
Format:  Paperback
=
PHP BIBLE
Author:  Tim Converse
Publisher:  WILEY
ISBN:  0764549553
Pages:  875
Format:  Paperback
==
Beginner's Guides (Osborne): PHP 4: A Beginner's Guide
Author:  Bill McCarty and William McCarty
Publisher:  MCGRAW HILL
ISBN:  0072133716
Publishing Date:  2001
Pages:  544
Format:  Paperback


If anyone has used these manuals I would appreciate your input as I
don`t wanna spend a fortune on a manual and then find out it`s [EMAIL PROTECTED]
-- 
Chris Blake
Office : (011) 782-0840
Cell : 083 985 0379
Your mouse has moved. Windows must be restarted for the change to take
effect. Reboot now? [ OK ]


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



[PHP] Re: what problem in this sql

2003-03-12 Thread Joel Colombo
when using multiple tables u must specify where the fields u want are coming
from too.
also the first piece of your WHERE has contdata NOT cont_data.

i just slapped the cont_data.* to all your field names u may want those
fields from different tables

SELECT cont_data.type_id, cont_data.type_name, cont_data.cont_id,
cont_data.type_id, cont_data.cont_title, cont_data.cat_id,
cont_data.cat_name
  FROM cont_data, cont_cats, cont_types
  WHERE contdata.cont_id = $cont_id
  AND cont_data.type_id = cont_types.type_id
  AND cont_data.cat_id = cont_cats.cat_id

just remember when pointing to more then 1 table in FROM. u must always
specify where u are selecting from as well unless u SELECT * FROM t1,
t2... that will work or SELECT t1.*, t2.field_a, t2.field_c... works also.

Joel Colombo




Alawi [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
   SELECT type_id, type_name, cont_id, type_id, cont_title, cat_id,
cat_name
   FROM cont_data, cont_cats, cont_types
   WHERE contdata.cont_id = $cont_id
   AND cont_data.type_id = cont_types.type_id
   AND cont_data.cat_id = cont_cats.cat_id


 -
 Do you Yahoo!?
 Yahoo! Web Hosting - establish your business online



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



Re: [PHP] recently I meet a problem as follow ,I want to ask you

2003-03-12 Thread Justin French
on 12/03/03 7:40 PM, Chris Hewitt ([EMAIL PROTECTED]) wrote:

 jiahuo xiao wrote:
 
 ?phpinfo();?,it show many tables,it means I config
 correctly.but why when I post pamameter to an action
 page,all the pamaeter which I get is blank that is
 .so the action page run incorrectly,how could I do?
 thank you for replying me
 
 
 It sounds as though you have register_globals off in php.ini. Either
 turn it on, or better still, get at your variables on your action page
 with $GET['var'] for get method or $POST['var'] for post variables. Look
 this up in the fine manual.

small correction $_GET['var'] and $_POST['var'] not $GET['var'] and
$POST['var']

:)

Justin


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



[PHP] Re: what problem in this sql

2003-03-12 Thread Joel Colombo
oh and i just noticed u want to select the 'type_id' twice... i assume from
each table SO u need to...

SELECT table1.type_id AS t1_type_id, table2.type_id AS t2_type_id FROM t1,
t2
use the 'AS' function it helps with a lot of headache later... trying to
figure out y u get the wrong index !

Joel


Alawi [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
   SELECT type_id, type_name, cont_id, type_id, cont_title, cat_id,
cat_name
   FROM cont_data, cont_cats, cont_types
   WHERE contdata.cont_id = $cont_id
   AND cont_data.type_id = cont_types.type_id
   AND cont_data.cat_id = cont_cats.cat_id


 -
 Do you Yahoo!?
 Yahoo! Web Hosting - establish your business online



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



[PHP] date check

2003-03-12 Thread Fredrik
Hi

I want to check if  $var  14 days or $var   14 days

($var = $date2  - $date1)

$date1 = 2003-01-16;
$date2 = 2003-03-16;


How can i check this?
Are there any functions for this or do i have to make one?





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



[PHP] Installation problem

2003-03-12 Thread Frankie Li
Hi there,

I just installed latest Apache.1.3.27 and PHP.4.3.1 on my Linux box with
redhat 7.0. Both installation are OK. but when I restart the httpd server
again, some error exists. here is the message.

Q.T.E
Starting httpd: Syntax error on line 205 of
/usr/local/apache/conf/httpd.conf:
API module structure `php4_module' in file
/usr/local/apache/libexec/libphp4.so
is garbled - perhaps this is not an Apache module DSO?
[FAILED]

U.N.Q.T.E

line 205 on httpd.conf is
LoadModule php4_modulelibexec/libphp4.so

It look likes that the PHP module can't be loaded into apached server.

would someone give me a tips?

Thanks regards,
Frankie.
12-03-2003




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



Re: [PHP] PHP Books

2003-03-12 Thread Petre Agenbag
Hi Chris

The first book, Teach Yourself PHP and MySQL in 24 Hrs: I got that one
myself, but it tends to gather dust nowadays...
It was very useful in the beginning with learning the basix syntax etc,
but I quickly outgrew it, and rarely use it at all, not even for
reference.

I got the book called PHP and MySQL web development by Luke Welling and
Laura Thompson. This is a great book, I sleep with it under my pillow
and use it regularly as a reference to examples. I'd say it's basic
enough to start out with, yet advanced enough to keep you interested as
you grow more adept.

BUT, I must admit, at this point, the single resource I use the most wrt
PHP is the manual that comes with PHP, great reference to functions etc,
but of course, you need to know of these functions before you can just
refer to them... So, I would still suggest getting the Luke Welling et
al book. There's a new edition on Amazon for $35, plus shipping of about
$25. The last time I ordered, the Rand was much weaker, and the VAT was
about R55, bringing my total to about R800, but it's well worth it...

There is also a new book by Rasmus Lerdorf and it's cheaper than the
book I mention, unfortunately I don't have insight into that book, and
what would the guy that wrote PHP know about it anyway heh? ;p


On Wed, 2003-03-12 at 11:45, Chris Blake wrote:
 Greetings learned PHP(eople),
 
 Can anyone offer comment on the following books on PHP.
 I`m in the early stages of PHP and am looking for a suitable guide to
 begin with.
 =
 Sams Teach Yourself PHP MYSQL and Apache in 24 Hours
 Publisher:  Sams Publishing
 ISBN:  067232489X
 Publishing Date:  2003
 Format:  Paperback
 =
 PHP BIBLE
 Author:  Tim Converse
 Publisher:  WILEY
 ISBN:  0764549553
 Pages:  875
 Format:  Paperback
 ==
 Beginner's Guides (Osborne): PHP 4: A Beginner's Guide
 Author:  Bill McCarty and William McCarty
 Publisher:  MCGRAW HILL
 ISBN:  0072133716
 Publishing Date:  2001
 Pages:  544
 Format:  Paperback
 
 
 If anyone has used these manuals I would appreciate your input as I
 don`t wanna spend a fortune on a manual and then find out it`s [EMAIL PROTECTED]
 -- 
 Chris Blake
 Office : (011) 782-0840
 Cell : 083 985 0379
 Your mouse has moved. Windows must be restarted for the change to take
 effect. Reboot now? [ OK ]
 
 
 -- 
 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] storing html pages in a database

2003-03-12 Thread Wilbert Enserink
Hi all,


for reasons I'm thinking of storing complete HTML pages in a database. lets' say a 
HTML file size is about 20kb.
Are there any restrictions i doing this? 
Is this 20kb alot for a mysql database, does it become slow?
Should I save the file as binary data rather the ASCII?? 

Any tips with regard to this subject are most appreciated.

thx Wilbert

-
Pas de Deux
Van Mierisstraat 25
2526 NM Den Haag
tel 070 4450855
fax 070 4450852
http://www.pdd.nl
[EMAIL PROTECTED]
-

[PHP] what the hell in this sql

2003-03-12 Thread Alawi

  SELECT * FROM cont_types, cont_data, cont_cats 
  WHERE cont_data.cont_id = $cont_id
  AND cont_types.type_id = cont_data.type_id
  AND cont_cats.cat_id = cont_data.cat_id


its not work , give me 1064 



-
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online

RE: [PHP] what the hell in this sql

2003-03-12 Thread George Pitcher
Firstly,

This isn't a php question and should be directed at a sql list or to php-db

Have you lokked at erro 1064 in the manual? What does it say?

There are several things that you should do before coming to the list with a
problem.

Without checking I suspect that you need to specify a 'JOIN' in your
statement - again refere to the manual for instructions.

George

 -Original Message-
 From: Alawi [mailto:[EMAIL PROTECTED]
 Sent: 12 March 2003 11:07 am
 To: [EMAIL PROTECTED]
 Subject: [PHP] what the hell in this sql



   SELECT * FROM cont_types, cont_data, cont_cats
   WHERE cont_data.cont_id = $cont_id
   AND cont_types.type_id = cont_data.type_id
   AND cont_cats.cat_id = cont_data.cat_id


 its not work , give me 1064



 -
 Do you Yahoo!?
 Yahoo! Web Hosting - establish your business online


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



[PHP] Threading objects

2003-03-12 Thread Kris
I want to be able to thread objects. I'm not really sure at all where to
start. but I want a script where multiple objects are being processed at the
same time.
I have an example php script

?

$a = new sleeper();
$b = new sleeper();
$c = new sleeper();

$a-sleepFor(10);
$b-sleepFor(5);
$c-sleepFor(1);

class sleeper {

 function sleepFor($num) {
  sleep($num);
  echo sorry I was a sleep for $num \r\n;
 }

}

?

I want so object $c would print then object $b then object $a as the
sleeping time is less and less.
Does that make sense? Please ask if you don't understand

Thanks for any help you can offer what so ever.

Kris




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



[PHP] two questions about usning session.

2003-03-12 Thread Joe Wong
Hello,

  I have two questions about using sessions in PHP.

Firstly, I use session to remeber the username and a session ID for the
given user. When I hit the BACK button on the browser (IE), it always set
that my page is expired and ask me to click the refresh button. How to
prevent this from happening?

Secondly, how is the PHP session ID be computed? When user A login, a
session is started and his name nad session ID are stored. Now, on the same
PC, I start another instance of the IE browser, login as User B, her name
and session ID are stored under the same PHP session file. I switch back to
the Windows of User A and continue to do something, the PHP session gives me
the name of User B and User'B session ID. Why? Am I doing something wrong
here?

Thanks,

- JOE



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



Re: [PHP] Threading objects

2003-03-12 Thread W. Enserink
i'm not sure what you want. But you have created objects here in $a,$b and
$c.
If you want to order them in a special way you have to write the
functionality of course. I think you have to do this before the object is
created because you define the variables 10,5,1 before the objects are
created. Once the objects are created they themselves don't know nothing
form each other. So th eparent object has to control this, or in your case a
'parent piece of script'.

You can use $a,$b,and $c as regular,ordinary variables.  further on.

hope it helped,

Wilbert

- Original Message -
From: Kris [EMAIL PROTECTED]
To: PHP List [EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 12:18 PM
Subject: [PHP] Threading objects


 I want to be able to thread objects. I'm not really sure at all where to
 start. but I want a script where multiple objects are being processed at
the
 same time.
 I have an example php script

 ?

 $a = new sleeper();
 $b = new sleeper();
 $c = new sleeper();

 $a-sleepFor(10);
 $b-sleepFor(5);
 $c-sleepFor(1);

 class sleeper {

  function sleepFor($num) {
   sleep($num);
   echo sorry I was a sleep for $num \r\n;
  }

 }

 ?

 I want so object $c would print then object $b then object $a as the
 sleeping time is less and less.
 Does that make sense? Please ask if you don't understand

 Thanks for any help you can offer what so ever.

 Kris




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

- 
Pas de Deux 
Van Mierisstraat 25 
2526 NM Den Haag 
tel 070 4450855 
fax 070 4450852 
http://www.pdd.nl 
[EMAIL PROTECTED] 
-

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



RE: [PHP] date check

2003-03-12 Thread Niklas Lampén
$FourteenDays = 86400 * 14;
$var = $FourteenDays - (strtotime($date2) - strtotime($date1));

Now if $var is  0, 14 days has not passed.


Niklas

-Original Message-
From: Fredrik [mailto:[EMAIL PROTECTED] 
Sent: 12. maaliskuuta 2003 12:06
To: [EMAIL PROTECTED]
Subject: [PHP] date check


Hi

I want to check if  $var  14 days or $var   14 days

($var = $date2  - $date1)

$date1 = 2003-01-16;
$date2 = 2003-03-16;


How can i check this?
Are there any functions for this or do i have to make one?





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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



Re: [PHP] Threading objects

2003-03-12 Thread Kris
Hi Wilbert

Thanks for responding. However I am completely aware of how objects work as
I come from a Java back ground.
If you are familiar with Java at all I'm looking for something like the
PipedOutputStream, PipedInputStream and Thread classes

I want the processes objects to be threaded, therefore processing
simultaneously.
This would mean $c would print first as it slept for the least amount of
time.

All I'm really asking is how do you initiate threading with PHP?
A small example would be nice

Regards

Kris


- Original Message -
From: W. Enserink [EMAIL PROTECTED]
To: Kris [EMAIL PROTECTED]; PHP List [EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 9:29 PM
Subject: Re: [PHP] Threading objects


 i'm not sure what you want. But you have created objects here in $a,$b and
 $c.
 If you want to order them in a special way you have to write the
 functionality of course. I think you have to do this before the object is
 created because you define the variables 10,5,1 before the objects are
 created. Once the objects are created they themselves don't know nothing
 form each other. So th eparent object has to control this, or in your case
a
 'parent piece of script'.

 You can use $a,$b,and $c as regular,ordinary variables.  further on.

 hope it helped,

 Wilbert

 - Original Message -
 From: Kris [EMAIL PROTECTED]
 To: PHP List [EMAIL PROTECTED]
 Sent: Wednesday, March 12, 2003 12:18 PM
 Subject: [PHP] Threading objects


  I want to be able to thread objects. I'm not really sure at all where to
  start. but I want a script where multiple objects are being processed at
 the
  same time.
  I have an example php script
 
  ?
 
  $a = new sleeper();
  $b = new sleeper();
  $c = new sleeper();
 
  $a-sleepFor(10);
  $b-sleepFor(5);
  $c-sleepFor(1);
 
  class sleeper {
 
   function sleepFor($num) {
sleep($num);
echo sorry I was a sleep for $num \r\n;
   }
 
  }
 
  ?
 
  I want so object $c would print then object $b then object $a as the
  sleeping time is less and less.
  Does that make sense? Please ask if you don't understand
 
  Thanks for any help you can offer what so ever.
 
  Kris
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php

 -
 Pas de Deux
 Van Mierisstraat 25
 2526 NM Den Haag
 tel 070 4450855
 fax 070 4450852
 http://www.pdd.nl
 [EMAIL PROTECTED]
 -

 --
 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] Threading objects

2003-03-12 Thread Mincu Alexandru
I think that he wants a function that acts like steTimeout(..) in
JavaScript ex:
code
setTimeout('alert('tst2')',5000);
setTimeout('alert('tst1')',4000);
/code
When you exec this code in js the first alert that is executed is tst1
and then tst2.
I don't know if you can do this in php without using threads.
I am not sure that this is the only function he whants to use this way,
but if I am not wrong threading dose the job very well.

btw what is the status of that project? Is it functional yet? I havent
read the php-dev discutions on this yet.


On Wed, 2003-03-12 at 13:29, W. Enserink wrote:
 i'm not sure what you want. But you have created objects here in $a,$b and
 $c.
 If you want to order them in a special way you have to write the
 functionality of course. I think you have to do this before the object is
 created because you define the variables 10,5,1 before the objects are
 created. Once the objects are created they themselves don't know nothing
 form each other. So th eparent object has to control this, or in your case a
 'parent piece of script'.
 
 You can use $a,$b,and $c as regular,ordinary variables.  further on.
 
 hope it helped,
 
 Wilbert
 
 - Original Message -
 From: Kris [EMAIL PROTECTED]
 To: PHP List [EMAIL PROTECTED]
 Sent: Wednesday, March 12, 2003 12:18 PM
 Subject: [PHP] Threading objects
 
 
  I want to be able to thread objects. I'm not really sure at all where to
  start. but I want a script where multiple objects are being processed at
 the
  same time.
  I have an example php script
 
  ?
 
  $a = new sleeper();
  $b = new sleeper();
  $c = new sleeper();
 
  $a-sleepFor(10);
  $b-sleepFor(5);
  $c-sleepFor(1);
 
  class sleeper {
 
   function sleepFor($num) {
sleep($num);
echo sorry I was a sleep for $num \r\n;
   }
 
  }
 
  ?
 
  I want so object $c would print then object $b then object $a as the
  sleeping time is less and less.
  Does that make sense? Please ask if you don't understand
 
  Thanks for any help you can offer what so ever.
 
  Kris
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 - 
 Pas de Deux 
 Van Mierisstraat 25 
 2526 NM Den Haag 
 tel 070 4450855 
 fax 070 4450852 
 http://www.pdd.nl
 [EMAIL PROTECTED] 
 -
-- 
Mincu Alexandru intelinet.ro
Tel:+4 0745 369719  +4 021 3140021
www.intelinet.ro[EMAIL PROTECTED]



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



Re: [PHP] recently I meet a problem as follow ,I want to ask you

2003-03-12 Thread Chris Hewitt
Justin French wrote:

on 12/03/03 7:40 PM, Chris Hewitt ([EMAIL PROTECTED]) wrote:

It sounds as though you have register_globals off in php.ini. Either
turn it on, or better still, get at your variables on your action page
with $GET['var'] for get method or $POST['var'] for post variables. Look
this up in the fine manual.
small correction $_GET['var'] and $_POST['var'] not $GET['var'] and
$POST['var']
:)

Justin

Gulp! Yes! That is what I get for trying to do my email too quickly! 
Thanks for correcting me.

Chris

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


Re: [PHP] PHP Books

2003-03-12 Thread Chris Hewitt
Petre Agenbag wrote:

There is also a new book by Rasmus Lerdorf and it's cheaper than the
book I mention, unfortunately I don't have insight into that book, and
what would the guy that wrote PHP know about it anyway heh? ;p
Its Programming PHP by Rasmus Lerdorf and Kevin Tatroe, O'Reilly, 
March 2002, ISBN: 1-56592-610-2. Its the only PHP book I have so I can't 
make a comparison, but I get on well with it and can recommend it.

I also think the manual is good. It does take some searching through to 
find things until you know what there is and where to find them. I 
initially only used this, until I got Rasmus's book.

I also learnt (am still learning) a lot by simply monitoring this list. 
I have been able to avoid several pitfalls because of it so I recommend 
continuing to stay on it.

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


Re: [PHP] Threading objects

2003-03-12 Thread Mirek Novak
Kris wrote:
I want to be able to thread objects. I'm not really sure at all where to
start. but I want a script where multiple objects are being processed at the
same time.
I have an example php script
?

$a = new sleeper();
$b = new sleeper();
$c = new sleeper();
$a-sleepFor(10);
$b-sleepFor(5);
$c-sleepFor(1);
class sleeper {

 function sleepFor($num) {
  sleep($num);
  echo sorry I was a sleep for $num \r\n;
 }
}

?

I want so object $c would print then object $b then object $a as the
sleeping time is less and less.
Does that make sense? Please ask if you don't understand
Thanks for any help you can offer what so ever.

Kris




Hi,
generally, multithreading (using system threads) within PHP is
impossible, AFAIK. Of course running (apache) processes can communicate
via shm but it is not multithreading. Your code will be executed
sequentially as written. One sleep will start after another ends. There
is not known, to me, solution, sorry :(;
--
Mirek Novak
Anima Publishers, s.r.o.
Prilucka 360,
Zlin 760 01
Czech Republic
tel/fax: +420577219132
GSM:+420603807837
jabber:[EMAIL PROTECTED]
ICQ:119499448
AUTO.CZ
http://www.auto.cz
NEWS.AUTO.CZ
http://news.auto.cz
FORMULE1.CZ
http://www.formule1.cz
--
Mirek Novak
Anima Publishers, s.r.o.
Prilucka 360,
Zlin 760 01
Czech Republic
tel/fax: +420577219132
GSM:+420603807837
jabber:[EMAIL PROTECTED]
ICQ:119499448
AUTO.CZ
http://www.auto.cz
NEWS.AUTO.CZ
http://news.auto.cz
FORMULE1.CZ
http://www.formule1.cz
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] two questions about usning session.

2003-03-12 Thread Justin French
on 07/03/03 5:45 PM, Joe Wong ([EMAIL PROTECTED]) wrote:

 Hello,
 
 I have two questions about using sessions in PHP.
 
 Firstly, I use session to remeber the username and a session ID for the
 given user. When I hit the BACK button on the browser (IE), it always set
 that my page is expired and ask me to click the refresh button. How to
 prevent this from happening?

That sounds like a problem with POSTed data from forms, not necessarily a
problem with sessions, or a problem a browser.

Have you got a URL we can play with?


 Secondly, how is the PHP session ID be computed? When user A login, a
 session is started and his name nad session ID are stored. Now, on the same
 PC, I start another instance of the IE browser, login as User B, her name
 and session ID are stored under the same PHP session file. I switch back to
 the Windows of User A and continue to do something, the PHP session gives me
 the name of User B and User'B session ID. Why? Am I doing something wrong
 here?

Definitely.

- enable cookies on your browser
- make sure you're using PHP = 4.1

1. Start with a blank text file.

2. Copy and paste this in:
---
?php
session_start();
if (!isset($_SESSION['count'])) {
$_SESSION['count'];
}
else {
$_SESSION['count']++;
}
?
Hello visitor, you have seen this page ?php echo $_SESSION['count'] ?
times.p
To continue, A HREF=?php echo $_SERVER['PHP_SELF']; ?click here/A
---

3. Open it up in your browser, and test that it works (the value of
$_SESSION['count'] should increase with each click)

4. If that much works, open up the URL in a second window, and try to run
two separate sessions... (the first window might be on 10 clicks, and the
new one will be starting from 1)

5. If we're still cool, now try it without cookies maybe, by adding the SID
to the URL that they click on.


If all this works, then the problem is obviously in your code somewhere, not
an issue with PHP/sessions/browsers/cookies/etc.


Justin



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



RE: [PHP] Re: [PHP-DB] How to Connect remote DB server?

2003-03-12 Thread Niklas Lampén
Possibly the db-server is accepting only localhost connections.


Niklas


-Original Message-
From: Patrick LOK [mailto:[EMAIL PROTECTED] 
Sent: 12. maaliskuuta 2003 14:39
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP] Re: [PHP-DB] How to Connect remote DB server?


There is no firewall within the LAN environment.

I tried the mssql_connect too using mssql_connect(testdb,sa,) but same
error returned! Any idea?

./pl

Jason Wong [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Wednesday 12 March 2003 19:28, Patrick LOK wrote:
  It is possible to connect a remote db server using x_connect? 
  e.g. a PostgreSQL in server PSQLDB, ip=192.168.0.100  and a MSSQL 
  server MSSQLDB, ip=192.168.0.110
 
  I tried pgsql_connect(psqldb,administrator,) 
  pgsql_connect(192.168.0.100,administrator,) but failed!
 
  Error is Unable to connect to server: psqldb in psqltest.php on 
  line 2

  Unable to connect to server: 192.168.0.100 in psqltest.php on line 
  2

 Yes, it is possible to connect to a remote DB server. You have to make
sure
 that:

 a) the DB server in question is configured to accept remote 
 connections
 b) any intervening firewall is correctly configured to allow DB traffic


 --
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development 
 *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-db
 --
 /*
 Dr. Livingston?
 Dr. Livingston I. Presume?
 */




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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



[PHP] Another questions about usning session.

2003-03-12 Thread André Cupini
* People, sorry my ugly English. I´m Brazilian...

I am looking for learning more about sessions... I´m test this code below
don´t work with me My php version is 4.1.2.
Anybody have a complete example code of how use sessions?
Another doubt: Sessions use cookies? What the advantage in use sessions
instead of cookies?

André Cupini
Programador
[EMAIL PROTECTED]
NeoBiz - fábrica de internet
http://www.neobiz.com.br


Definitely.

- enable cookies on your browser
- make sure you're using PHP = 4.1

1. Start with a blank text file.

2. Copy and paste this in:
---
?php
session_start();
if (!isset($_SESSION['count'])) {
$_SESSION['count'];
}
else {
$_SESSION['count']++;
}
?
Hello visitor, you have seen this page ?php echo $_SESSION['count'] ?
times.p
To continue, A HREF=?php echo $_SERVER['PHP_SELF']; ?click here/A
---

3. Open it up in your browser, and test that it works (the value of
$_SESSION['count'] should increase with each click)

4. If that much works, open up the URL in a second window, and try to run
two separate sessions... (the first window might be on 10 clicks, and the
new one will be starting from 1)

5. If we're still cool, now try it without cookies maybe, by adding the SID
to the URL that they click on.


If all this works, then the problem is obviously in your code somewhere, not
an issue with PHP/sessions/browsers/cookies/etc.


Justin



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


Re: [PHP] Weird slowdown using complex functions in a loop

2003-03-12 Thread Jimmy Brake
where are you storing the information that you are cleaning once it is
cleaned?

are you appending it to a variable in the script?

On Wed, 2003-03-12 at 00:26, pgcd wrote:
 Hi,
 I'm trying to write a script to do some basic XML validation - nothing
 fancy, basically I just close open tags and check the arguments.
 The script runs fine, except that, when I use it in a loop (I need to
 validate roughly 200.000 posts), it gets progressively slower - like, the
 first ten calls to the function need around 0.01 seconds, next ten take
 0.03, then it's 0.1 and so on.
 I've tried disabling parts of the code, I've tried profiling with dbg, I've
 tried manually optimizing: nothing. I managed to reduce the slowdown a bit,
 but it's still there, and very evident (as soon as I reach around a hundred
 posts, a single function call takes as long as 10 seconds).
 
 It may be interesting to note that I had to recode it from scratch: I wrote
 a class to do the same processing, and *that* ate memory like crazy, ending
 up with nearly 2 GB of used memory (according to XP taskman).
 
 If anybody has come across a similar problem, I'd love to know what did they
 do to solve it, but a suggestion on how to pinpoint the cause of the
 slowdown would be great as well.
 
 Uh, yes: I'm using PHP 4.2.2 and Apache 1.3.24 on an XP machine (but I've
 tried using PHP 4.3.0 and Apache 2, with the same results).
 
 pgcd
 
 
 


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



Re: [PHP] Is PHP designed (have the capability) to access remote DB?

2003-03-12 Thread Patrick LOK
Do u meant PHP can only access localhost DB?

./pl



Clint Tredway [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 PHP can access any database that the server that PHP is running on can get
 to and has the correct permissions to get to the database.

 Clint

 -Original Message-
 From: Patrick LOK [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 12, 2003 7:26 AM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Subject: [PHP] Is PHP designed (have the capability) to access remote
 DB?


 Is PHP designed (have the capability) to access remote DB?

 Is there any PHP developer willing to answer the question?

 ./pl



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



RE: [PHP] Is PHP designed (have the capability) to access remote DB?

2003-03-12 Thread Clint Tredway
No, PHP can access a database on another server on the same network or
across the internet. The web server that PHP is running just has to be able
to see the server that the database is on.

Clint

-Original Message-
From: Patrick LOK [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 7:30 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Is PHP designed (have the capability) to access
remote DB?


Do u meant PHP can only access localhost DB?

./pl



Clint Tredway [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 PHP can access any database that the server that PHP is running on can get
 to and has the correct permissions to get to the database.

 Clint

 -Original Message-
 From: Patrick LOK [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 12, 2003 7:26 AM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Subject: [PHP] Is PHP designed (have the capability) to access remote
 DB?


 Is PHP designed (have the capability) to access remote DB?

 Is there any PHP developer willing to answer the question?

 ./pl



-- 
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] Re: [PHP-DEV] Is PHP designed (have the capability) to access remote DB?

2003-03-12 Thread Patrick LOK
IT IS ABOUT THE DESIGN AND DEVELOPMENT OF PHP



Derick Rethans [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Stop posting user questions to the php-dev and php5-dev list, as I
 explained before.

 Derick

 On Wed, 12 Mar 2003, Patrick LOK wrote:

  Is PHP designed (have the capability) to access remote DB?
 
  Is there any PHP developer willing to answer the question?
 
  ./pl
 

 --
 my other box is your windows PC
 -
  Derick Rethans http://derickrethans.nl/
  PHP Magazine - PHP Magazine for Professionals   http://php-mag.net/
 -



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



[PHP] Hacker problem

2003-03-12 Thread Pag
	Been having some hacker problems on my site, and a simple one:

	I have a shoutbox, a simple form with name and text that adds lines to the 
database. I do checks for insults, too long words, tags, etc, but its still 
possible to circumvent those checks by adding the data on the url instead 
of using the form. something like:

 	www.domain.com/shoutb.php?name=hackertext=generalnonsenseandbadwords

	To prevent this, i tried tracing the http_referral so that only data from 
inside the site goes into the shoutbox. THe problem is that if you do that 
url above after visiting my site, the http_referral obviously thinks its 
coming from inside the site. :-P
	How can i solve this? Is there any way to prevent data adding from 
outside? Maybe some invisible check on the form or something?

	Thanks.

	Pag



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


[PHP] Does comments slow down processing a lot

2003-03-12 Thread Mathieu Dumoulin
I'm programming large web solutions here and a new programmer has given me a
warning about how much comments i put in  my code and said that it could
probably lower effiency when parsing and executing the php code in my
documents.

So my questions are:
Does putting huge amount of comments in a file really lower the parsing,
compilation and execution time?
Using Zend Optimizer, which is the case right now, would it be better if it
did slow down the code?

Thank you in advance

Mathieu Dumoulin
www.groupimage.com
Web solution Programmer/Analyst



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



RE: [PHP] Re: [PHP-DEV] Is PHP designed (have the capability) to access remote DB?

2003-03-12 Thread Clint Tredway
No its not. PHP does the same thing that ASP, ColdFusion, or JSP does in the
way of connecting to a databse. They can all access a database that is not
on the localhost. It is not about the design and development of PHP.

-Original Message-
From: Patrick LOK [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 7:33 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: [PHP-DEV] Is PHP designed (have the capability) to
access remote DB?


IT IS ABOUT THE DESIGN AND DEVELOPMENT OF PHP



Derick Rethans [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Stop posting user questions to the php-dev and php5-dev list, as I
 explained before.

 Derick

 On Wed, 12 Mar 2003, Patrick LOK wrote:

  Is PHP designed (have the capability) to access remote DB?
 
  Is there any PHP developer willing to answer the question?
 
  ./pl
 

 --
 my other box is your windows PC
 -
  Derick Rethans http://derickrethans.nl/
  PHP Magazine - PHP Magazine for Professionals   http://php-mag.net/
 -



-- 
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] Hacker problem

2003-03-12 Thread Leif K-Brooks
You're checking with javascript, correct?  If so, try checking 
server-side too.

Pag wrote:

Been having some hacker problems on my site, and a simple one:

I have a shoutbox, a simple form with name and text that adds 
lines to the database. I do checks for insults, too long words, tags, 
etc, but its still possible to circumvent those checks by adding the 
data on the url instead of using the form. something like:

 
www.domain.com/shoutb.php?name=hackertext=generalnonsenseandbadwords

To prevent this, i tried tracing the http_referral so that only 
data from inside the site goes into the shoutbox. THe problem is that 
if you do that url above after visiting my site, the http_referral 
obviously thinks its coming from inside the site. :-P
How can i solve this? Is there any way to prevent data adding from 
outside? Maybe some invisible check on the form or something?

Thanks.

Pag



--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


RE: [PHP] Hacker problem

2003-03-12 Thread Sysadmin
Yes, theoretically...you could require it to be posted data.  In order 
to do this you would have to make sure registered_globals is set to 
off in your php.ini and then for each variable posted from your form 
you will need to do something like this

$name=$_POST[name];

This will only post the variables if they have been posted.  Then you 
could use the referrer along with this and it will only allow data from 
that specific form.  Hope this helps!

Brian Drexler

-Original Message-
From: Pag [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 8:35 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Hacker problem



Been having some hacker problems on my site, and a simple one:

I have a shoutbox, a simple form with name and text that adds 
lines to the 
database. I do checks for insults, too long words, tags, etc, but its 
still 
possible to circumvent those checks by adding the data on the url 
instead 
of using the form. something like:


www.domain.com/shoutb.php?name=hackertext=generalnonsenseandbadwords

To prevent this, i tried tracing the http_referral so that only 
data from 
inside the site goes into the shoutbox. THe problem is that if you do 
that 
url above after visiting my site, the http_referral obviously thinks 
its 
coming from inside the site. :-P
How can i solve this? Is there any way to prevent data adding from 
outside? Maybe some invisible check on the form or something?

Thanks.

Pag



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


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



RE: [PHP] Re: [PHP-DEV] Is PHP designed (have the capability) to access remote DB?

2003-03-12 Thread Niklas Lampén
You said before you got a odbc connection to your remote db = remote
connections are possible.

The problem is in:

a) db configuration
b) your way of trying to connect to db
c) your firewall
d) remote firewall
e) all above


Niklas


-Original Message-
From: Patrick LOK [mailto:[EMAIL PROTECTED] 
Sent: 12. maaliskuuta 2003 15:33
To: [EMAIL PROTECTED]
Subject: [PHP] Re: [PHP-DEV] Is PHP designed (have the capability) to access
remote DB?


IT IS ABOUT THE DESIGN AND DEVELOPMENT OF PHP



Derick Rethans [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Stop posting user questions to the php-dev and php5-dev list, as I 
 explained before.

 Derick

 On Wed, 12 Mar 2003, Patrick LOK wrote:

  Is PHP designed (have the capability) to access remote DB?
 
  Is there any PHP developer willing to answer the question?
 
  ./pl
 

 --
 my other box is your windows 
 PC
 -
  Derick Rethans http://derickrethans.nl/
  PHP Magazine - PHP Magazine for Professionals   http://php-mag.net/
 -



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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



Re: [PHP] Hacker problem

2003-03-12 Thread Leif K-Brooks
That's can still easily be spoofed.  The only safe way is to validate 
the form server-side.

[EMAIL PROTECTED] wrote:

Yes, theoretically...you could require it to be posted data.  In order 
to do this you would have to make sure registered_globals is set to 
off in your php.ini and then for each variable posted from your form 
you will need to do something like this

$name=$_POST[name];

This will only post the variables if they have been posted.  Then you 
could use the referrer along with this and it will only allow data from 
that specific form.  Hope this helps!

Brian Drexler

-Original Message-
From: Pag [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 8:35 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Hacker problem


	Been having some hacker problems on my site, and a simple one:

	I have a shoutbox, a simple form with name and text that adds 
lines to the 
database. I do checks for insults, too long words, tags, etc, but its 
still 
possible to circumvent those checks by adding the data on the url 
instead 
of using the form. something like:


www.domain.com/shoutb.php?name=hackertext=generalnonsenseandbadwords
	To prevent this, i tried tracing the http_referral so that only 
data from 
inside the site goes into the shoutbox. THe problem is that if you do 
that 
url above after visiting my site, the http_referral obviously thinks 
its 
coming from inside the site. :-P
	How can i solve this? Is there any way to prevent data adding from 
outside? Maybe some invisible check on the form or something?

	Thanks.

	Pag



 

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


Re: [PHP] Re: [PHP-DEV] Is PHP designed (have the capability) to access remote DB?

2003-03-12 Thread Patrick LOK
I tried mssql_connect  pgsql_connect to remote db but never connected!
I have searched thru. the manual and QA but can't find an answer.
Any tips?
./pl


Clint Tredway [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 No its not. PHP does the same thing that ASP, ColdFusion, or JSP does in
the
 way of connecting to a databse. They can all access a database that is not
 on the localhost. It is not about the design and development of PHP.

 -Original Message-
 From: Patrick LOK [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 12, 2003 7:33 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: [PHP-DEV] Is PHP designed (have the capability) to
 access remote DB?


 IT IS ABOUT THE DESIGN AND DEVELOPMENT OF PHP



 Derick Rethans [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Stop posting user questions to the php-dev and php5-dev list, as I
  explained before.
 
  Derick
 
  On Wed, 12 Mar 2003, Patrick LOK wrote:
 
   Is PHP designed (have the capability) to access remote DB?
  
   Is there any PHP developer willing to answer the question?
  
   ./pl
  
 
  --
  my other box is your windows
PC

 -
   Derick Rethans http://derickrethans.nl/
   PHP Magazine - PHP Magazine for Professionals   http://php-mag.net/

 -



 --
 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] Hacker problem

2003-03-12 Thread Dan Hardiker
This could still be faked easily with a telnet session and some fake http
headers. Your only way of making sure is to create a serverside script
which filters the data.

 Yes, theoretically...you could require it to be posted data.  In order
 to do this you would have to make sure registered_globals is set to
 off in your php.ini and then for each variable posted from your form
 you will need to do something like this

 $name=$_POST[name];

 This will only post the variables if they have been posted.  Then you
 could use the referrer along with this and it will only allow data from
 that specific form.  Hope this helps!

 Brian Drexler

 -Original Message-
 From: Pag [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 12, 2003 8:35 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Hacker problem



   Been having some hacker problems on my site, and a simple one:

   I have a shoutbox, a simple form with name and text that adds
 lines to the
 database. I do checks for insults, too long words, tags, etc, but its
 still
 possible to circumvent those checks by adding the data on the url
 instead
 of using the form. something like:


 www.domain.com/shoutb.php?name=hackertext=generalnonsenseandbadwords

   To prevent this, i tried tracing the http_referral so that only
 data from
 inside the site goes into the shoutbox. THe problem is that if you do
 that
 url above after visiting my site, the http_referral obviously thinks
 its
 coming from inside the site. :-P
   How can i solve this? Is there any way to prevent data adding from
 outside? Maybe some invisible check on the form or something?

   Thanks.

   Pag



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


-- 
Dan Hardiker [EMAIL PROTECTED]
ADAM Software  Systems Engineer
First Creative



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



RE: [PHP] Re: [PHP-DEV] Is PHP designed (have the capability) to access remote DB?

2003-03-12 Thread Clint Tredway
Like the previous poster said.. its in you configuration.. can your
webserver actually see(connect to in another way) to the server where your
database is?

If not, then you will have to figure that out first.

Clint

-Original Message-
From: Patrick LOK [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 7:44 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: [PHP-DEV] Is PHP designed (have the capability)
to access remote DB?


I tried mssql_connect  pgsql_connect to remote db but never connected!
I have searched thru. the manual and QA but can't find an answer.
Any tips?
./pl


Clint Tredway [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 No its not. PHP does the same thing that ASP, ColdFusion, or JSP does in
the
 way of connecting to a databse. They can all access a database that is not
 on the localhost. It is not about the design and development of PHP.

 -Original Message-
 From: Patrick LOK [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 12, 2003 7:33 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: [PHP-DEV] Is PHP designed (have the capability) to
 access remote DB?


 IT IS ABOUT THE DESIGN AND DEVELOPMENT OF PHP



 Derick Rethans [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Stop posting user questions to the php-dev and php5-dev list, as I
  explained before.
 
  Derick
 
  On Wed, 12 Mar 2003, Patrick LOK wrote:
 
   Is PHP designed (have the capability) to access remote DB?
  
   Is there any PHP developer willing to answer the question?
  
   ./pl
  
 
  --
  my other box is your windows
PC

 -
   Derick Rethans http://derickrethans.nl/
   PHP Magazine - PHP Magazine for Professionals   http://php-mag.net/

 -



 --
 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] Re: [PHP-DEV] Is PHP designed (have the capability) to access remote DB?

2003-03-12 Thread Patrick LOK
Well... just what _connect required! servername, userid, password.  What
else?

any tips?
./pl


Niklas lampén [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
You said before you got a odbc connection to your remote db = remote
connections are possible.

The problem is in:

a) db configuration
b) your way of trying to connect to db
c) your firewall
d) remote firewall
e) all above


Niklas


-Original Message-
From: Patrick LOK [mailto:[EMAIL PROTECTED]
Sent: 12. maaliskuuta 2003 15:33
To: [EMAIL PROTECTED]
Subject: [PHP] Re: [PHP-DEV] Is PHP designed (have the capability) to access
remote DB?


IT IS ABOUT THE DESIGN AND DEVELOPMENT OF PHP



Derick Rethans [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Stop posting user questions to the php-dev and php5-dev list, as I
 explained before.

 Derick

 On Wed, 12 Mar 2003, Patrick LOK wrote:

  Is PHP designed (have the capability) to access remote DB?
 
  Is there any PHP developer willing to answer the question?
 
  ./pl
 

 --
 my other box is your windows
 PC
 -
  Derick Rethans http://derickrethans.nl/
  PHP Magazine - PHP Magazine for Professionals   http://php-mag.net/
 -



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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/



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



RE: [PHP] Re: [PHP-DEV] Is PHP designed (have the capability) to access remote DB?

2003-03-12 Thread Clint Tredway
I am willing to help you.. what kind of database are you trying to connect
to?

-Original Message-
From: Patrick LOK [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 7:48 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: [PHP-DEV] Is PHP designed (have the capability)
to access remote DB?


Well... just what _connect required! servername, userid, password.  What
else?

any tips?
./pl


Niklas lampén [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
You said before you got a odbc connection to your remote db = remote
connections are possible.

The problem is in:

a) db configuration
b) your way of trying to connect to db
c) your firewall
d) remote firewall
e) all above


Niklas


-Original Message-
From: Patrick LOK [mailto:[EMAIL PROTECTED]
Sent: 12. maaliskuuta 2003 15:33
To: [EMAIL PROTECTED]
Subject: [PHP] Re: [PHP-DEV] Is PHP designed (have the capability) to access
remote DB?


IT IS ABOUT THE DESIGN AND DEVELOPMENT OF PHP



Derick Rethans [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Stop posting user questions to the php-dev and php5-dev list, as I
 explained before.

 Derick

 On Wed, 12 Mar 2003, Patrick LOK wrote:

  Is PHP designed (have the capability) to access remote DB?
 
  Is there any PHP developer willing to answer the question?
 
  ./pl
 

 --
 my other box is your windows
 PC
 -
  Derick Rethans http://derickrethans.nl/
  PHP Magazine - PHP Magazine for Professionals   http://php-mag.net/
 -



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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.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



[PHP] Re: PHP Books

2003-03-12 Thread rotsky
Don't know any of those but the books I have experience with so far (as a
newbie with less than 2 weeks' PHP experience and next-to-no programming
experience generally):

'Programming PHP' - Rasmus Lerdorf  Kevin Tatroe (O'Reilly) - straight from
the horse's mouth, as it were. Excellent book which quickly demystified
sessions and security issues for me. Still grappling with the Objects
chapter, but getting there. It's not a beginner's book to programming, but
does a good job of explaining PHP. Highly recommended.

'PHP  MySQL for Dummies' - Janet Valade - not a bad primer, but I very
quickly outgrew it. Found I was working stuff out for myself before I got to
the relevant chapters in the book.

'PHP Developer's Cookbook' - Sterling Hughes with contributions by Andrei
Zmievski (Sams). Still playing with this one. Definitely not for beginners
as it assumes (IMHO) a fairly well-developed familiarity with PHP concepts
and procedures and general wirehead argot. But I get the feeling that I'll
be turning to this one more and more as it is a resource of solutions to
specific problems.

About to delve into 'Web Database Applications with PHP  MySQL' - Hugh
Williams  David Lane (O'Reilly), which I think is looking promising.



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



RE: [PHP] Hacker problem

2003-03-12 Thread Sysadmin
How would one go about doing this?

-Original Message-
From: Dan Hardiker [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 8:44 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP] Hacker problem


This could still be faked easily with a telnet session and some fake 
http
headers. Your only way of making sure is to create a serverside script
which filters the data.

 Yes, theoretically...you could require it to be posted data.  In order
 to do this you would have to make sure registered_globals is set to
 off in your php.ini and then for each variable posted from your form
 you will need to do something like this

 $name=$_POST[name];

 This will only post the variables if they have been posted.  Then 
you
 could use the referrer along with this and it will only allow data 
from
 that specific form.  Hope this helps!

 Brian Drexler

 -Original Message-
 From: Pag [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 12, 2003 8:35 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Hacker problem



   Been having some hacker problems on my site, and a simple one:

   I have a shoutbox, a simple form with name and text that adds
 lines to the
 database. I do checks for insults, too long words, tags, etc, but its
 still
 possible to circumvent those checks by adding the data on the url
 instead
 of using the form. something like:


 www.domain.com/shoutb.php?name=hackertext=generalnonsenseandbadwords

   To prevent this, i tried tracing the http_referral so that only
 data from
 inside the site goes into the shoutbox. THe problem is that if you do
 that
 url above after visiting my site, the http_referral obviously thinks
 its
 coming from inside the site. :-P
   How can i solve this? Is there any way to prevent data adding 
from
 outside? Maybe some invisible check on the form or something?

   Thanks.

   Pag



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


-- 
Dan Hardiker [EMAIL PROTECTED]
ADAM Software  Systems Engineer
First Creative



-- 
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] Hacker problem

2003-03-12 Thread Adam Voigt




Why don't you just do the swear filtering on shoutb.php, or wherever it's actually

being inserted into the database?



On Wed, 2003-03-12 at 08:51, [EMAIL PROTECTED] wrote:

How would one go about doing this?



-Original Message-

From: Dan Hardiker [mailto:[EMAIL PROTECTED]

Sent: Wednesday, March 12, 2003 8:44 AM

To: [EMAIL PROTECTED]

Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]

Subject: RE: [PHP] Hacker problem





This could still be faked easily with a telnet session and some fake 

http

headers. Your only way of making sure is to create a serverside script

which filters the data.



 Yes, theoretically...you could require it to be posted data.  In order

 to do this you would have to make sure registered_globals is set to

 off in your php.ini and then for each variable posted from your form

 you will need to do something like this



 $name=$_POST[name];



 This will only post the variables if they have been posted.  Then 

you

 could use the referrer along with this and it will only allow data 

from

 that specific form.  Hope this helps!



 Brian Drexler



 -Original Message-

 From: Pag [mailto:[EMAIL PROTECTED]

 Sent: Wednesday, March 12, 2003 8:35 AM

 To: [EMAIL PROTECTED]

 Subject: [PHP] Hacker problem







 	Been having some hacker problems on my site, and a simple one:



 	I have a shoutbox, a simple form with name and text that adds

 lines to the

 database. I do checks for insults, too long words, tags, etc, but its

 still

 possible to circumvent those checks by adding the data on the url

 instead

 of using the form. something like:





 www.domain.com/shoutb.php?name=hackertext=generalnonsenseandbadwords



 	To prevent this, i tried tracing the http_referral so that only

 data from

 inside the site goes into the shoutbox. THe problem is that if you do

 that

 url above after visiting my site, the http_referral obviously thinks

 its

 coming from inside the site. :-P

 	How can i solve this? Is there any way to prevent data adding 

from

 outside? Maybe some invisible check on the form or something?



 	Thanks.



 	Pag







 --

 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





-- 

Dan Hardiker [EMAIL PROTECTED]

ADAM Software  Systems Engineer

First Creative







-- 

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






-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








signature.asc
Description: This is a digitally signed message part


Re: [PHP] Hacker problem

2003-03-12 Thread Leif K-Brooks
if(stristr($text,'badword') or stristr($text,'badword2') or 
strlen($text)  maxlength){
die('Invalid!');
}

[EMAIL PROTECTED] wrote:

So how could you validate it server-side?

-Original Message-
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 8:41 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Hacker problem
That's can still easily be spoofed.  The only safe way is to validate 
the form server-side.

[EMAIL PROTECTED] wrote:

 

Yes, theoretically...you could require it to be posted data.  In order 
to do this you would have to make sure registered_globals is set to 
off in your php.ini and then for each variable posted from your form 
you will need to do something like this

$name=$_POST[name];

This will only post the variables if they have been posted.  Then 
   

you 
 

could use the referrer along with this and it will only allow data 
   

from 
 

that specific form.  Hope this helps!

Brian Drexler

-Original Message-
From: Pag [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 8:35 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Hacker problem


	Been having some hacker problems on my site, and a simple one:

	I have a shoutbox, a simple form with name and text that adds 
lines to the 
database. I do checks for insults, too long words, tags, etc, but its 
still 
possible to circumvent those checks by adding the data on the url 
instead 
of using the form. something like:


www.domain.com/shoutb.php?name=hackertext=generalnonsenseandbadwords
	To prevent this, i tried tracing the http_referral so that only 
data from 
inside the site goes into the shoutbox. THe problem is that if you do 
that 
url above after visiting my site, the http_referral obviously thinks 
its 
coming from inside the site. :-P
	How can i solve this? Is there any way to prevent data adding 
   

from 
 

outside? Maybe some invisible check on the form or something?

	Thanks.

	Pag





   

 

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.



Re: [PHP] what the hell in this sql

2003-03-12 Thread Martin Mandl
Nevertheless the $ looks weard ...

George Pitcher wrote:
Firstly,

This isn't a php question and should be directed at a sql list or to php-db

Have you lokked at erro 1064 in the manual? What does it say?

There are several things that you should do before coming to the list with a
problem.
Without checking I suspect that you need to specify a 'JOIN' in your
statement - again refere to the manual for instructions.
George


-Original Message-
From: Alawi [mailto:[EMAIL PROTECTED]
Sent: 12 March 2003 11:07 am
To: [EMAIL PROTECTED]
Subject: [PHP] what the hell in this sql


 SELECT * FROM cont_types, cont_data, cont_cats
 WHERE cont_data.cont_id = $cont_id
 AND cont_types.type_id = cont_data.type_id
 AND cont_cats.cat_id = cont_data.cat_id
its not work , give me 1064


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


Re: [PHP] two questions about usning session.

2003-03-12 Thread Joe Wong
Hi Justin,

  For the first problem, I found this option in PHP.INI do the trick:

; Set to {nocache,private,public,} to determine HTTP caching aspects
; or leave this empty to avoid sending anti-caching headers.
;session.cache_limiter = nocache
session.cache_limiter =

The default was set to nocache and after I change it to empty string, it
solved my problem.

For the second problem, I tried your script with two instances of IE 6.1
running, I didn't get two distinct values. Any idea?

- Joe

- Original Message -
From: Justin French [EMAIL PROTECTED]
To: Joe Wong [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 8:43 PM
Subject: Re: [PHP] two questions about usning session.


 on 07/03/03 5:45 PM, Joe Wong ([EMAIL PROTECTED]) wrote:

  Hello,
 
  I have two questions about using sessions in PHP.
 
  Firstly, I use session to remeber the username and a session ID for the
  given user. When I hit the BACK button on the browser (IE), it always
set
  that my page is expired and ask me to click the refresh button. How to
  prevent this from happening?

 That sounds like a problem with POSTed data from forms, not necessarily a
 problem with sessions, or a problem a browser.

 Have you got a URL we can play with?


  Secondly, how is the PHP session ID be computed? When user A login, a
  session is started and his name nad session ID are stored. Now, on the
same
  PC, I start another instance of the IE browser, login as User B, her
name
  and session ID are stored under the same PHP session file. I switch back
to
  the Windows of User A and continue to do something, the PHP session
gives me
  the name of User B and User'B session ID. Why? Am I doing something
wrong
  here?

 Definitely.

 - enable cookies on your browser
 - make sure you're using PHP = 4.1

 1. Start with a blank text file.

 2. Copy and paste this in:
 ---
 ?php
 session_start();
 if (!isset($_SESSION['count'])) {
 $_SESSION['count'];
 }
 else {
 $_SESSION['count']++;
 }
 ?
 Hello visitor, you have seen this page ?php echo $_SESSION['count'] ?
 times.p
 To continue, A HREF=?php echo $_SERVER['PHP_SELF']; ?click here/A
 ---

 3. Open it up in your browser, and test that it works (the value of
 $_SESSION['count'] should increase with each click)

 4. If that much works, open up the URL in a second window, and try to run
 two separate sessions... (the first window might be on 10 clicks, and the
 new one will be starting from 1)

 5. If we're still cool, now try it without cookies maybe, by adding the
SID
 to the URL that they click on.


 If all this works, then the problem is obviously in your code somewhere,
not
 an issue with PHP/sessions/browsers/cookies/etc.


 Justin





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



RE: [PHP] Hacker problem

2003-03-12 Thread Sysadmin
Swear filtering is easy, I want to know how to make sure the data is 
coming from MY formI'm just picky like that. :-)

-Original Message-
From: Adam Voigt [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 8:55 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] Hacker problem


Why don't you just do the swear filtering on shoutb.php, or wherever 
it's actually 
being inserted into the database? 

On Wed, 2003-03-12 at 08:51, [EMAIL PROTECTED] wrote: 

How would one go about doing this? 

-Original Message- 
From: Dan Hardiker [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 12, 2003 8:44 AM 
To: [EMAIL PROTECTED] 
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] 
Subject: RE: [PHP] Hacker problem 


This could still be faked easily with a telnet session and some fake 
http 
headers. Your only way of making sure is to create a serverside script 
which filters the data. 

 Yes, theoretically...you could require it to be posted data. In order 
 to do this you would have to make sure registered_globals is set to 
 off in your php.ini and then for each variable posted from your 
form 
 you will need to do something like this 
 
 $name=$_POST[name]; 
 
 This will only post the variables if they have been posted. Then 
you 
 could use the referrer along with this and it will only allow data 
from 
 that specific form. Hope this helps! 
 
 Brian Drexler 
 
 -Original Message- 
 From: Pag [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, March 12, 2003 8:35 AM 
 To: [EMAIL PROTECTED] 
 Subject: [PHP] Hacker problem 
 
 
 
 Been having some hacker problems on my site, and a simple one: 
 
 I have a shoutbox, a simple form with name and text that adds 
 lines to the 
 database. I do checks for insults, too long words, tags, etc, but its 
 still 
 possible to circumvent those checks by adding the data on the url 
 instead 
 of using the form. something like: 
 
 
 www.domain.com/shoutb.php?name=hackertext=generalnonsenseandbadwords 
 
 To prevent this, i tried tracing the http_referral so that only 
 data from 
 inside the site goes into the shoutbox. THe problem is that if you do 
 that 
 url above after visiting my site, the http_referral obviously thinks 
 its 
 coming from inside the site. :-P 
 How can i solve this? Is there any way to prevent data adding 
from 
 outside? Maybe some invisible check on the form or something? 
 
 Thanks. 
 
 Pag 
 
 
 
 -- 
 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 


-- 
Dan Hardiker [EMAIL PROTECTED] 
ADAM Software  Systems Engineer 
First Creative 



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


-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc



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



RE: [PHP] Hacker problem

2003-03-12 Thread Sysadmin
So we aren't actually validating where the data is coming from, we 
are just validating the data?

-Original Message-
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 8:57 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Hacker problem


if(stristr($text,'badword') or stristr($text,'badword2') or 
strlen($text)  maxlength){
die('Invalid!');
}

[EMAIL PROTECTED] wrote:


So how could you validate it server-side?

-Original Message-
From: Leif K-Brooks [ mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 8:41 AM
To:  [EMAIL PROTECTED]
Cc:  [EMAIL PROTECTED]
Subject: Re: [PHP] Hacker problem


That's can still easily be spoofed.  The only safe way is to validate 
the form server-side.

[EMAIL PROTECTED] wrote:

  

Yes, theoretically...you could require it to be posted data.  In order 
to do this you would have to make sure registered_globals is set to 
off in your php.ini and then for each variable posted from your form 
you will need to do something like this

$name=$_POST[name];

This will only post the variables if they have been posted.  Then 


you 
  

could use the referrer along with this and it will only allow data 


from 
  

that specific form.  Hope this helps!

Brian Drexler

-Original Message-
From: Pag [ mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 8:35 AM
To:  [EMAIL PROTECTED]
Subject: [PHP] Hacker problem



Been having some hacker problems on my site, and a simple one:

I have a shoutbox, a simple form with name and text that adds 
lines to the 
database. I do checks for insults, too long words, tags, etc, but its 
still 
possible to circumvent those checks by adding the data on the url 
instead 
of using the form. something like:


www.domain.com/shoutb.php?name=hackertext=generalnonsenseandbadwords

To prevent this, i tried tracing the http_referral so that only 
data from 
inside the site goes into the shoutbox. THe problem is that if you do 
that 
url above after visiting my site, the http_referral obviously thinks 
its 
coming from inside the site. :-P
How can i solve this? Is there any way to prevent data adding 


from 
  

outside? Maybe some invisible check on the form or something?

Thanks.

Pag



 




  


-- 
The above message is encrypted with double rot13 encoding.  Any 
unauthorized attempt to decrypt it will be prosecuted to the full 
extent of the law.




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



Re: [PHP] Hacker problem

2003-03-12 Thread Leif K-Brooks
That's just not possible.

[EMAIL PROTECTED] wrote:

Swear filtering is easy, I want to know how to make sure the data is 
coming from MY formI'm just picky like that. :-)

-Original Message-
From: Adam Voigt [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 8:55 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] Hacker problem
Why don't you just do the swear filtering on shoutb.php, or wherever 
it's actually 
being inserted into the database? 

On Wed, 2003-03-12 at 08:51, [EMAIL PROTECTED] wrote: 

How would one go about doing this? 

-Original Message- 
From: Dan Hardiker [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 12, 2003 8:44 AM 
To: [EMAIL PROTECTED] 
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] 
Subject: RE: [PHP] Hacker problem 

This could still be faked easily with a telnet session and some fake 
http 
headers. Your only way of making sure is to create a serverside script 
which filters the data. 

 

Yes, theoretically...you could require it to be posted data. In order 
to do this you would have to make sure registered_globals is set to 
off in your php.ini and then for each variable posted from your 
   

form 
 

you will need to do something like this 

$name=$_POST[name]; 

This will only post the variables if they have been posted. Then 
   

you 
 

could use the referrer along with this and it will only allow data 
   

from 
 

that specific form. Hope this helps! 

Brian Drexler 

-Original Message- 
From: Pag [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 12, 2003 8:35 AM 
To: [EMAIL PROTECTED] 
Subject: [PHP] Hacker problem 



Been having some hacker problems on my site, and a simple one: 

I have a shoutbox, a simple form with name and text that adds 
lines to the 
database. I do checks for insults, too long words, tags, etc, but its 
still 
possible to circumvent those checks by adding the data on the url 
instead 
of using the form. something like: 

www.domain.com/shoutb.php?name=hackertext=generalnonsenseandbadwords 

To prevent this, i tried tracing the http_referral so that only 
data from 
inside the site goes into the shoutbox. THe problem is that if you do 
that 
url above after visiting my site, the http_referral obviously thinks 
its 
coming from inside the site. :-P 
How can i solve this? Is there any way to prevent data adding 
   

from 
 

outside? Maybe some invisible check on the form or something? 

Thanks. 

Pag 



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



 

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.



RE: [PHP] Hacker problem

2003-03-12 Thread Adam Voigt




Well you can check the referer, but like someone else

said, that can be faked, you can probably in Apache or

somewhere disallow (if it's not by default) external post requests

(ie from servers other then your own), and just make sure

your using $_POST[message] instead of $message.



On Wed, 2003-03-12 at 09:01, [EMAIL PROTECTED] wrote:

Swear filtering is easy, I want to know how to make sure the data is 

coming from MY formI'm just picky like that. :-)



-Original Message-

From: Adam Voigt [mailto:[EMAIL PROTECTED]

Sent: Wednesday, March 12, 2003 8:55 AM

To: [EMAIL PROTECTED]

Cc: [EMAIL PROTECTED]

Subject: RE: [PHP] Hacker problem





Why don't you just do the swear filtering on shoutb.php, or wherever 

it's actually 

being inserted into the database? 



On Wed, 2003-03-12 at 08:51, [EMAIL PROTECTED] wrote: 



How would one go about doing this? 



-Original Message- 

From: Dan Hardiker [mailto:[EMAIL PROTECTED] 

Sent: Wednesday, March 12, 2003 8:44 AM 

To: [EMAIL PROTECTED] 

Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] 

Subject: RE: [PHP] Hacker problem 





This could still be faked easily with a telnet session and some fake 

http 

headers. Your only way of making sure is to create a serverside script 

which filters the data. 



 Yes, theoretically...you could require it to be posted data. In order 

 to do this you would have to make sure registered_globals is set to 

 off in your php.ini and then for each variable posted from your 

form 

 you will need to do something like this 

 

 $name=$_POST[name]; 

 

 This will only post the variables if they have been posted. Then 

you 

 could use the referrer along with this and it will only allow data 

from 

 that specific form. Hope this helps! 

 

 Brian Drexler 

 

 -Original Message- 

 From: Pag [mailto:[EMAIL PROTECTED] 

 Sent: Wednesday, March 12, 2003 8:35 AM 

 To: [EMAIL PROTECTED] 

 Subject: [PHP] Hacker problem 

 

 

 

 Been having some hacker problems on my site, and a simple one: 

 

 I have a shoutbox, a simple form with name and text that adds 

 lines to the 

 database. I do checks for insults, too long words, tags, etc, but its 

 still 

 possible to circumvent those checks by adding the data on the url 

 instead 

 of using the form. something like: 

 

 

 www.domain.com/shoutb.php?name=hackertext=generalnonsenseandbadwords 

 

 To prevent this, i tried tracing the http_referral so that only 

 data from 

 inside the site goes into the shoutbox. THe problem is that if you do 

 that 

 url above after visiting my site, the http_referral obviously thinks 

 its 

 coming from inside the site. :-P 

 How can i solve this? Is there any way to prevent data adding 

from 

 outside? Maybe some invisible check on the form or something? 

 

 Thanks. 

 

 Pag 

 

 

 

 -- 

 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 





-- 

Dan Hardiker [EMAIL PROTECTED] 

ADAM Software  Systems Engineer 

First Creative 







-- 

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 





-- 

Adam Voigt ([EMAIL PROTECTED])

The Cryptocomm Group

My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








signature.asc
Description: This is a digitally signed message part


Re: [PHP] Hacker problem

2003-03-12 Thread Leif K-Brooks
Correct.

[EMAIL PROTECTED] wrote:

So we aren't actually validating where the data is coming from, we 
are just validating the data?

-Original Message-
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 8:57 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Hacker problem
if(stristr($text,'badword') or stristr($text,'badword2') or 
strlen($text)  maxlength){
die('Invalid!');
}

[EMAIL PROTECTED] wrote:

So how could you validate it server-side?

-Original Message-
From: Leif K-Brooks [ mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 8:41 AM
To:  [EMAIL PROTECTED]
Cc:  [EMAIL PROTECTED]
Subject: Re: [PHP] Hacker problem
That's can still easily be spoofed.  The only safe way is to validate 
the form server-side.

[EMAIL PROTECTED] wrote:

 

Yes, theoretically...you could require it to be posted data.  In order 
to do this you would have to make sure registered_globals is set to 
off in your php.ini and then for each variable posted from your form 
you will need to do something like this

$name=$_POST[name];

This will only post the variables if they have been posted.  Then 
   

you 
 

could use the referrer along with this and it will only allow data 
   

from 
 

that specific form.  Hope this helps!

Brian Drexler

-Original Message-
From: Pag [ mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 8:35 AM
To:  [EMAIL PROTECTED]
Subject: [PHP] Hacker problem


	Been having some hacker problems on my site, and a simple one:

	I have a shoutbox, a simple form with name and text that adds 
lines to the 
database. I do checks for insults, too long words, tags, etc, but its 
still 
possible to circumvent those checks by adding the data on the url 
instead 
of using the form. something like:


www.domain.com/shoutb.php?name=hackertext=generalnonsenseandbadwords
	To prevent this, i tried tracing the http_referral so that only 
data from 
inside the site goes into the shoutbox. THe problem is that if you do 
that 
url above after visiting my site, the http_referral obviously thinks 
its 
coming from inside the site. :-P
	How can i solve this? Is there any way to prevent data adding 
   

from 
 

outside? Maybe some invisible check on the form or something?

	Thanks.

	Pag





   

 

 

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


[PHP] Re: Another questions about usning session.

2003-03-12 Thread rotsky
As I understand it, PHP sessions use cookies by default. If cookies are
disabled, it switches to appending the session id to the URL.

The advantage with using sessions is that all this is transparent to you and
it therefore requires very little coding.

Did you ensure the code below went into a plain text file? If you put it in
an HTML page, it must come right at the start of the page, before HTML or
any headers. Make it the first thing in the file.

André cupini [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
* People, sorry my ugly English. I´m Brazilian...

I am looking for learning more about sessions... I´m test this code below
don´t work with me My php version is 4.1.2.
Anybody have a complete example code of how use sessions?
Another doubt: Sessions use cookies? What the advantage in use sessions
instead of cookies?

André Cupini
Programador
[EMAIL PROTECTED]
NeoBiz - fábrica de internet
http://www.neobiz.com.br




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



Re: [PHP] what the hell in this sql

2003-03-12 Thread CPT John W. Holmes
 Nevertheless the $ looks weard ...

Yeah, it looks weird, too. :)

You're probably getting an error because $cont_id doesn't have a value. Show
the SQL in context and do some debugging...

---John Holmes...

  This isn't a php question and should be directed at a sql list or to
php-db
 
  Have you lokked at erro 1064 in the manual? What does it say?
 
  There are several things that you should do before coming to the list
with a
  problem.
 
  Without checking I suspect that you need to specify a 'JOIN' in your
  statement - again refere to the manual for instructions.
 
  George
 
 
 -Original Message-
 From: Alawi [mailto:[EMAIL PROTECTED]
 Sent: 12 March 2003 11:07 am
 To: [EMAIL PROTECTED]
 Subject: [PHP] what the hell in this sql
 
 
 
   SELECT * FROM cont_types, cont_data, cont_cats
   WHERE cont_data.cont_id = $cont_id
   AND cont_types.type_id = cont_data.type_id
   AND cont_cats.cat_id = cont_data.cat_id
 
 
 its not work , give me 1064


 --
 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] Hacker problem

2003-03-12 Thread Sysadmin
Thanks!  That's all I needed to know.

-Original Message-
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 9:04 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Hacker problem


That's just not possible.

[EMAIL PROTECTED] wrote:


Swear filtering is easy, I want to know how to make sure the data is 
coming from MY formI'm just picky like that. :-)

-Original Message-
From: Adam Voigt [ mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 8:55 AM
To:  [EMAIL PROTECTED]
Cc:  [EMAIL PROTECTED]
Subject: RE: [PHP] Hacker problem


Why don't you just do the swear filtering on shoutb.php, or wherever 
it's actually 
being inserted into the database? 

On Wed, 2003-03-12 at 08:51,  [EMAIL PROTECTED] wrote: 

How would one go about doing this? 

-Original Message- 
From: Dan Hardiker [ mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 12, 2003 8:44 AM 
To:  [EMAIL PROTECTED] 
Cc:  [EMAIL PROTECTED];  [EMAIL PROTECTED] 
Subject: RE: [PHP] Hacker problem 


This could still be faked easily with a telnet session and some fake 
http 
headers. Your only way of making sure is to create a serverside script 
which filters the data. 

  

Yes, theoretically...you could require it to be posted data. In order 
to do this you would have to make sure registered_globals is set to 
off in your php.ini and then for each variable posted from your 


form 
  

you will need to do something like this 

$name=$_POST[name]; 

This will only post the variables if they have been posted. Then 


you 
  

could use the referrer along with this and it will only allow data 


from 
  

that specific form. Hope this helps! 

Brian Drexler 

-Original Message- 
From: Pag [ mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 12, 2003 8:35 AM 
To:  [EMAIL PROTECTED] 
Subject: [PHP] Hacker problem 



Been having some hacker problems on my site, and a simple one: 

I have a shoutbox, a simple form with name and text that adds 
lines to the 
database. I do checks for insults, too long words, tags, etc, but its 
still 
possible to circumvent those checks by adding the data on the url 
instead 
of using the form. something like: 


www.domain.com/shoutb.php?name=hackertext=generalnonsenseandbadwords 

To prevent this, i tried tracing the http_referral so that only 
data from 
inside the site goes into the shoutbox. THe problem is that if you do 
that 
url above after visiting my site, the http_referral obviously thinks 
its 
coming from inside the site. :-P 
How can i solve this? Is there any way to prevent data adding 


from 
  

outside? Maybe some invisible check on the form or something? 

Thanks. 

Pag 



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




  


-- 
The above message is encrypted with double rot13 encoding.  Any 
unauthorized attempt to decrypt it will be prosecuted to the full 
extent of the law.




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



Re: [PHP] two questions about usning session.

2003-03-12 Thread Marek Kilimajer
Session ID is stored in a cookie, and cookies are shared across 
instances of browser: if you open another window of the same browser, 
the same cookies are send, so you can have only one session to the same 
site (and path). To prevent this, you would have to give up cookies and 
use SID, but I don't know if it is worth the effort. If you just want to 
test your session management, use other browsers at the same time - 
mozilla, netscape, opera.

Joe Wong wrote:

Hi Justin,

 For the first problem, I found this option in PHP.INI do the trick:

; Set to {nocache,private,public,} to determine HTTP caching aspects
; or leave this empty to avoid sending anti-caching headers.
;session.cache_limiter = nocache
session.cache_limiter =
The default was set to nocache and after I change it to empty string, it
solved my problem.
For the second problem, I tried your script with two instances of IE 6.1
running, I didn't get two distinct values. Any idea?
- Joe

- Original Message -
From: Justin French [EMAIL PROTECTED]
To: Joe Wong [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 8:43 PM
Subject: Re: [PHP] two questions about usning session.
 

on 07/03/03 5:45 PM, Joe Wong ([EMAIL PROTECTED]) wrote:

   

Hello,

I have two questions about using sessions in PHP.

Firstly, I use session to remeber the username and a session ID for the
given user. When I hit the BACK button on the browser (IE), it always
 

set
 

that my page is expired and ask me to click the refresh button. How to
prevent this from happening?
 

That sounds like a problem with POSTed data from forms, not necessarily a
problem with sessions, or a problem a browser.
Have you got a URL we can play with?

   

Secondly, how is the PHP session ID be computed? When user A login, a
session is started and his name nad session ID are stored. Now, on the
 

same
 

PC, I start another instance of the IE browser, login as User B, her
 

name
 

and session ID are stored under the same PHP session file. I switch back
 

to
 

the Windows of User A and continue to do something, the PHP session
 

gives me
 

the name of User B and User'B session ID. Why? Am I doing something
 

wrong
 

here?
 

Definitely.

- enable cookies on your browser
- make sure you're using PHP = 4.1
1. Start with a blank text file.

2. Copy and paste this in:
---
?php
session_start();
if (!isset($_SESSION['count'])) {
   $_SESSION['count'];
}
else {
   $_SESSION['count']++;
}
?
Hello visitor, you have seen this page ?php echo $_SESSION['count'] ?
times.p
To continue, A HREF=?php echo $_SERVER['PHP_SELF']; ?click here/A
---
3. Open it up in your browser, and test that it works (the value of
$_SESSION['count'] should increase with each click)
4. If that much works, open up the URL in a second window, and try to run
two separate sessions... (the first window might be on 10 clicks, and the
new one will be starting from 1)
5. If we're still cool, now try it without cookies maybe, by adding the
   

SID
 

to the URL that they click on.

If all this works, then the problem is obviously in your code somewhere,
   

not
 

an issue with PHP/sessions/browsers/cookies/etc.

Justin



   



 



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


Re: [PHP] Hacker problem

2003-03-12 Thread CPT John W. Holmes
Who cares where it comes from, just validate it. You can use POST and
HTTP_REFERRER (check spelling) to stop lazy people from messing with it if
that makes you feel better.

---John Holmes...

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 9:02 AM
Subject: RE: [PHP] Hacker problem


 So we aren't actually validating where the data is coming from, we
 are just validating the data?

 -Original Message-
 From: Leif K-Brooks [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 12, 2003 8:57 AM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] Hacker problem


 if(stristr($text,'badword') or stristr($text,'badword2') or
 strlen($text)  maxlength){
 die('Invalid!');
 }

 [EMAIL PROTECTED] wrote:


 So how could you validate it server-side?

 -Original Message-
 From: Leif K-Brooks [ mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 12, 2003 8:41 AM
 To:  [EMAIL PROTECTED]
 Cc:  [EMAIL PROTECTED]
 Subject: Re: [PHP] Hacker problem


 That's can still easily be spoofed.  The only safe way is to validate
 the form server-side.

 [EMAIL PROTECTED] wrote:



 Yes, theoretically...you could require it to be posted data.  In order
 to do this you would have to make sure registered_globals is set to
 off in your php.ini and then for each variable posted from your form
 you will need to do something like this

 $name=$_POST[name];

 This will only post the variables if they have been posted.  Then


 you


 could use the referrer along with this and it will only allow data


 from


 that specific form.  Hope this helps!

 Brian Drexler

 -Original Message-
 From: Pag [ mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 12, 2003 8:35 AM
 To:  [EMAIL PROTECTED]
 Subject: [PHP] Hacker problem



 Been having some hacker problems on my site, and a simple one:

 I have a shoutbox, a simple form with name and text that adds
 lines to the
 database. I do checks for insults, too long words, tags, etc, but its
 still
 possible to circumvent those checks by adding the data on the url
 instead
 of using the form. something like:


 www.domain.com/shoutb.php?name=hackertext=generalnonsenseandbadwords

 To prevent this, i tried tracing the http_referral so that only
 data from
 inside the site goes into the shoutbox. THe problem is that if you do
 that
 url above after visiting my site, the http_referral obviously thinks
 its
 coming from inside the site. :-P
 How can i solve this? Is there any way to prevent data adding


 from


 outside? Maybe some invisible check on the form or something?

 Thanks.

 Pag











 --
 The above message is encrypted with double rot13 encoding.  Any
 unauthorized attempt to decrypt it will be prosecuted to the full
 extent of the law.




 --
 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] Does comments slow down processing a lot

2003-03-12 Thread Marek Kilimajer
They certainly do, but not using them slows down development.
But you should care about it, because I believe Zend Optimizer removes 
them (they are not needed)

Mathieu Dumoulin wrote:

I'm programming large web solutions here and a new programmer has given me a
warning about how much comments i put in  my code and said that it could
probably lower effiency when parsing and executing the php code in my
documents.
So my questions are:
Does putting huge amount of comments in a file really lower the parsing,
compilation and execution time?
Using Zend Optimizer, which is the case right now, would it be better if it
did slow down the code?
Thank you in advance

Mathieu Dumoulin
www.groupimage.com
Web solution Programmer/Analyst


 



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


RE: [PHP] Search for keyword in txt file

2003-03-12 Thread Chris Blake
Greetings,

Sorry for the delay in responding to your posting, I have been grappling
with your suggestion for a while and still things are not working out.

I have included all my code below and seek your advice..

As it stands, the resultant HTML page prints out the content of each
file, but it puts it all in the right table row, as opposed to splitting
it up for each row(file).also, my code, when viewed in vim, is all
in blue after inserting the $result string you gave me.
By taking out the * at the end of your statement, it reverts back to
showing things in the proper colours, but the page is blank with the
exception of the table formatting

I have tried a lot of different things with your code but am now ready
to start kicking the cat out of frustration.


===
?php

if ($handle = opendir('logs')) 

{
 echo Directory handle: $handle.'br';
 echo 'table border=1' ;
 echo 'tr';
 echo 'tdcenterbfont size=3 color=navyLog Files on
'.$HTTP_SERVER_VARS['HTTP_HOST'] .'/td/center/b/font';
 echo 'tdcenterbfont size=3
color=navyCreated/td/center/b/font';
 echo '/tr';

 {
 // Loop over the directory -
 while (false !== ($file = readdir($handle)))
 echo $file . 'br';
 $result= `grep -n Started logs/*` ;
 //Take out upper directory pointers 
 if ($file != . and $file != ..) 
 
 //Start filename insertion--
  {
  echo 'trtdfont size=2a href=/logs/'.$file.'' . $file .
'/td/font/a'.
  'td' . $result . 'br' . '/td';
  }

 }

 echo '/tr';
 echo '/table';
 closedir($handle); 
} 

   ?


Thanks for taking the time to assist on this one.

Chris

On Fri, 2003-03-07 at 12:38, Ernest E Vogelsinger wrote:
 At 11:36 07.03.2003, Chris Blake said:
 [snip]
 Ok, it`s not that easy..here`s my code...I wanna search all the
 files in the logs directory and for each file found I want it to
 search for the word started and print that line into a table row. 
 
 I will probably need to do like a for each loopbut where do I
 insert it ?
 [snip] 
 
 In case you're _not_ in safe mode:
 
 $result = `grep -n started logs/*`;
 
 
 -- 
O Ernest E. Vogelsinger
(\)ICQ #13394035
 ^ http://www.vogelsinger.at/
 
 
 
-- 
Chris Blake
Office : (011) 782-0840
Cell : 083 985 0379
Your mouse has moved. Windows must be restarted for the change to take
effect. Reboot now? [ OK ]


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



Re: [PHP] Hacker problem

2003-03-12 Thread Mirek Novak
[EMAIL PROTECTED] wrote:
Swear filtering is easy, I want to know how to make sure the data is 
coming from MY formI'm just picky like that. :-)

Hi,
I've done it via a ticket system
- into my form I've added field
	input type=hidden name=ticket_to_ride value=32-byte long 
generated ticket
- store the ticket number in database (optionally) with TimeToLive
- when POST comes, check ticket number with this stored in db
	- if found and (optionally) within TTL, then you've got POST from your FORM
	- then delete it from db - attacker must get fresh form with new ticket 
and must do it within TTL
- ticket can be generated via MD5

another way is to add into your page JavaScript (I've seen somewhere) 
version of MD5 routine and into hidden field add checksum of fields 
and on arrival revalidate it.

of course this is not bullet-proof, but this is way how to make it hard 
for anybody to fake POST. You can make variations of this for example 
interleave your form with different tickets and into db store only 
checksum (MD5) of them, then it becomes nearly impossible to fake form.

HTH
--
Mirek Novak
jabber:[EMAIL PROTECTED]
ICQ:119499448
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP Books

2003-03-12 Thread Chris Blake
Thanks for the reply...I`ll be getting the one by Luke Flemming PHP 
MySQL

Late nights, here we come !!



On Wed, 2003-03-12 at 14:25, Chris Hewitt wrote:
 Petre Agenbag wrote:
 
 There is also a new book by Rasmus Lerdorf and it's cheaper than the
 book I mention, unfortunately I don't have insight into that book, and
 what would the guy that wrote PHP know about it anyway heh? ;p
 
 Its Programming PHP by Rasmus Lerdorf and Kevin Tatroe, O'Reilly, 
 March 2002, ISBN: 1-56592-610-2. Its the only PHP book I have so I can't 
 make a comparison, but I get on well with it and can recommend it.
 
 I also think the manual is good. It does take some searching through to 
 find things until you know what there is and where to find them. I 
 initially only used this, until I got Rasmus's book.
 
 I also learnt (am still learning) a lot by simply monitoring this list. 
 I have been able to avoid several pitfalls because of it so I recommend 
 continuing to stay on it.
 
 HTH
 Chris
 
-- 
Chris Blake
Office : (011) 782-0840
Cell : 083 985 0379
Your mouse has moved. Windows must be restarted for the change to take
effect. Reboot now? [ OK ]


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



RE: [PHP] Search for keyword in txt file

2003-03-12 Thread Chris Blake
Re my earlier post...

I seem to have figured it out by changing the following lines :

//===
  {
  $result= `grep -n Started logs/$file` ;
  echo 'trtdfont size=2a href=/logs/'.$file.'' . $file .
'/td/font/a'.
  'td' . $result . '/td';
  }
//

Now it works the way it`s supposed to..



On Fri, 2003-03-07 at 12:38, Ernest E Vogelsinger wrote:
 At 11:36 07.03.2003, Chris Blake said:
 [snip]
 Ok, it`s not that easy..here`s my code...I wanna search all the
 files in the logs directory and for each file found I want it to
 search for the word started and print that line into a table row. 
 
 I will probably need to do like a for each loopbut where do I
 insert it ?
 [snip] 
 
 In case you're _not_ in safe mode:
 
 $result = `grep -n started logs/*`;
 
 
 -- 
O Ernest E. Vogelsinger
(\)ICQ #13394035
 ^ http://www.vogelsinger.at/
 
 
 
-- 
Chris Blake
Office : (011) 782-0840
Cell : 083 985 0379
Your mouse has moved. Windows must be restarted for the change to take
effect. Reboot now? [ OK ]


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



[PHP] Long script execution and its implications?

2003-03-12 Thread Simon Lusted
Hello,

I hope this question isn't too vague.

I am opening a large csv file (up to 30,000 lines), splitting it out into
its elements and then making several INSERT, SELECT queries on my DB. It's
a hack and not very elegant (but as a beginner i will try to work on it in
the coming weeks)

This process is taking a really long time and I get about 5 or 6 thousand
lines in and php times out (5 minutes).

Now I could set the max_execution_time to a higher level but in the back of
my mind i think there might be a more correct way to make all these selects
and inserts. Like breaking it up into smaller chunks or something.

My question is multifaceted.

a) i can't echo any status information to the screen while the script is
executing (because of course it hasn't finished yet). But is there a way to
do this (something like line 3..line 4 etc of csv)?
b) is there a better way (conceptually) to process such a large file with
each line having up to 5 separate queries on my db.
c) what would be the implications of raising the memory limit (i am running
apache/php/mysql on windows xp locally on my laptop)
d) should i just increase max_execution and live with the blank screen for
8 minutes (i'm basically trying to crunch data for later reporting)

Any info, direction to documentation welcome (i did look but as a beginner
I find its hard to know where to start.)

Thanks
Simon



For the latest data on the economy and society 
consult National Statistics at http://www.statistics.gov.uk

**
Please Note:  Incoming and outgoing email messages
are routinely monitored for compliance with our policy
on the use of electronic communications
**
Legal Disclaimer  :  Any views expressed by
the sender of this message are not necessarily
those of the Office for National Statistics
**

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



[PHP] PDF - PHP (on the fly using templates??)

2003-03-12 Thread Bev
Hi,

BACKGROUND


I am looking to create a series of Certificates and Brouchures etc and then
using the products Print/Acrobat Distiller option save the documents as
PDF(with some pre-built in Name1, address1, address2 variables
that can be automatically resolved

on-the fly using a PHP script using a PDF_REPACE(see below code) option or
something similar. This then allows me to Create Nice looking
Brouchures/Certificates etc with variable abc markers before
converting to PDF so my online user can have personalised stationary
without the need for them to EDIT any of the documents.

My attempts using PHP - PDF on the fly
===

I am looking for guidance on whats the best method and am I on the right
track without using the long winded PDFLIB functions..

I wonder if you could help(I'm going round in circles!), I a looking to use
PHP - PDF, probably with PDF templates instead of actual PDFLIB coding
techniques.

I have tried to create a simply script(before I move on)which will process a
PDF pre-written template and resolve variables on the fly(without using
any PDFLIB functions etc). I created a simple script to do this using
Microsoft RTF but obviously this would only work on PC's where users have
WORD etc...(I assume)

I have tried myself but keep getting the error msg The file is damaged and
could not be repaired when it trys to load the amended  PDF file(see the
sample script below).

By the way, the script works fine if I comment out the PDF_REPLACE option. I
assume these are causing some type of error?? I tried updating the Acrobat
prefences/options to not load in a Browser but that just downloaded to my PC
and the same error message appeared after I double clicked on it...

The PDF template small script is attached as an example.

Rgds

Bev

?php

set_time_limit( 180 ); // this script can be very slow

//create short variable names

$name = $HTTP_POST_VARS['name'];

$score = $HTTP_POST_VARS['score'];

function pdf_replace( $pattern, $replacement, $string )

{

$len = strlen( $pattern );

$regexp = '';

for ( $i = 0; $i$len; $i++ )

{

$regexp .= $pattern[$i];

if ($i$len-1)

$regexp .= (\)\-{0,1}[0-9]*\(){0,1};

}

return ereg_replace ( $regexp, $replacement, $string );

}

if(!$name||!$score)

{

echo 'h1Error:/h1This page was called incorrectly';

}

else

{

//generate the headers to help a browser choose the correct application

$date = date( 'F d, Y' );

// open our template file

$filename = 'PHPCertification.pdf';

$fp = fopen ( $filename, 'r' );

//read our template into a variable

$output = fread( $fp, filesize( $filename ) );

header( 'Content-type: application/pdf' );

header( 'Content-Disposition: filename=cert.pdf');

fclose ( $fp );

// replace the place holders in the template with our data

$output = pdf_replace( 'NAME', strtoupper( $name ), $output );

$output = pdf_replace( 'Name', $name, $output );

$output = pdf_replace( 'score', $score, $output );

$output = pdf_replace( 'mm/dd/', $date, $output );

// send the generated document to the browser

echo $output;

}

?




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



Re: [PHP] Threading objects

2003-03-12 Thread Rasmus Lerdorf
 All I'm really asking is how do you initiate threading with PHP?
 A small example would be nice

You don't.  This is a web scripting language, not Java.

-Rasmus

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



Re: [PHP] PDF - PHP (on the fly using templates??)

2003-03-12 Thread RIVES Sergio SOFRECOM
Hi,

maybe looking at this site you could find what you are looking for :

 FPDF

This is a site dedicated to the generation of PDF documents with PHP.


HTH

Sergio






Bev a écrit :

 Hi,

 BACKGROUND
 

 I am looking to create a series of Certificates and Brouchures etc and then
 using the products Print/Acrobat Distiller option save the documents as
 PDF(with some pre-built in Name1, address1, address2 variables
 that can be automatically resolved

 on-the fly using a PHP script using a PDF_REPACE(see below code) option or
 something similar. This then allows me to Create Nice looking
 Brouchures/Certificates etc with variable abc markers before
 converting to PDF so my online user can have personalised stationary
 without the need for them to EDIT any of the documents.

 My attempts using PHP - PDF on the fly
 ===

 I am looking for guidance on whats the best method and am I on the right
 track without using the long winded PDFLIB functions..

 I wonder if you could help(I'm going round in circles!), I a looking to use
 PHP - PDF, probably with PDF templates instead of actual PDFLIB coding
 techniques.

 I have tried to create a simply script(before I move on)which will process a
 PDF pre-written template and resolve variables on the fly(without using
 any PDFLIB functions etc). I created a simple script to do this using
 Microsoft RTF but obviously this would only work on PC's where users have
 WORD etc...(I assume)

 I have tried myself but keep getting the error msg The file is damaged and
 could not be repaired when it trys to load the amended  PDF file(see the
 sample script below).

 By the way, the script works fine if I comment out the PDF_REPLACE option. I
 assume these are causing some type of error?? I tried updating the Acrobat
 prefences/options to not load in a Browser but that just downloaded to my PC
 and the same error message appeared after I double clicked on it...

 The PDF template small script is attached as an example.

 Rgds

 Bev

 ?php

 set_time_limit( 180 ); // this script can be very slow

 //create short variable names

 $name = $HTTP_POST_VARS['name'];

 $score = $HTTP_POST_VARS['score'];

 function pdf_replace( $pattern, $replacement, $string )

 {

 $len = strlen( $pattern );

 $regexp = '';

 for ( $i = 0; $i$len; $i++ )

 {

 $regexp .= $pattern[$i];

 if ($i$len-1)

 $regexp .= (\)\-{0,1}[0-9]*\(){0,1};

 }

 return ereg_replace ( $regexp, $replacement, $string );

 }

 if(!$name||!$score)

 {

 echo 'h1Error:/h1This page was called incorrectly';

 }

 else

 {

 //generate the headers to help a browser choose the correct application

 $date = date( 'F d, Y' );

 // open our template file

 $filename = 'PHPCertification.pdf';

 $fp = fopen ( $filename, 'r' );

 //read our template into a variable

 $output = fread( $fp, filesize( $filename ) );

 header( 'Content-type: application/pdf' );

 header( 'Content-Disposition: filename=cert.pdf');

 fclose ( $fp );

 // replace the place holders in the template with our data

 $output = pdf_replace( 'NAME', strtoupper( $name ), $output );

 $output = pdf_replace( 'Name', $name, $output );

 $output = pdf_replace( 'score', $score, $output );

 $output = pdf_replace( 'mm/dd/', $date, $output );

 // send the generated document to the browser

 echo $output;

 }

 ?

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


Re: [PHP] PDF - PHP (on the fly using templates??)

2003-03-12 Thread RIVES Sergio SOFRECOM
maybe the link didn't work... www.fpdf.org
sorry



RIVES Sergio SOFRECOM a écrit :

 Hi,

 maybe looking at this site you could find what you are looking for :

  FPDF

 This is a site dedicated to the generation of PDF documents with PHP.

 HTH

 Sergio

 Bev a écrit :

  Hi,
 
  BACKGROUND
  
 
  I am looking to create a series of Certificates and Brouchures etc and then
  using the products Print/Acrobat Distiller option save the documents as
  PDF(with some pre-built in Name1, address1, address2 variables
  that can be automatically resolved
 
  on-the fly using a PHP script using a PDF_REPACE(see below code) option or
  something similar. This then allows me to Create Nice looking
  Brouchures/Certificates etc with variable abc markers before
  converting to PDF so my online user can have personalised stationary
  without the need for them to EDIT any of the documents.
 
  My attempts using PHP - PDF on the fly
  ===
 
  I am looking for guidance on whats the best method and am I on the right
  track without using the long winded PDFLIB functions..
 
  I wonder if you could help(I'm going round in circles!), I a looking to use
  PHP - PDF, probably with PDF templates instead of actual PDFLIB coding
  techniques.
 
  I have tried to create a simply script(before I move on)which will process a
  PDF pre-written template and resolve variables on the fly(without using
  any PDFLIB functions etc). I created a simple script to do this using
  Microsoft RTF but obviously this would only work on PC's where users have
  WORD etc...(I assume)
 
  I have tried myself but keep getting the error msg The file is damaged and
  could not be repaired when it trys to load the amended  PDF file(see the
  sample script below).
 
  By the way, the script works fine if I comment out the PDF_REPLACE option. I
  assume these are causing some type of error?? I tried updating the Acrobat
  prefences/options to not load in a Browser but that just downloaded to my PC
  and the same error message appeared after I double clicked on it...
 
  The PDF template small script is attached as an example.
 
  Rgds
 
  Bev
 
  ?php
 
  set_time_limit( 180 ); // this script can be very slow
 
  //create short variable names
 
  $name = $HTTP_POST_VARS['name'];
 
  $score = $HTTP_POST_VARS['score'];
 
  function pdf_replace( $pattern, $replacement, $string )
 
  {
 
  $len = strlen( $pattern );
 
  $regexp = '';
 
  for ( $i = 0; $i$len; $i++ )
 
  {
 
  $regexp .= $pattern[$i];
 
  if ($i$len-1)
 
  $regexp .= (\)\-{0,1}[0-9]*\(){0,1};
 
  }
 
  return ereg_replace ( $regexp, $replacement, $string );
 
  }
 
  if(!$name||!$score)
 
  {
 
  echo 'h1Error:/h1This page was called incorrectly';
 
  }
 
  else
 
  {
 
  //generate the headers to help a browser choose the correct application
 
  $date = date( 'F d, Y' );
 
  // open our template file
 
  $filename = 'PHPCertification.pdf';
 
  $fp = fopen ( $filename, 'r' );
 
  //read our template into a variable
 
  $output = fread( $fp, filesize( $filename ) );
 
  header( 'Content-type: application/pdf' );
 
  header( 'Content-Disposition: filename=cert.pdf');
 
  fclose ( $fp );
 
  // replace the place holders in the template with our data
 
  $output = pdf_replace( 'NAME', strtoupper( $name ), $output );
 
  $output = pdf_replace( 'Name', $name, $output );
 
  $output = pdf_replace( 'score', $score, $output );
 
  $output = pdf_replace( 'mm/dd/', $date, $output );
 
  // send the generated document to the browser
 
  echo $output;
 
  }
 
  ?
 
  --
  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] Encrypting/Compiling PHP Scripts

2003-03-12 Thread Christopher Ditty
There is also Source Guardian.  If you need a program that will support
an unencrypted configuration file, ie, user definable variables, this
one will do it.  Ioncube wouldn't last I looked and I can't speak for
Zend.

I have used this, but the end result has not been favorable.  So far, I
am running at about 50% success rate for my users being able to run my
encrypted programs.   I support encrypting my scripts, but with all the
problems I am having with this, I am leaning to it not being worth the
hassle right now.

Just my $0.02.

CDitty



 Leif K-Brooks [EMAIL PROTECTED] 03/11/03 11:54PM 
http://zend.com/store/products/zend-encoder.php 
http://www.ioncube.com/ 

Davis Tan wrote:

Hi,

Would like to know whether is there any possibilities to encrypt
or compile the PHP scripts so that it is not human-readable? Thanks!
  


-- 
The above message is encrypted with double rot13 encoding.  Any
unauthorized attempt to decrypt it will be prosecuted to the full extent
of the law.




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



--
03/12/2003, 09:24:53 AM
This e-mail and any attachments represent the views and opinions of only the sender 
and are not necessarily those of Memphis Light, Gas  Water Division, and no such 
inference should be made.

==


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



Re: [PHP] Weird slowdown using complex functions in a loop

2003-03-12 Thread pgcd
Actually, the concept is the following:

- split the text into a number of elements (tags and text between tags) and
put them into an array
- fix each element (text and tags) to prevent attributes and entities from
breaking the parser
- check all the elements to make sure that they are either self-closing
(text or empty tags) or matched by a closing tag somewhere
- append sequentially the text from all the elements to $result
- empty the elements array
- return $result

I honestly don't see how this can lead to a slowdown...

- Original Message -
From: Jimmy Brake [EMAIL PROTECTED]
To: pgcd [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 2:16 PM
Subject: Re: [PHP] Weird slowdown using complex functions in a loop


 where are you storing the information that you are cleaning once it is
 cleaned?

 are you appending it to a variable in the script?




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



[PHP] Query string inconsistency

2003-03-12 Thread Alley Kat Design
Hi -
I have a PHP msg board on one domain, and a site on another, the idea is
that the board is framed. The PHP msg board pages detect whether they're in
the frameset, and if not, pass their URL  query string over to the
frameset. The frameset then grabs this and writes a frame src tag, thus
enclosing any msg board page within the right frameset even if opened
outside it.

The problem is that the $QUERY_STRING is inconsistent. On it's own domain, a
test page works fine. But when the test page uses the framing mechanism, the
$QUERY_STRING only picks up the first argument - it ignores any subsequent
ones. I've got these two variations here:

http://www.alleykat.co.uk/t1.php?arg1=rg2=bbbarg3=ccc
This one works fine and grags all the args. It doesn't try to send to the
frameset.

http://www.alleykat.co.uk/t2.php?arg1=rg2=bbbarg3=ccc
This one sends to the frameset, and gets only the first argument.

The code in these pages is below. The only difference in the two is that the
javascript line is uncommented in t2.php, so it sends to the frameset:-
?php
$thisURL = $REQUEST_URI ;
$thisPage = $PHP_SELF;
// Try a few ways of grabbing the query string
$qs = $QUERY_STRING;
$qqs = $_SERVER[QUERY_STRING];
$qqqs = $HTTP_SERVER_VARS['QUERY_STRING'];
$gotoURL = http://www.alleykat.co.uk; . $thisPage . $qs;
?
script language=Javascript type=text/javascript!--
// uncomment line below to send to frameset
//if (top.frames.length == 0) { window.location.href =
http://www.virtualmagrep.com/vmr_forums.asp?u=?php print($gotoURL);?; }
//--
/script

?php
print($thisPage) .   - php_self br;
print($qs) .  - query_string br;
print($qqs) .  - second query_string br;
print($qqqs) .  - third query_string brhr;
print($gotoURL) .   - the built url br;
print(hr);
phpinfo();
?

Not sure if this is a bug or if I'm doing something wrong.
Cheers -
Andy



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



Re: [PHP] Help with ereg()

2003-03-12 Thread fLIPIS
No, actually i was wrong about this subject. The correct Regular Expression
for this is the following:

preg_match_all(/(\?.*?\?)/ims,$text,$source_code);

The anterior was greedy, and so it matched the following:

? echo aaa; ?html?  echo bbb; ?

And now it only takes the text between ? and ?, even multilined code.



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



[PHP] foro php

2003-03-12 Thread David E.S.V.

hello folks

do you know any site where I can download a free php foro to install?

thanks

David.



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



Re: [PHP] foro php

2003-03-12 Thread CPT John W. Holmes
 do you know any site where I can download a free php foro to install?

wtf is a foro?

Ah... gotta love google. In italian it means I pierce, but in spanish it
means forum, so I'll assume it's a forum you're looking for instead of
some piercing PHP script.

phpbb and phorum are two good ones. There are plenty more... Do a search on
google for PHP forum to see them all.

www.phpbb.com
www.phorum.org

---John Holmes...


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



[PHP] Array syntax not covered in documentation

2003-03-12 Thread adrian porter
I want to do the following:

$u=preg_replace(/[^$chars]/e,'%.unpack(H2, $0)', $u);

However, as you know, unpack returns an array.  I tried this instead:

$u=preg_replace(/[^$chars]/e,'%.(unpack(H2, $0)[])', $u);

but that isn't syntactically correct.  I know that this is possible to 
remedy using a user function but I do this kind of thing very often 
(grab the contents of an array value in one line of code) and want to be 
able to do it without splitting it into multiple lines.  Is that possible?

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


[PHP] adodb + oracle 8i

2003-03-12 Thread Gilberto Garcia Jr.
Somebody here use adodb with oracle?

I´m triyng to use that, but I´m noting realize how to estabilish a conection
with oracle.

I´m getting the folowing error:

Fatal error: Call to undefined function: ora_plogon() in
e:\inetpub\wwwroot\hosted\EnsinoNet\php\adodb\drivers\adodb-oracle.inc.php
on line 105


I´m triyng to conect with oracle with the folowing command:

$conn = ADONewConnection('oracle');
$conn-PConnect(false, 'user', 'pass', 'bata_base_name');

can some one help?

thanks
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/03


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



Re: [PHP] foro php

2003-03-12 Thread David E.S.V.
that's it... I just forgot the english word...forum... even it sounds 
latin origin

regards

David.

On Wed, 12 Mar 2003, CPT John W. Holmes wrote:

  do you know any site where I can download a free php foro to install?
 
 wtf is a foro?
 
 Ah... gotta love google. In italian it means I pierce, but in spanish it
 means forum, so I'll assume it's a forum you're looking for instead of
 some piercing PHP script.
 
 phpbb and phorum are two good ones. There are plenty more... Do a search on
 google for PHP forum to see them all.
 
 www.phpbb.com
 www.phorum.org
 
 ---John Holmes...
 
 
 

-- 

David Elías Sánchez Vásquez
Bachiller en Educación PUCP
[EMAIL PROTECTED]
telf. (51)-1-5255601



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



Re: [PHP] Array syntax not covered in documentation

2003-03-12 Thread CPT John W. Holmes
 I want to do the following:

 $u=preg_replace(/[^$chars]/e,'%.unpack(H2, $0)', $u);

 However, as you know, unpack returns an array.  I tried this instead:

 $u=preg_replace(/[^$chars]/e,'%.(unpack(H2, $0)[])', $u);

 but that isn't syntactically correct.  I know that this is possible to
 remedy using a user function but I do this kind of thing very often
 (grab the contents of an array value in one line of code) and want to be
 able to do it without splitting it into multiple lines.  Is that possible?

What exactly are you trying to do? Can you explain it and give some same
strings and output you're looking to achieve?

---John Holmes...


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



[PHP] google, php-created pages and link farm exclusion

2003-03-12 Thread Chris Hayes (SENSE)
dear list,

1) Currently Google cannot find all pages on my site because most pages are 
linked through database-generated selection boxes. Most pages have URL's 
with different query strings after index.php.

2) I have made shortcut links possible such as mydomain.org/page/37  and 
mydomain.org/person/jones.

3) I considered making a database-created page, maybe called links.php, 
with a list of all currently active pages, straight html links.

But will that work? I heard that Google has a policy to block so-called 
'link farms'; pages cramped with links, aimed to increase page ranking.
Would that exclusion also be used when the links are only for my own site?

My most important goal is that if someone looks for [Jones soil research], 
they do see a link to the page of Jones. Ranking is not that important.

If possible please support your opinion with examples/facts/links.
thanks,
Chris

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


Re: [PHP] PHP Books

2003-03-12 Thread John Nichel
I wasn't too impressed with the PHP Bible.  I haven't looked at the 
other two, but if the Sam's book is like the others I've used, I would 
say that it isn't worth it.  I have O'Reilly's Programming PHP book 
(written in part by Rasmus Lerdorf), and it's pretty good, but I find 
that the online manual is the best source of information.

Chris Blake wrote:
Greetings learned PHP(eople),

Can anyone offer comment on the following books on PHP.
I`m in the early stages of PHP and am looking for a suitable guide to
begin with.
=
Sams Teach Yourself PHP MYSQL and Apache in 24 Hours
Publisher:  Sams Publishing
ISBN:  067232489X
Publishing Date:  2003
Format:  Paperback
=
PHP BIBLE
Author:  Tim Converse
Publisher:  WILEY
ISBN:  0764549553
Pages:  875
Format:  Paperback
==
Beginner's Guides (Osborne): PHP 4: A Beginner's Guide
Author:  Bill McCarty and William McCarty
Publisher:  MCGRAW HILL
ISBN:  0072133716
Publishing Date:  2001
Pages:  544
Format:  Paperback

If anyone has used these manuals I would appreciate your input as I
don`t wanna spend a fortune on a manual and then find out it`s [EMAIL PROTECTED]


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


Re: [PHP] Array syntax not covered in documentation

2003-03-12 Thread Marek Kilimajer
maybe implode?
$u=preg_replace(/[^$chars]/e,%.implode('',unpack(H2, $0)), $u);
adrian porter wrote:

I want to do the following:

$u=preg_replace(/[^$chars]/e,'%.unpack(H2, $0)', $u);

However, as you know, unpack returns an array.  I tried this instead:

$u=preg_replace(/[^$chars]/e,'%.(unpack(H2, $0)[])', $u);

but that isn't syntactically correct.  I know that this is possible to 
remedy using a user function but I do this kind of thing very often 
(grab the contents of an array value in one line of code) and want to 
be able to do it without splitting it into multiple lines.  Is that 
possible?

thanks.
adrian



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


RE: [PHP] foro php

2003-03-12 Thread Barajas, Arturo
Daniel,

Look for phpBB, I think it's one of the best, IMHO.
--
Un gran saludo/Big regards...
   Arturo Barajas, IT/Systems PPG MX (SJDR)
   (427) 271-9918, x448

 -Original Message-
 From: David E.S.V. [mailto:[EMAIL PROTECTED]
 Sent: Miercoles, 12 de Marzo de 2003 10:11 a.m.
 To: fLIPIS
 Cc: [EMAIL PROTECTED]
 Subject: [PHP] foro php
 
 
 
 hello folks
 
 do you know any site where I can download a free php foro to install?
 
 thanks
 
 David.
 
 
 
 -- 
 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] how to uploads files

2003-03-12 Thread Luis A
hi every one :)

how can i uploads files to my server by php script ?
any hand on that i realy apreciate 

Thanks 
__
Luis Atala 
Profetional Web Desinger
Facultad de Cultura Fisica
Linux User#: 412375
ICQ#: 132736035
  Current ICQ status: 
+  More ways to contact me 
__



[PHP] RE: Calculates time elapsed between two date

2003-03-12 Thread YC Nyon
Hi,

I need to get the time/date (ie. 1 day 12 hours 11 min 4sec) between 2 time
dates.
Can't seem to find any of these functions in the PHP manual.

Thanks
Nyon




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003


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



[PHP] Force refresh of graphic - how?

2003-03-12 Thread Mark Wilson
I have a PHP page which in turn calls an image-creating PHP program,
like so:
...(calling page: mypage.php)..
body
IMG SRC=makepic.php?opt1=abcopt2=def

/body
/html


makepic.php does database lookups using the values of opt1 and opt2,
then creates a graphic (PNG) using that data and returns the graphic.
So far, so good... but the graphic is being cached, so the data is not
always up-to-date, unless I do a shift-reload of the calling page.
I tried adding a pragma nocache line to the HEAD of mypage.php,
but that had no effect. I don't want to tell my users to always do a
shift-reload - how can I force either mypage.php to not cache
the graphic, or get makepic.php's output to not be cached
Thanks... replies to [EMAIL PROTECTED]



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



Re: [PHP] Another questions about usning session.

2003-03-12 Thread Marek Kilimajer
Advantage of session is that you can trust the variables you keep in 
your session. cookies can be spoofed

André Cupini wrote:

* People, sorry my ugly English. I´m Brazilian...

I am looking for learning more about sessions... I´m test this code below
don´t work with me My php version is 4.1.2.
Anybody have a complete example code of how use sessions?
Another doubt: Sessions use cookies? What the advantage in use sessions
instead of cookies?
André Cupini
Programador
[EMAIL PROTECTED]
NeoBiz - fábrica de internet
http://www.neobiz.com.br

Definitely.
- enable cookies on your browser
- make sure you're using PHP = 4.1
1. Start with a blank text file.

2. Copy and paste this in:
---
?php
session_start();
if (!isset($_SESSION['count'])) {
   $_SESSION['count'];
}
else {
   $_SESSION['count']++;
}
?
Hello visitor, you have seen this page ?php echo $_SESSION['count'] ?
times.p
To continue, A HREF=?php echo $_SERVER['PHP_SELF']; ?click here/A
---
3. Open it up in your browser, and test that it works (the value of
$_SESSION['count'] should increase with each click)
4. If that much works, open up the URL in a second window, and try to run
two separate sessions... (the first window might be on 10 clicks, and the
new one will be starting from 1)
5. If we're still cool, now try it without cookies maybe, by adding the SID
to the URL that they click on.
If all this works, then the problem is obviously in your code somewhere, not
an issue with PHP/sessions/browsers/cookies/etc.
Justin



--
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] Force refresh of graphic - how?

2003-03-12 Thread Ray Hunter
You can use the meta tags to do a refresh of the browser page...

example:
meta http-equiv=Refresh content=10; url=New-page.html 

after content you add the seconds of delay before refresh...

More info on the meta tag:
http://www.xs4all.nl/~dimaroan/htl/index.html

--
Ray

On Wed, 2003-03-12 at 09:49, Mark Wilson wrote:
 I have a PHP page which in turn calls an image-creating PHP program,
 like so:
 ...(calling page: mypage.php)..
 body
 IMG SRC=makepic.php?opt1=abcopt2=def
 
 /body
 /html
 
 
 makepic.php does database lookups using the values of opt1 and opt2,
 then creates a graphic (PNG) using that data and returns the graphic.
 So far, so good... but the graphic is being cached, so the data is not
 always up-to-date, unless I do a shift-reload of the calling page.
 I tried adding a pragma nocache line to the HEAD of mypage.php,
 but that had no effect. I don't want to tell my users to always do a
 shift-reload - how can I force either mypage.php to not cache
 the graphic, or get makepic.php's output to not be cached
 Thanks... replies to [EMAIL PROTECTED]
 
 


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



Re: [PHP] Another questions about usning session.

2003-03-12 Thread Ray Hunter
But also note that session data can be stolen by other users too...

--
Ray

On Wed, 2003-03-12 at 10:10, Marek Kilimajer wrote:
 Advantage of session is that you can trust the variables you keep in 
 your session. cookies can be spoofed
 
 André Cupini wrote:
 
 * People, sorry my ugly English. I´m Brazilian...
 
 I am looking for learning more about sessions... I´m test this code below
 don´t work with me My php version is 4.1.2.
 Anybody have a complete example code of how use sessions?
 Another doubt: Sessions use cookies? What the advantage in use sessions
 instead of cookies?
 
 André Cupini
 Programador
 [EMAIL PROTECTED]
 NeoBiz - fábrica de internet
 http://www.neobiz.com.br
 
 
 Definitely.
 
 - enable cookies on your browser
 - make sure you're using PHP = 4.1
 
 1. Start with a blank text file.
 
 2. Copy and paste this in:
 ---
 ?php
 session_start();
 if (!isset($_SESSION['count'])) {
 $_SESSION['count'];
 }
 else {
 $_SESSION['count']++;
 }
 ?
 Hello visitor, you have seen this page ?php echo $_SESSION['count'] ?
 times.p
 To continue, A HREF=?php echo $_SERVER['PHP_SELF']; ?click here/A
 ---
 
 3. Open it up in your browser, and test that it works (the value of
 $_SESSION['count'] should increase with each click)
 
 4. If that much works, open up the URL in a second window, and try to run
 two separate sessions... (the first window might be on 10 clicks, and the
 new one will be starting from 1)
 
 5. If we're still cool, now try it without cookies maybe, by adding the SID
 to the URL that they click on.
 
 
 If all this works, then the problem is obviously in your code somewhere, not
 an issue with PHP/sessions/browsers/cookies/etc.
 
 
 Justin
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
   
 
 


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



Re: [PHP] RE: Calculates time elapsed between two date

2003-03-12 Thread Leif K-Brooks
strtotime() them, then subtract.

YC Nyon wrote:

Hi,

I need to get the time/date (ie. 1 day 12 hours 11 min 4sec) between 2 time
dates.
Can't seem to find any of these functions in the PHP manual.
Thanks
Nyon


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003
 

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


[PHP] Parsing help needed, regular expression perhaps?

2003-03-12 Thread Jeff Lewis
I am grabbing this page and trying to grab the stats on the page: 
http://slam.canoe.ca/StatsHKN/BC-HKN-STAT-TORONTOSTAX-R.html

The code I had worked just fine before but now that there are players that have 
multiple lines, it's not working as I'd like it to. Below is the code that worked and 
I need help to get it to ignore the lines of players from other teams and just get 
thheir total number.

$statsURL = http://slam.canoe.ca/StatsHKN/BC-HKN-STAT-TORONTOSTAX-R.html;;
$season = 2002-03R;
 
$urlHandle = fopen($statsURL, r);
 if (!$urlHandle) {
  echo $errstr ($errno)br\n;
  exit;
 }
 $rawHtml = fread($urlHandle,100);
 fclose($urlHandle);
 $rawHtml = stristr($rawHtml, pre);
 
$stats = substr($rawHtml, 0, strpos($rawHtml, /pre)-1);
 $playerline = preg_split(/\n/, $stats, -1, PREG_SPLIT_NO_EMPTY);
 $count = count($playerline);

 echo Players: $countP;
 for ($x = 0; $x = $count; $x++)  {
  $playerstats = preg_split(/[ ]/, $playerline[$x], -1, PREG_SPLIT_NO_EMPTY);
  }


Re: [PHP] RE: Calculates time elapsed between two date

2003-03-12 Thread Marek Kilimajer
Get timestamp of these dates, subtract them and use math to find out 
days, hours etc from the difference

YC Nyon wrote:

Hi,

I need to get the time/date (ie. 1 day 12 hours 11 min 4sec) between 2 time
dates.
Can't seem to find any of these functions in the PHP manual.
Thanks
Nyon


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003
 



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


RE: [PHP] how to uploads files

2003-03-12 Thread Jon Haworth
Hi Luis,

 how can i uploads files to my server by php script ?

The manual explains this (read the user notes as well, though):
http://www.php.net/manual/en/features.file-upload.php

Cheers
Jon

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



Re: [PHP] replace question

2003-03-12 Thread WebDev

- Original Message -
From: WebDev [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 1:24 AM
Subject: Re: [PHP] replace question

Hello

How could I know recognize a URL in $a

$a contains often a URL   htp://www.mysite.com but as well more text

how is it possible now to recognize a URL could be in $s and if so we make
it a actual html link,  for the end user...


//   start

$a= str_replace(Dog, Cat, $b);
$a_tooklinkout =
if ($a == foundlink)
{
echo  a href=\$a_tooklinkout  $c/a;
}
else


echo $a;



// end

anybody has a tip for me ..



 Thank you all




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



  1   2   3   >