Re: [PHP] Changing users in php script

2003-10-03 Thread Nitin
You can use 'sudoers' for the purpose, that way you'll be able to give just
that permission to the user of your choice. then you can connect as that
user through 'exec' or 'system' and can execute that comand.

For more information check out:
http://www.courtesan.com/sudo/intro.html

Enjoy
Nitin


- Original Message - 
From: "esctoday.com | Wouter van Vliet" <[EMAIL PROTECTED]>
To: "'John Nichel'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, October 03, 2003 4:58 AM
Subject: RE: [PHP] Changing users in php script


> I don't have much experience in it myself but I've seen it working ..
Where
> you should be looking is not really PHP but more the Apache "suexec"
> wrapper/module. You can then specify a user and group in your VirtualHost
> section.
>
> Wouter
>
> -Original Message-
> From: John Nichel [mailto:[EMAIL PROTECTED]
> Sent: Thursday, October 02, 2003 3:09 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Changing users in php script
>
> I know php runs under the same user/group as the webserver for web based
> applications, but is there a way to change to another user?  All the
> recent talk about exec got me thinking that I could set something up to
> automatically create user mailboxes under qmail + vmailmgr.  I normall
> do this via the command line by running 'vadduser' while I'm su'ed to
> the owner of the virtual host.  So basically, to do this via php, I
> would need to su to the owner of the vhost inside of the script, run the
> command, and exit out of the su.  Can this be done?
>
> -- 
> By-Tor.com
> It's all about the Rush
> http://www.by-tor.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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] unexpected results using sprintf() with %u

2003-10-03 Thread David Otton
On Fri, 3 Oct 2003 15:51:59 +1000, you wrote:

>Im trying to retrieve the unsigned value of an integer. sounds pretty simple...
>
>[code]
>$i = -86;
>echo "" . sprintf("%d", $i);
>echo "" . sprintf("%u", $i);
>[/code]
>
>produces:
>-86
>4294967198
>
>what i expected:
>-86
>86
>
>Ive searched the archives but most of the messages refer to %s or %d... nothing in 
>regards to %u
>
>can anyone see what im doing wrong?

Uh... first, that's correct behaviour for %u

Second, you're trying to find the absolute value of an integer:

echo (abs(-86));

Third, how to explain the behaviour you're seeing. Um...

Binary numbers are made up of two symbols, right? 0 and 1.

There's no room in a binary computer for a third '-' symbol to denote
negative numbers, so you have to overload one of your existing symbols to
signify "negative".

Ok, lets work with 8-bit numbers to simplify things. An unsigned 8 bit
number can run from 0 to 255:

 = 0
0001 = 1
[...]
1110 = 254
 = 255

By convention, a signed 8-bit number sacrifices it's left-most column to
denote negative (1) or positive (0), so it can run from -127 to +127:

 = -127
1110 = -126
[...]
1001 = -1
 = 0
0001 = 1
[...]
0110 = 126
0111 = 127

Hope you're with me so far - signed numbers use the left-most column to
store the sign of the number. If the left-most column is 1, the number is
negative.

What you are doing with %u is forcing printf() to treat a signed number with
a leading 1 as if it was an unsigned number. Thus, an unsigned int

1001 = -1

would be interpreted as

1001 = 129

This stuff is very basic Computer Science.

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



[PHP] dynamic table problem

2003-10-03 Thread irinchiang


Hi all:
Having some problems right here. Below are a snip my codes:

 class="Devi" width="15%" align="center" 
valign="middle">2PE1012
.
.
.

Grey
Pink
Blue
Yellow
Cyan





What I am trying to do here is to create a table where I can change its cell
color by selecting the colors from the drop down menu.
The cell colour managed to change to the colour I want but whenever I open the
page on a new browser, the colour turned out to be a combination of all my
colours. How can I make it in the sense that this cell colour can be changed
permanently to the colour I want(even when I reopen this file using a new
browser) until I changed the colour again.
Futhermore, how can I store the colour code into the database(MySQL)???
Any special datatypes for that?

Hope to get some help.
Thanks.

Regards, 
Irin.

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



RE: [PHP] PHP Editor

2003-10-03 Thread Nico Berg
Hi, I have found the solution to my problem, I share it
http://phpeditors.linuxbackup.co.uk/

Greetings and thanks,
Nico

-Oorspronkelijk bericht-
Van: Jay Blanchard [mailto:[EMAIL PROTECTED]
Verzonden: donderdag 2 oktober 2003 14:30
Aan: Nico Berg; PHP General
Onderwerp: RE: [PHP] PHP Editor


[snip]
I am pretty new in PHP coding. So for starters i want to know what is a
good
php-editor?
I like them freeware for windows.
[/snip]

EDIT for windows is great, it's free, it's already installed and it
requires that you do no additional searching of manuals, archives, or
the web to use. Click Start->Run. Type command and hit enter. When the
command prompt arrives type 'edit' and hit enter. Voila! A windows
freeware editing too. You can even use it for batch files, PERL, ASP,
and several other languages.

-- 
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] Building associative arrays

2003-10-03 Thread chris . neale
I'm stuck.

I'm trying to build an associative array from a database result. How can I
assign a new key and value pair

eg

mysql_fetch_row etc
{
dbRowCol1 = myarray(key)
dbRowCol2 = myarray(value)
}

You get the general idea. Can't find any examples. I'm trying to lookup a
key and retrieve the corresponding value.

Any ideas?

Thanks

Chris
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



[PHP] PHP & EJB

2003-10-03 Thread Alec
Hi,

Though I have used PHP with Java Objects for sometime, I am keen to know
whether anyone has tried using PHP to communicate with Enterprise
JavaBeans??


Thanks

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



RE: [PHP] embedding code

2003-10-03 Thread Ford, Mike [LSS]
On 03 October 2003 05:06, John Taylor-Johnston wrote:

> Brian or anyone,
> 
> Ok, supposing I don't want someone to be able to use 

[PHP] session control query

2003-10-03 Thread STONE Steven
Hi there,
 
I'm currently working on a user login script. I'm using session
variables. Everything seems to be working fine but I continually get the
following warning message when I run the programs:
 
Warning: Cannot send session cache limiter - headers already sent
(output started at c:\phpdev\www\staffdb2\side_menu.php:3) in
c:\phpdev\www\staffdb2\side_menu.php on line 4
 
The side_menu.php routine is below:


Log out';
}
else 
{
echo 'You are not logged in';
}
?>
 
The session variable 'valid_user' is set in the following routine:

 
Any ideas.
 
PS : I am rather new to php so be kind please.
 
Regards,
Steve.
 
 


Re: [PHP] session control query

2003-10-03 Thread Veniamin Goldin
Hi,
   session_start(); must be a very first line of script. Before any
   html output.


   Regards,
   Veniamin
   
SS> Hi there,
 
SS> I'm currently working on a user login script. I'm using session
SS> variables. Everything seems to be working fine but I continually get the
SS> following warning message when I run the programs:
 
SS> Warning: Cannot send session cache limiter - headers already sent
SS> (output started at c:\phpdev\www\staffdb2\side_menu.php:3) in
SS> c:\phpdev\www\staffdb2\side_menu.php on line 4
 
SS> The side_menu.php routine is below:
SS> 
SS> 
SS>  session_start();
SS> //require_once('user_auth_fns.php');
SS> //check_valid_user();
SS> if (isset($HTTP_SESSION_VARS['valid_user']))
SS> {
SS> echo 'Log out';
SS> }
SS> else 
SS> {
SS> echo 'You are not logged in';
SS> }
?>>
 
SS> The session variable 'valid_user' is set in the following routine:
SS>  require_once('staffdb_fns.php');
SS> session_start();
 
SS> $username=$HTTP_POST_VARS['username'];
SS> $passwrd=$HTTP_POST_VARS['passwrd'];
 
SS> if ($username && $passwrd)
SS> {
SS> if (login($username,$passwrd))
SS> {
SS> $HTTP_SESSION_VARS['valid_user']=$username;
SS> display_page_layout();
SS> }
SS> else 
SS> {
SS> echo 'login failed';
SS> display_login_form();
SS> exit;
SS> }
SS> }
SS> else 
SS> {
SS> display_login_form();
SS> }
 
SS> //check_valid_user();
 
?>>
 
SS> Any ideas.
 
SS> PS : I am rather new to php so be kind please.
 
SS> Regards,
SS> Steve.

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



RE: [PHP] session control query

2003-10-03 Thread Angelo Zanetti

thats pretty much a golden rule of sessions =)

-Original Message-
From: Veniamin Goldin [mailto:[EMAIL PROTECTED]
Sent: Friday, October 03, 2003 12:41 PM
To: STONE Steven
Cc: php mailing list
Subject: Re: [PHP] session control query


Hi,
   session_start(); must be a very first line of script. Before any
   html output.


   Regards,
   Veniamin

SS> Hi there,

SS> I'm currently working on a user login script. I'm using session
SS> variables. Everything seems to be working fine but I continually get the
SS> following warning message when I run the programs:

SS> Warning: Cannot send session cache limiter - headers already sent
SS> (output started at c:\phpdev\www\staffdb2\side_menu.php:3) in
SS> c:\phpdev\www\staffdb2\side_menu.php on line 4

SS> The side_menu.php routine is below:
SS> 
SS> 
SS>  session_start();
SS> //require_once('user_auth_fns.php');
SS> //check_valid_user();
SS> if (isset($HTTP_SESSION_VARS['valid_user']))
SS> {
SS> echo 'Log out';
SS> }
SS> else
SS> {
SS> echo 'You are not logged in';
SS> }
?>>

SS> The session variable 'valid_user' is set in the following routine:
SS>  require_once('staffdb_fns.php');
SS> session_start();

SS> $username=$HTTP_POST_VARS['username'];
SS> $passwrd=$HTTP_POST_VARS['passwrd'];

SS> if ($username && $passwrd)
SS> {
SS> if (login($username,$passwrd))
SS> {
SS> $HTTP_SESSION_VARS['valid_user']=$username;
SS> display_page_layout();
SS> }
SS> else
SS> {
SS> echo 'login failed';
SS> display_login_form();
SS> exit;
SS> }
SS> }
SS> else
SS> {
SS> display_login_form();
SS> }

SS> //check_valid_user();

?>>

SS> Any ideas.

SS> PS : I am rather new to php so be kind please.

SS> Regards,
SS> Steve.

--
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 swap the table's bg color with php

2003-10-03 Thread Jack
Dear all
I had write a script using php,which will pull the values from a mysql table
to display in HTML.
now i want to add a function which when the mouse had move over a table
cell, the background of the table cell will turn to other color!

Is anyone know how i can perform this task?
Thx alot!
Jack

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



[PHP] mysql query

2003-10-03 Thread Cameron Metzke
ok im stumped lol i have used this code in the past to insert data into
mysql (im relitively new though)
--code
mysql_query("INSERT INTO Images (Image, desc) VALUES ('$name',
'$description')") or die (mysql_error());
--end code-
but i get this error]
-error-
You have an error in your SQL syntax. Check the manual that corresponds to
your MySQL server version for the right syntax to use near ''Image', 'desc')
VALUES ('2419091.jpg', 'stone')' at line 1
--- end error--
I found if i just try and record the name value it works fine but if i try
to add the description i get the error.
Any clues?
:)

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



Re: [PHP] mysql query

2003-10-03 Thread Tom Rogers
Hi,

Friday, October 3, 2003, 8:17:23 PM, you wrote:
CM> ok im stumped lol i have used this code in the past to insert data into
CM> mysql (im relitively new though)
CM> --code
CM> mysql_query("INSERT INTO Images (Image, desc) VALUES ('$name',
CM> '$description')") or die (mysql_error());
CM> --end code-
CM> but i get this error]
CM> -error-
CM> You have an error in your SQL syntax. Check the manual that corresponds to
CM> your MySQL server version for the right syntax to use near ''Image', 'desc')
CM> VALUES ('2419091.jpg', 'stone')' at line 1
CM> --- end error--
CM> I found if i just try and record the name value it works fine but if i try
CM> to add the description i get the error.
CM> Any clues?
CM> :)


it may be because desc is a reserved word, put it in backticks `desc`

-- 
regards,
Tom

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



Re: [PHP] mysql query

2003-10-03 Thread Cameron Metzke
Thanx Tom, i should of realized that lol.
Again Thanx :)
"Tom Rogers" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> Friday, October 3, 2003, 8:17:23 PM, you wrote:
> CM> ok im stumped lol i have used this code in the past to insert data
into
> CM> mysql (im relitively new though)
> CM> --code
> CM> mysql_query("INSERT INTO Images (Image, desc) VALUES ('$name',
> CM> '$description')") or die (mysql_error());
> CM> --end code-
> CM> but i get this error]
> CM> -error-
> CM> You have an error in your SQL syntax. Check the manual that
corresponds to
> CM> your MySQL server version for the right syntax to use near ''Image',
'desc')
> CM> VALUES ('2419091.jpg', 'stone')' at line 1
> CM> --- end error--
> CM> I found if i just try and record the name value it works fine but if i
try
> CM> to add the description i get the error.
> CM> Any clues?
> CM> :)
>
>
> it may be because desc is a reserved word, put it in backticks `desc`
>
> --
> regards,
> Tom

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



Re: [PHP] Creating Objects!

2003-10-03 Thread Burhan Khalid
Webmaster wrote:

let us say there is Class A.
In the constructor of this class I create an Object B of Class B.
Now what is the difference between these two ?

this->B = new B;

and

B = new B;
The "this" object always points to the current instance of an object. So 
whenever you refer to a variable with $this->, you are accessing the 
variable that is in the current object's memory space. Here is an example :

class a {

  var $foo;
  var $bar;
  function a()
  {
 $this->foo = "Hello ";
 $this->bar = "World";
 $foo = "Widgets";
  }
  function dump()
  {
 echo $this->foo.$this->bar;
  }
}
$obj = new a();
$obj->dump();
This above snippet will print "Hello World", because the $foo variable 
that is created in the constructor does not have object scope. In other 
words, $foo only exists in that function. You can verify this by using 
the print_r function thusly :

echo ""; print_r($obj); echo "";

To answer your original question, the difference between using $this-> 
and not is that with $this-> the variable referenced is one that exists 
in the object's scope.  If you want to create an instance of the object 
that you don't plan to use in other members of that class, then you can 
make it "local" to that member by omitting $this->

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Mail.php help

2003-10-03 Thread Burhan Khalid
Eric Rounds wrote:
We have PHP 4.2 installed on Mac OS X under Apache.

The settings in the php.ini file are:

sendmail_from - [EMAIL PROTECTED]
sendmail_path - /usr/sbin/sendmail -t -i 
SMTP - localhost
smtp_port - 25
This probably isn't related to your problem, but there is already a 
localhost.com registered on the net.

Also worthwhile to check is if your MTA requires authentication.

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] How to read remote files

2003-10-03 Thread Nitin
Hi all,

I'm having a problem, hope to get some suggestios on the same.
Here it goes:

I've an application where I need to read an html file stored on user's pc through my 
PHP script and send an email to specified addresses. 

Problem is how to read a file on user's pc as I cann't allow them to upload any file 
to my server. My script will also detect any pictures attached and embed those to the 
message. 

Any suggestions are most welcome. Thanx in advance.

Nitin

Re: [PHP] embedding code

2003-10-03 Thread John W. Holmes
John Taylor-Johnston wrote:
Brian or anyone,

Ok, supposing I don't want someone to be able to use 

Re: [PHP] How to read remote files

2003-10-03 Thread John W. Holmes
Nitin wrote:

I'm having a problem, hope to get some suggestios on the same.
Here it goes:
I've an application where I need to read an html file stored on user's pc through my PHP script and send an email to specified addresses. 

Problem is how to read a file on user's pc as I cann't allow them to upload any file to my server. My script will also detect any pictures attached and embed those to the message. 
Ummm... NO. You can't just read a file on a user's computer. There is 
such a thing as security for most of us. :)

The user needs to upload it, ftp it, or run their own server to give you 
access to it.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

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


Re: [PHP] How to read remote files

2003-10-03 Thread Nitin
it's not about user's security, cauz, of course, user'll have to specify the
page.

- Original Message - 
From: "John W. Holmes" <[EMAIL PROTECTED]>
To: "Nitin" <[EMAIL PROTECTED]>
Cc: "PHP-General" <[EMAIL PROTECTED]>
Sent: Friday, October 03, 2003 4:33 PM
Subject: Re: [PHP] How to read remote files


> Nitin wrote:
>
> > I'm having a problem, hope to get some suggestios on the same.
> > Here it goes:
> >
> > I've an application where I need to read an html file stored on user's
pc through my PHP script and send an email to specified addresses.
> >
> > Problem is how to read a file on user's pc as I cann't allow them to
upload any file to my server. My script will also detect any pictures
attached and embed those to the message.
>
> Ummm... NO. You can't just read a file on a user's computer. There is
> such a thing as security for most of us. :)
>
> The user needs to upload it, ftp it, or run their own server to give you
> access to it.
>
> -- 
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> php|architect: The Magazine for PHP Professionals – www.phparch.com
>
>
>
>

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



Re: [PHP] PHP & EJB

2003-10-03 Thread Raditha Dissanayake
Hi Alec,

I have dabbled with php and java combinations at various times as well. 
But IMHO combining PHP with EJB would be like combining the 'simplest 
approach to solving a problem' with the 'most complicated approach' to 
solving a problem. :-)

best regards

Alec wrote:

Hi,

Though I have used PHP with Java Objects for sometime, I am keen to know
whether anyone has tried using PHP to communicate with Enterprise
JavaBeans??
Thanks

 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/  |  http://www.raditha/megaupload/
Lean and mean Secure FTP applet with  |  Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB  |  with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] OT(?): mod_rewrite not passing GET variables to php

2003-10-03 Thread Steven Jarvis
On Wednesday, October 1, 2003, at 04:16  PM, Leif K-Brooks wrote:

Steven Jarvis wrote:

I'm just starting to experiment with mod_rewrite on Apache 1.3.x and 
php 4.3.3. Register_globals is off.

I have the following rules in my .htaccess file (which sits in the 
site's root dir along with paper.php):

RewriteEngine On
RewriteRule ^/([a-z]+)/([a-z]+)/$ paper.php?paper=$1§ion=$2 [L]
The browser gets served up paper.php, but I can't access the 
variables that should be in $1 and $2. They're supposed to be GET 
variables, right?

I've tried accessing them with $_GET["varname"] and 
$_REQUEST["varname"]  (and directly with $varname, even though 
register_globals is off), but I get nothing.

Can someone point out the (probably obvious) problem I'm having?

Try this (I'm no mod_rewrite expert, so no promises):

RewriteEngine On
RewriteRule /^([a-z]+)\/([a-z]+)$/ paper.php?paper=$1§ion=$2 [L]
Thanks for the help, but nope, same results. Still no variables are 
passed to the page.

I think there may be an issue with my Apache install. I'm going to 
explore that today.

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


[PHP] NEW: XML Application Objects

2003-10-03 Thread Terence
I've just released the first distribution for an open-source project 
called XML Application Objects (XAO). It's the result of working with 
XML/XSLT in PHP for a couple of years now. Although this is an alpha 
release, the concept itself has gone through a lot of refinement and is 
now ready for prime time.

The publication of the project itself was partially motivated by the 
discussions that took place in this thread (A Complete List of PHP 
Template Engines?) which basically sees me arguing for the usage of 
standards (XSLT) rather than having to learn a proprietary new 
templating system every time you work on someone elses PHP app.

This project is the result of much blood, sweat, and tears so I hope 
someone out there finds it useful. I have made documentation a paramount 
considderation for the XAO API because I'm keen for it to be another PHP 
success story. The website has a tonne of information so I'm not gonna 
try and promote XAO in this message.

Please check it out...

http://xao-php.sourceforge.net/

cheers.

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


[PHP] Re: NEW: XML Application Objects

2003-10-03 Thread Terence
Terence wrote:


The publication of the project itself was partially motivated by the 
discussions that took place in this thread (A Complete List of PHP 
Template Engines?) 


sorry, forgot to include the link to the thread.
http://www.sitepointforums.com/showthread.php?threadid=123769
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] How to swap the table's bg color with php

2003-10-03 Thread chris . neale
Try using stylesheets instead of javascript. I think you need to use :hover
on either the td element and then specify a style. background-color I think
it is.

I haven't got my HTML reference handy and can't remember the specifics, but
that's the general idea.

Hope that's of some use.

Regards

Chris

-Original Message-
From: Jack [mailto:[EMAIL PROTECTED]
Sent: 03 October 2003 10:12
To: [EMAIL PROTECTED]
Subject: [PHP] How to swap the table's bg color with php


Dear all
I had write a script using php,which will pull the values from a mysql table
to display in HTML.
now i want to add a function which when the mouse had move over a table
cell, the background of the table cell will turn to other color!

Is anyone know how i can perform this task?
Thx alot!
Jack

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] How to swap the table's bg color with php

2003-10-03 Thread SED
You will need Javascript and CSS (and this is not a postlist for that).
If you are not familiar to both, this work can get tricky at first.

Regards, 
Sumarlidi Einar Dadason 

SED DESIGN 
_ 
Address:  Thingvallastraeti 4
  600 Akureyri
  Iceland
Voice:+354-8458182 
Email:[EMAIL PROTECTED] 
Website:  http://www.sed.is 







-Original Message-
From: Jack [mailto:[EMAIL PROTECTED] 
Sent: 3. október 2003 10:12
To: [EMAIL PROTECTED]
Subject: [PHP] How to swap the table's bg color with php


Dear all
I had write a script using php,which will pull the values from a mysql
table to display in HTML. now i want to add a function which when the
mouse had move over a table cell, the background of the table cell will
turn to other color!

Is anyone know how i can perform this task?
Thx alot!
Jack

-- 
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] [AWF-TOPIC] Create from PHP on the Fly???

2003-10-03 Thread Jay Blanchard
[snip]
>>I think Jay probably understands, but for those who don't, 
>>http://www.gnu.org/philosophy/free-sw.html

Quite frankly i don't mind people using anything that i open source in 
commercial applications. When i do mind i don't release it as open 
source :-)
[/snip]

***applause*** Well said!

(I wanted to say other stuff here, but I just couldn't say it well this
morning. I will say that there is no shame in profiting from commercial
use projects).

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



[PHP] Re: Building associative arrays

2003-10-03 Thread rush
> I'm trying to build an associative array from a database result. How can I
> assign a new key and value pair
>
> eg
>
> mysql_fetch_row etc
> {
> dbRowCol1 = myarray(key)
> dbRowCol2 = myarray(value)
> }
>
> You get the general idea. Can't find any examples. I'm trying to lookup a
> key and retrieve the corresponding value.

is this what you are lookin for?

 mysql_fetch_row etc
 { //let's assume $row is result of mysql_fetch:row(..
$key = $row['key_sql_col'];
$value = $row['value_sql_col'];
$myarray[$key]=$value;
 }

rush
--
http://www.templatetamer.com/

"Chris Neale" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

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



Re: [PHP] Building associative arrays

2003-10-03 Thread Eugene Lee
On Fri, Oct 03, 2003 at 10:22:55AM +0100, [EMAIL PROTECTED] wrote:
: 
: I'm trying to build an associative array from a database result. How can I
: assign a new key and value pair
: 
: eg
: 
: mysql_fetch_row etc
: {
: dbRowCol1 = myarray(key)
: dbRowCol2 = myarray(value)
: }
: 
: You get the general idea. Can't find any examples. I'm trying to lookup a
: key and retrieve the corresponding value.

If you really want your table's field names returned as keys, try using
mysql_fetch_assoc().

http://www.php.net/manual/en/function.mysql-fetch-row.php

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



Re: [PHP] How to read remote files

2003-10-03 Thread Burhan Khalid
Nitin wrote:

it's not about user's security, cauz, of course, user'll have to specify the
page.
Nitin, what you want is a form uploader script. If you have fantasies 
about being able to read a file on a user's computer just because they 
tell you the location ... time to wake up.

John is correct.

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How to swap the table's bg color with php

2003-10-03 Thread Eugene Lee
On Fri, Oct 03, 2003 at 06:11:39PM +0800, Jack wrote:
: 
: I had write a script using php,which will pull the values from a mysql table
: to display in HTML.
: now i want to add a function which when the mouse had move over a table
: cell, the background of the table cell will turn to other color!
: 
: Is anyone know how i can perform this task?

You'll have to write up some function in JavaScript that gets invoked on
a onMouseover() event.

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



RE: [PHP] How to read remote files

2003-10-03 Thread Jay Blanchard
[snip]
Nitin wrote:

> it's not about user's security, cauz, of course, user'll have to
specify the
> page.
> 

Nitin, what you want is a form uploader script. If you have fantasies 
about being able to read a file on a user's computer just because they 
tell you the location ... time to wake up.
[/snip]

Agreed, with one minor point.

If the users are on a network this would be possible, you would just
need to know the path to the file in question. There are several
hot-button issues with this, but we have found seveal ways to work and
play nicely together.

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



Re: [PHP] mysql query

2003-10-03 Thread Nicholas Robinson
DESC is a reserved word (used to indicate a DESCending ORDER bY).

N

On Friday 03 Oct 2003 11:17 am, Cameron Metzke wrote:
> ok im stumped lol i have used this code in the past to insert data into
> mysql (im relitively new though)
> --code
> mysql_query("INSERT INTO Images (Image, desc) VALUES ('$name',
> '$description')") or die (mysql_error());
> --end code-
> but i get this error]
> -error-
> You have an error in your SQL syntax. Check the manual that corresponds to
> your MySQL server version for the right syntax to use near ''Image',
> 'desc') VALUES ('2419091.jpg', 'stone')' at line 1
> --- end error--
> I found if i just try and record the name value it works fine but if i try
> to add the description i get the error.
> Any clues?
>
> :)

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



[PHP] help - with pdf downloads

2003-10-03 Thread pete M
I'm directing client via a link to a download page for pdf documents.

This code works on mozilla + firebird but in IE	however it pops up with 
a open/save dialog - with the filetype missing and then an error when 
open/save pressed saying "cannot find the site".

As you can see below I've tried all sorts of variations but still the 
same error

can someone help me out !!!

tia
Pete
---
$dir = '/www/cgi-bin/docu/pdfs/';
$file = $dir.$row['path']."/".$row['file_name'];
$file_name = "file_".trim($_GET['n']).".pdf";

//force download dialog
header("Pragma: no-cache");
//header("Content-type: application/octet-stream\n");
header("Content-type: application/pdf\n");
//header("Content-type: application/x-download");
//header("Content-disposition: inline; filename=$file_name\n");
header("Content-disposition: attachment;filename=$file_name\n");
header("Content-transfer-encoding: binary\n");
//header("Accept-Ranges: bytes");
header("Content-length: " . filesize($file) . "\n");


//send file contents
$fp=fopen($file, "r");
fpassthru($fp);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Building associative arrays

2003-10-03 Thread chris . neale
Perfect. Thanks for that. I can't think associative arrays first thing in
the morning. Seems a bit clearer now...

C

-Original Message-
From: Eugene Lee [mailto:[EMAIL PROTECTED]
Sent: 03 October 2003 12:07
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Building associative arrays


On Fri, Oct 03, 2003 at 10:22:55AM +0100, [EMAIL PROTECTED]
wrote:
: 
: I'm trying to build an associative array from a database result. How can I
: assign a new key and value pair
: 
: eg
: 
: mysql_fetch_row etc
: {
: dbRowCol1 = myarray(key)
: dbRowCol2 = myarray(value)
: }
: 
: You get the general idea. Can't find any examples. I'm trying to lookup a
: key and retrieve the corresponding value.

If you really want your table's field names returned as keys, try using
mysql_fetch_assoc().

http://www.php.net/manual/en/function.mysql-fetch-row.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



Re: [PHP] NEW: XML Application Objects

2003-10-03 Thread Robert Cummings
On Fri, 2003-10-03 at 07:21, Terence wrote:
> 
> The publication of the project itself was partially motivated by the 
> discussions that took place in this thread (A Complete List of PHP 
> Template Engines?) which basically sees me arguing for the usage of 
> standards (XSLT) rather than having to learn a proprietary new 
> templating system every time you work on someone elses PHP app.
> 

XSLT is itself yet another language to learn. Albeit a standard, it is
much heavier than using simple XML tags or macros with PHP code.
personally I never cared much for XSLT, but I imagine that goes back to
my not liking LISP either -- which is a case of not liking functional
languages versus procedural languages.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] Committing OO Sin

2003-10-03 Thread Gerard Samuel
Or is there such a thing.  ;)
I have a small collection of utility classes, and it seems like the more 
I add,
the more cumbersome things seem to get.
A brief synopsis of code execution.
1.  Start DB class
2.  Start Smarty class, passing reference of DB class to Smarty
3.  When needed start Date-Time class
4.  When needed start Text-Format class, passing reference of Smarty 
class to Text-Format class,
which also has a reference to the DB class.  (Im using both within the 
Text-Format class)

Currently, I have a file of functions that handle user management, a 
possible candidate for a class.
If I were to convert it, it would go between steps 1 and 2, and would 
need a reference to the DB class.
Then the Smarty class is going to need a reference of the proposed user 
management class.
By that time, Smarty contains itself, a reference to the DB class, 
reference to the user management class which
in turn contains a reference to the DB class.
All these references, are beginning to worry me, to the point where Im 
second guessing myself, that
Im going about this the wrong way.
Making "utility" classes are somewhat straight forward, but getting them 
to work together,
seems like a pain.

So I was thinking, if a class was started in the global space, is it a sin,
to use the $GLOBALS array to access it, instead of tying in all these 
references??

Thanks for any input you may provide.

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


RE: [PHP] Committing OO Sin

2003-10-03 Thread Jay Blanchard
[snip]
Making "utility" classes are somewhat straight forward, but getting them

to work together, seems like a pain.

So I was thinking, if a class was started in the global space, is it a
sin,
to use the $GLOBALS array to access it, instead of tying in all these 
references??
[/snip]

Global space? Yes, what you're talking about, if possible, is a sin. 

Why is getting the classes to work together a pain?

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



RE: [PHP] [AWF-TOPIC] Create from PHP on the Fly???

2003-10-03 Thread Robert Cummings
On Fri, 2003-10-03 at 07:58, Jay Blanchard wrote:
> [snip]
> >>I think Jay probably understands, but for those who don't, 
> >>http://www.gnu.org/philosophy/free-sw.html
> 
> Quite frankly i don't mind people using anything that i open source in 
> commercial applications. When i do mind i don't release it as open 
> source :-)
> [/snip]
> 
> ***applause*** Well said!
> 
> (I wanted to say other stuff here, but I just couldn't say it well this
> morning. I will say that there is no shame in profiting from commercial
> use projects).

Perhaps I've been a little misunderstood. I love the whole open source
movement, I love that code can be shared, and I was happy to release my
own code as open source. I only have issues with the GPL, and licenses
like it, that seem to me to cause the developer to relinquish all
control of their work.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Committing OO Sin

2003-10-03 Thread Fabrizio Balliano
I suggest you should use MerlinWork ;-)

It does these things for you.

Fabrizio Balliano

Il ven, 2003-10-03 alle 16:23, Gerard Samuel ha scritto:
> Or is there such a thing.  ;)
> I have a small collection of utility classes, and it seems like the
more 
> I add,
> the more cumbersome things seem to get.
> A brief synopsis of code execution.
> 1.  Start DB class
> 2.  Start Smarty class, passing reference of DB class to Smarty
> 3.  When needed start Date-Time class
> 4.  When needed start Text-Format class, passing reference of Smarty 
> class to Text-Format class,
> which also has a reference to the DB class.  (Im using both within the
> Text-Format class)
> 
> Currently, I have a file of functions that handle user management, a 
> possible candidate for a class.
> If I were to convert it, it would go between steps 1 and 2, and would 
> need a reference to the DB class.
> Then the Smarty class is going to need a reference of the proposed
user 
> management class.
> By that time, Smarty contains itself, a reference to the DB class, 
> reference to the user management class which
> in turn contains a reference to the DB class.
> All these references, are beginning to worry me, to the point where Im
> second guessing myself, that
> Im going about this the wrong way.
> Making "utility" classes are somewhat straight forward, but getting
them 
> to work together,
> seems like a pain.
> 
> So I was thinking, if a class was started in the global space, is it a
sin,
> to use the $GLOBALS array to access it, instead of tying in all these 
> references??
> 
> Thanks for any input you may provide.
-- 
Fabrizio Balliano


CREALABS
Viale dei Mughetti, 13/A - 10151 Torino - Italy
Tel. +39-011-735645 - Fax +39-011-735645
http://www.crealabs.it - mailto:[EMAIL PROTECTED]

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



Re: [PHP] Committing OO Sin

2003-10-03 Thread Robert Cummings
On Fri, 2003-10-03 at 10:23, Gerard Samuel wrote:
> Or is there such a thing.  ;)
> I have a small collection of utility classes, and it seems like the more 
> I add,
> the more cumbersome things seem to get.
> A brief synopsis of code execution.
> 1.  Start DB class
> 2.  Start Smarty class, passing reference of DB class to Smarty
> 3.  When needed start Date-Time class
> 4.  When needed start Text-Format class, passing reference of Smarty 
> class to Text-Format class,
> which also has a reference to the DB class.  (Im using both within the 
> Text-Format class)
> 
> Currently, I have a file of functions that handle user management, a 
> possible candidate for a class.
> If I were to convert it, it would go between steps 1 and 2, and would 
> need a reference to the DB class.
> Then the Smarty class is going to need a reference of the proposed user 
> management class.
> By that time, Smarty contains itself, a reference to the DB class, 
> reference to the user management class which
> in turn contains a reference to the DB class.
> All these references, are beginning to worry me, to the point where Im 
> second guessing myself, that
> Im going about this the wrong way.
> Making "utility" classes are somewhat straight forward, but getting them 
> to work together,
> seems like a pain.
> 
> So I was thinking, if a class was started in the global space, is it a sin,
> to use the $GLOBALS array to access it, instead of tying in all these 
> references??

I think reasons like your above are why people, quite often these days,
create frameworks. Frameworks are generally designed from the ground up
to provide the kind of interactions you are moving towards while at the
same time, loosely coupling the interactive pieces to provide
flexibility. With regards to the question of sin -- most books regard
them as dirty dirty little beasts. That said, the entire PHP philosophy
revolves around globals. In my opinion though, the internal globals used
by PHP are fine, but blatant creation by your own code is generally a
design flaw. There are times when it is useful to create a global, for
instance I encapsulate all of my framework's data via a single globals
variable ($GLOBALS['interJinn']). A purist might argue that this is bad;
however, the purist could not do any better since to create an object to
hold such data would still require an anchor point somewhere in the
global space. From this I think it follows that too many global
variables -- poor design. The occasional global variable -- good design
(notwithstanding other design issues :)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] OT(?): mod_rewrite not passing GET variables to php

2003-10-03 Thread Christophe Chisogne
Steven Jarvis wrote:
>>>
RewriteEngine On
RewriteRule ^/([a-z]+)/([a-z]+)/$ paper.php?paper=$1§ion=$2 [L]
Try this (I'm no mod_rewrite expert, so no promises):

RewriteEngine On
RewriteRule /^([a-z]+)\/([a-z]+)$/ paper.php?paper=$1§ion=$2 [L]
The first try seemed better (in Apache config, '/' means '/' and not
'begin or end of a regex'. But shouldnt be the rewritten url be 
absolute? Just try this and let us know if its better

RewriteEngine On
RewriteRule ^/([a-z]+)/([a-z]+)/$ 
http://myhost.com/path_to_my_dir/paper.php?paper=$1§ion=$2 [L]

Christophe

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


Re: [PHP] Reloading a specific window

2003-10-03 Thread Marek Kilimajer
1. you have the main window.
2. user clicks ADD, new windows pops up
3. user enters data into the new window, submits
4. action.php updates database and outputs:

document.window.opener.reload()
self.close();

Close this window and reoad the main window
   together with all necessery html stuff
Rich Fox wrote:
This does not work, when I replace my header function with:
elseif (isset($_POST['btnSave']))
{
.. database update, then...
$ostr = <<< OUTPUT;
 
  document.window.opener.reload()
  self.parent.close();
 
OUTPUT;
 echo $ostr;
 //header("Location: ".$_POST['CallingScript']."?ID=".$_POST['ID']);
 exit;
}
several things happen: the database update does not happen, the mainwindow
does not reload, and my form disappears from the popup frame and this frame
is blank.
I am probably doing something very stupid.
Marek Kilimajer wrote

Output from action.php:

opener.location.reload();
close();

Rich Fox wrote:

Warning for server side purists: My php scripts use javascript to popup
and

close windows. So this question, although posted to a php newsgroup, has
elements of javascript too. Gasp! No flames please.
I have a main window which I will refer to as mainwindow
(window.name='mainwindow' in the onload event). The script loaded into
it is

mainListing.php. From mainListing.php I popup another window, with a
form

and a save button. The form's action is "action.php"

In action.php I update the database and then would like to: (1) refresh
mainwindow so it reflects the database changes, and (2) close the popup
window.
I have been reading, tweaking, trying different things but nothing is
working. Currently, the action script does:
...
elseif (isset($_POST['btnSave']))
{
  .. update the database, then ...
   header("Location: ".$_POST['CallingScript']."?ID=".$_POST['ID']);
   exit;
}
...
This reloads the popup window, and then I have a "close" button to close
the

popup. Then I have to refresh the browser window manually to see the
updated

table from the database. Can I get some advice on how to accomplish (1)
and

(2) above?

Many thanks,

Rich



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


Re: [PHP] How to read remote files

2003-10-03 Thread Nitin
yea, it's on my network only
the only thing is server is on linux n behind the firewall, while clients r
on windows n linux too
please let me know, if that's possible, as i'll of course know the path as
uer will have to specify it to read the file

n thanks to all of u for ur support
Nitin

- Original Message - 
From: "Jay Blanchard" <[EMAIL PROTECTED]>
To: "Burhan Khalid" <[EMAIL PROTECTED]>; "Nitin"
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, October 03, 2003 5:43 PM
Subject: RE: [PHP] How to read remote files


> [snip]
> Nitin wrote:
>
> > it's not about user's security, cauz, of course, user'll have to
> specify the
> > page.
> >
>
> Nitin, what you want is a form uploader script. If you have fantasies
> about being able to read a file on a user's computer just because they
> tell you the location ... time to wake up.
> [/snip]
>
> Agreed, with one minor point.
>
> If the users are on a network this would be possible, you would just
> need to know the path to the file in question. There are several
> hot-button issues with this, but we have found seveal ways to work and
> play nicely together.
>
> -- 
> 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] How to read remote files

2003-10-03 Thread Jay Blanchard
[snip]
yea, it's on my network only
the only thing is server is on linux n behind the firewall, while
clients r
on windows n linux too
please let me know, if that's possible, as i'll of course know the path
as
uer will have to specify it to read the file
[/snip]

On the Windows machines the folders containing the files will have to be
'shared'

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



Re: [PHP] [AWF-TOPIC] Create from PHP on the Fly???

2003-10-03 Thread Raditha Dissanayake
I hear you robert.

I will be shot down for saying the following  but here goes:

The GPL tends to scare people who are not very familiar with open 
source. They believe GPL and Open Source are synonyms which obviously 
isn't true. Unfortunately this is what most people (outside the open 
source community) i have spoken to on the subject seem to think.

best regards



Robert Cummings wrote:

On Fri, 2003-10-03 at 07:58, Jay Blanchard wrote:
 

[snip]
   

I think Jay probably understands, but for those who don't, 
http://www.gnu.org/philosophy/free-sw.html
   

Quite frankly i don't mind people using anything that i open source in 
commercial applications. When i do mind i don't release it as open 
source :-)
[/snip]

***applause*** Well said!

(I wanted to say other stuff here, but I just couldn't say it well this
morning. I will say that there is no shame in profiting from commercial
use projects).
   

Perhaps I've been a little misunderstood. I love the whole open source
movement, I love that code can be shared, and I was happy to release my
own code as open source. I only have issues with the GPL, and licenses
like it, that seem to me to cause the developer to relinquish all
control of their work.
Cheers,
Rob.
 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/  |  http://www.raditha/megaupload/
Lean and mean Secure FTP applet with  |  Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB  |  with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Round a number

2003-10-03 Thread Shaun
Hi,

I have a query that returns a number from  culculation in my table. It
returns say 4.00, 8.75, 0.00, 12.50 etc. How format the number so that the
trailing zeros aer removed i.e. 4, 8.75, 0, 12.5 etc?

Thanks for your help

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



Re: [PHP] Round a number

2003-10-03 Thread Marek Kilimajer
echo (iny)$number;

Shaun wrote:

Hi,

I have a query that returns a number from  culculation in my table. It
returns say 4.00, 8.75, 0.00, 12.50 etc. How format the number so that the
trailing zeros aer removed i.e. 4, 8.75, 0, 12.5 etc?
Thanks for your help

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


Re: [PHP] PHP coders spare time [OT}

2003-10-03 Thread Curt Zirzow
* Thus wrote Chris Shiflett ([EMAIL PROTECTED]):
> --- Curt Zirzow <[EMAIL PROTECTED]> wrote:
> > http://zirzow.dyndns.org/html/mlists/php_general/
> 
> There's also this:
> 
> http://www.zend.com/cgi-bin/m_stats.pl?list=php-general&date=200309
> 
> What would be really interesting is to see a page like yours that offers
> statistics for "all time" in addition to specific months. I'd like to know how
> many posts John Holmes has had, for example. :-)
> 

Something like this:
  http://zirzow.dyndns.org/html/mlists/php_general/

I had to build some cache tables, grouping 141852 records on the
fly just wasn't fast enough, excpecially  for my 233.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] NEW: XML Application Objects

2003-10-03 Thread Raditha Dissanayake
Hi Terence,

I am equally puzzled as to why people are using all sorts of crappy 
proprietory template systems instead of XSLT. It's particularly useful 
when dealing with WAP. I suspect the reason could well be the 
inconsistencies in compiling php with XSLT support. compiling the 
Sablatron module for perl on the other hand is a breeze and over the 
last year or so whenever i did anything with xslt it's always been with 
perl.

Can i contribute to your project?



Terence wrote:

I've just released the first distribution for an open-source project 
called XML Application Objects (XAO). It's the result of working with 
XML/XSLT in PHP for a couple of years now. Although this is an alpha 
release, the concept itself has gone through a lot of refinement and 
is now ready for prime time.

The publication of the project itself was partially motivated by the 
discussions that took place in this thread (A Complete List of PHP 
Template Engines?) which basically sees me arguing for the usage of 
standards (XSLT) rather than having to learn a proprietary new 
templating system every time you work on someone elses PHP app.

This project is the result of much blood, sweat, and tears so I hope 
someone out there finds it useful. I have made documentation a 
paramount considderation for the XAO API because I'm keen for it to be 
another PHP success story. The website has a tonne of information so 
I'm not gonna try and promote XAO in this message.

Please check it out...

http://xao-php.sourceforge.net/

cheers.



--
Raditha Dissanayake.

http://www.radinks.com/sftp/  |  http://www.raditha/megaupload/
Lean and mean Secure FTP applet with  |  Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB  |  with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] NEW: XML Application Objects

2003-10-03 Thread Raditha Dissanayake
Hi,

Please give it a shot, it's real easy. far easier than any of the lame 
php template systems i have seen. The beauty is that the same XML/XSL 
combo can be used with PHP, perl, JSP/Servlets, C++, VC++,VB,C,C# and 
the list goes on and on.

Disclaimer: I have never written a single line of VB ,VC++  or C# code 
and don't intend to do so in the future.

Robert Cummings wrote:

On Fri, 2003-10-03 at 07:21, Terence wrote:
 

The publication of the project itself was partially motivated by the 
discussions that took place in this thread (A Complete List of PHP 
Template Engines?) which basically sees me arguing for the usage of 
standards (XSLT) rather than having to learn a proprietary new 
templating system every time you work on someone elses PHP app.

   

XSLT is itself yet another language to learn. Albeit a standard, it is
much heavier than using simple XML tags or macros with PHP code.
personally I never cared much for XSLT, but I imagine that goes back to
my not liking LISP either -- which is a case of not liking functional
languages versus procedural languages.
Cheers,
Rob.
 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/  |  http://www.raditha/megaupload/
Lean and mean Secure FTP applet with  |  Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB  |  with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP coders spare time [OT}

2003-10-03 Thread Robert Cummings
On Fri, 2003-10-03 at 11:25, Curt Zirzow wrote:
> * Thus wrote Chris Shiflett ([EMAIL PROTECTED]):
> > --- Curt Zirzow <[EMAIL PROTECTED]> wrote:
> > > http://zirzow.dyndns.org/html/mlists/php_general/
> > 
> > There's also this:
> > 
> > http://www.zend.com/cgi-bin/m_stats.pl?list=php-general&date=200309
> > 
> > What would be really interesting is to see a page like yours that offers
> > statistics for "all time" in addition to specific months. I'd like to know how
> > many posts John Holmes has had, for example. :-)
> > 
> 
> Something like this:
>   http://zirzow.dyndns.org/html/mlists/php_general/
> 
> I had to build some cache tables, grouping 141852 records on the
> fly just wasn't fast enough, excpecially  for my 233.

Woohoo, I go thte top 3 ^robert positions 8) This is really cool, I like
how you can browse the statistics for a poster and see the break down of
when and how often they posted.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] PHP coders spare time [OT}

2003-10-03 Thread Chris Shiflett
--- Curt Zirzow <[EMAIL PROTECTED]> wrote:
> Something like this:
>   http://zirzow.dyndns.org/html/mlists/php_general/
> 
> I had to build some cache tables, grouping 141852 records on the
> fly just wasn't fast enough, excpecially for my 233.

Very nice, and yes, home-grown caching is a wonderful art. :-)

You should show off your source code. We might all learn something.

Chris

=
My Blog
 http://shiflett.org/
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

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



Re: [PHP] NEW: XML Application Objects

2003-10-03 Thread Robert Cummings
On Fri, 2003-10-03 at 11:30, Raditha Dissanayake wrote:
> Hi,
> 
> Please give it a shot, it's real easy. far easier than any of the lame 
> php template systems i have seen. The beauty is that the same XML/XSL 
> combo can be used with PHP, perl, JSP/Servlets, C++, VC++,VB,C,C# and 
> the list goes on and on.
> 
> Disclaimer: I have never written a single line of VB ,VC++  or C# code 
> and don't intend to do so in the future.

I have used XSLT before and can't say I particularly liked it. I have my
own "lame" (as you put it ;) php templating system which I prefer much
more. Mind you, in all honesty, XSLT support can be plugged into my
templating engine if I wanted without any adaptation to the engine
itself.

Cheers,
Rob.

> 
> 
> Robert Cummings wrote:
> 
> >On Fri, 2003-10-03 at 07:21, Terence wrote:
> >  
> >
> >>The publication of the project itself was partially motivated by the 
> >>discussions that took place in this thread (A Complete List of PHP 
> >>Template Engines?) which basically sees me arguing for the usage of 
> >>standards (XSLT) rather than having to learn a proprietary new 
> >>templating system every time you work on someone elses PHP app.
> >>
> >>
> >>
> >
> >XSLT is itself yet another language to learn. Albeit a standard, it is
> >much heavier than using simple XML tags or macros with PHP code.
> >personally I never cared much for XSLT, but I imagine that goes back to
> >my not liking LISP either -- which is a case of not liking functional
> >languages versus procedural languages.
> >
> >Cheers,
> >Rob.
> >  
> >
> 
> 
> -- 
> Raditha Dissanayake.
> 
> http://www.radinks.com/sftp/  |  http://www.raditha/megaupload/
> Lean and mean Secure FTP applet with  |  Mega Upload - PHP file uploader
> Graphical User Inteface. Just 150 KB  |  with progress bar.
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] set the PHP to look at library files.

2003-10-03 Thread Golawala, Moiz M (IndSys, GE Interlogix)
Hi, 

I am running PHP with apache. I put all my webpages in the htdocs folder. A lot of my 
scripts use a bunch of open source libraries. Until now I have been including these 
libraries in my scripts by defining a full path to the library 'inc' files. If I put 
the library itself in my htdocs folder I can see it. However, I want to simply include 
the library by saying:

include ("xmlrpc.inc");

I don't want to put the absolute path in the include statement nor do I want to have 
the xmlrpc.inc file in the same directory as the script that needs it. Is there a some 
configuration setting in the php.ini file that I can set so that It always points to 
some path to look for the include files (It would be nice if the any thing below that 
path is also seen if I set the path. So if i set the path in the configuration to see 
/usr/home/ , even if i put something under /usr/home/install/.. I will be able to pick 
it up.) Thank in advance for any help.

Moiz

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



[PHP] Cookies Vs Sessions...?

2003-10-03 Thread Tristan . Pretty
Age old question...?
Please don't flame if it is

I currently remember my visitors on my site by setting a cookie thusly:

setcookie("logged", "yes");

On each protected page, put an IF ($logged == "yes") { //show page etc } 
else {//show login form etc }

All good, works fine hooray for me...
BUT...

I'm aware that a slight increase in a users browsers security setting, and 
this doesn't work...
So... I've started to learn. sessions.

I have a few questions, that my texts books seem to pussy foot around, and 
I get no answer...
1. Can sessions work in the same way as my cookies? (Just remember a value 
to a variable, accross many page)
2. can seesions be set up to work accross browser sessions? (If I close my 
browser, will they work when I open a new one?)
3. I've seen on many web sites a 'remember me' checkbox. I'd love to learn 
how to do that, is that session related? what's the step in teh right 
direction to remembering that?

Any advise, or first rate turtorials are welcome...
Cheers,
Tris

*
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***



Re: [PHP] set the PHP to look at library files.

2003-10-03 Thread J Morton
I would suggest creating a path alias in your Apache httpd.conf file to recognize 
(i.e) /includes/ and redirect as needed.
Justin

"Golawala, Moiz M (IndSys, GE Interlogix)" wrote:

> Hi,
>
> I am running PHP with apache. I put all my webpages in the htdocs folder. A lot of 
> my scripts use a bunch of open source libraries. Until now I have been including 
> these libraries in my scripts by defining a full path to the library 'inc' files. If 
> I put the library itself in my htdocs folder I can see it. However, I want to simply 
> include the library by saying:
>
> include ("xmlrpc.inc");
>
> I don't want to put the absolute path in the include statement nor do I want to have 
> the xmlrpc.inc file in the same directory as the script that needs it. Is there a 
> some configuration setting in the php.ini file that I can set so that It always 
> points to some path to look for the include files (It would be nice if the any thing 
> below that path is also seen if I set the path. So if i set the path in the 
> configuration to see /usr/home/ , even if i put something under /usr/home/install/.. 
> I will be able to pick it up.) Thank in advance for any help.
>
> Moiz
>
> --
> 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] Cookies Vs Sessions...?

2003-10-03 Thread Robert Cummings
On Fri, 2003-10-03 at 11:31, [EMAIL PROTECTED] wrote:
> Age old question...?
> Please don't flame if it is
> 
> I currently remember my visitors on my site by setting a cookie thusly:
> 
> setcookie("logged", "yes");
> 
> On each protected page, put an IF ($logged == "yes") { //show page etc } 
> else {//show login form etc }
> 
> All good, works fine hooray for me...
> BUT...
> 
> I'm aware that a slight increase in a users browsers security setting, and 
> this doesn't work...
> So... I've started to learn. sessions.
> 
> I have a few questions, that my texts books seem to pussy foot around, and 
> I get no answer...
> 1. Can sessions work in the same way as my cookies? (Just remember a value 
> to a variable, accross many page)

Yes.

> 2. can seesions be set up to work accross browser sessions? (If I close my 
> browser, will they work when I open a new one?)

No, you need permanent cookies for this.

> 3. I've seen on many web sites a 'remember me' checkbox. I'd love to learn 
> how to do that, is that session related? what's the step in teh right 
> direction to remembering that?

Permanent cookie.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] set the PHP to look at library files.

2003-10-03 Thread Robert Cummings
See the "include_path" setting in your php.ini file.

Cheers,
Rob.


On Fri, 2003-10-03 at 11:35, Golawala, Moiz M (IndSys, GE Interlogix)
wrote:
> Hi, 
> 
> I am running PHP with apache. I put all my webpages in the htdocs folder. A lot of 
> my scripts use a bunch of open source libraries. Until now I have been including 
> these libraries in my scripts by defining a full path to the library 'inc' files. If 
> I put the library itself in my htdocs folder I can see it. However, I want to simply 
> include the library by saying:
> 
> include ("xmlrpc.inc");
> 
> I don't want to put the absolute path in the include statement nor do I want to have 
> the xmlrpc.inc file in the same directory as the script that needs it. Is there a 
> some configuration setting in the php.ini file that I can set so that It always 
> points to some path to look for the include files (It would be nice if the any thing 
> below that path is also seen if I set the path. So if i set the path in the 
> configuration to see /usr/home/ , even if i put something under /usr/home/install/.. 
> I will be able to pick it up.) Thank in advance for any help.
> 
> Moiz
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Cookies Vs Sessions...?

2003-10-03 Thread Eugene Lee
On Fri, Oct 03, 2003 at 04:31:23PM +0100, [EMAIL PROTECTED] wrote:
: 
: I currently remember my visitors on my site by setting a cookie thusly:
: 
: setcookie("logged", "yes");
: 
: On each protected page, put an IF ($logged == "yes") { //show page etc } 
: else {//show login form etc }

You should use $_COOKIE['logged'] instead.  :-)

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



Re: [PHP] Cookies Vs Sessions...?

2003-10-03 Thread Chris Shiflett
--- [EMAIL PROTECTED] wrote:
> 1. Can sessions work in the same way as my cookies? (Just remember
> a value to a variable, accross many page)

Yes, they address the same challenge: persisting data.

Also, please realize that sessions can use cookies for identification. One of
the benefits of using sessions is that the session data is stored on the
server. This has some security benefits.

> 2. can seesions be set up to work accross browser sessions? (If I
> close my browser, will they work when I open a new one?)

Yes, however, this won't necessarily be automatic for you. As long as the
client identifies itself (via persistent cookie or URL variable) on the next
visit, and the session itself has not expired, you will resume the session.

> 3. I've seen on many web sites a 'remember me' checkbox. I'd love to
> learn how to do that, is that session related?

Yes, but it is usually more related to cookies. Many of these sites only set a
persistent cookie if you check this box, otherwise requiring you to login again
if you close your browser. What exactly is in this cookie depends on the site;
some sites may only store your username (so you still have to type in your
password again), while others store your session identifier (and hopefully some
information to deter impersonation), so that your session is automatically
resumed when you revisit.

For a general overview of cookies, you can read this free chapter:

http://shiflett.org/books/http-developers-handbook/chapters/11

Hope that helps.

Chris

=
My Blog
 http://shiflett.org/
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

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



Re: [PHP] Cookies Vs Sessions...?

2003-10-03 Thread Chris Shiflett
--- Eugene Lee <[EMAIL PROTECTED]> wrote:
> > setcookie("logged", "yes");
> > 
> > On each protected page, put an IF ($logged == "yes") { //show page etc } 
> > else {//show login form etc }
> 
> You should use $_COOKIE['logged'] instead.  :-)

While we're talking about "should", you should also never trust what the client
sends, including cookies. :-)

Chris

=
My Blog
 http://shiflett.org/
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

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



[PHP] PHP and .HTACCESS

2003-10-03 Thread James D. Stallings

I am new to learning PHP and have learned a lot over the last few weeks.  One 
thing that I can not find anywhere is how to code it so a user can click logoff 
and have it route them to another page and remove their authentication that was 
set.

ie... I user goes to www.mysite.com and clicks on a link called STAFF 
The STAFF.mysite.com is protected with authentication using .htaccess
The staff enters their ID and Password and is allowed in.
I want to have a button that says LOGOFFF that will remove the authentication 
I know how to do the header(location... to route them back to another page, but 
I have not been able to remove the authentication so it will ask them for their 
password again when they return to staff.mysite.com

I have even tried:

header('WWW-Authenticate: Negotiate');
header('WWW-Authenticate: NTLM', FALSE);

but no go...

Thanks in advance!!

Jim

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



Re: [PHP] PHP and .HTACCESS

2003-10-03 Thread Chris Shiflett
--- "James D. Stallings" <[EMAIL PROTECTED]> wrote:
> I user goes to www.mysite.com and clicks on a link called STAFF 
> The STAFF.mysite.com is protected with authentication using
> .htaccess The staff enters their ID and Password and is allowed in.
> I want to have a button that says LOGOFFF that will remove the
> authentication

HTTP authentication is not a very good tool for implementing sophisticated
access control. Though it is possible to simulate a log out, it is not very
straightforward (some would call it a hack), because there is no mechanism for
the server to instruct the browser to forget the authentication credentials.

So, I recommend using PHP sessions instead.

However, if you really want/need to use HTTP authentication, you can read this
page to get some other users' suggestions:

http://www.php.net/features.http-auth

Hope that helps.

Chris

=
My Blog
 http://shiflett.org/
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

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



Re: [PHP] PHP and .HTACCESS

2003-10-03 Thread Marek Kilimajer
it is virtualy impossible to make the browser forget the credentials.

How this is solved is that the logoff link is
login.php?logoff=username
In login.php you check for $_GET['logoff'] variable, if it is set you 
will not let the user with the same name ($_GET['logoff']) log in.

James D. Stallings wrote:

I am new to learning PHP and have learned a lot over the last few weeks.  One 
thing that I can not find anywhere is how to code it so a user can click logoff 
and have it route them to another page and remove their authentication that was 
set.

ie... I user goes to www.mysite.com and clicks on a link called STAFF 
The STAFF.mysite.com is protected with authentication using .htaccess
The staff enters their ID and Password and is allowed in.
I want to have a button that says LOGOFFF that will remove the authentication 
I know how to do the header(location... to route them back to another page, but 
I have not been able to remove the authentication so it will ask them for their 
password again when they return to staff.mysite.com

I have even tried:

header('WWW-Authenticate: Negotiate');
header('WWW-Authenticate: NTLM', FALSE);
but no go...

Thanks in advance!!

Jim

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


Re: [PHP] PHP Session not working

2003-10-03 Thread Php2tor
Maybe enable track_vars in php.ini ?

"Jay Blanchard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
[snip]
We are facing some problems in using sessions in our applications.
Recently
we have moved our web site to a new Apache server (1.3). We have
installed
PHP on this server. But sessions are not working on this server. The
values
in the session variables are not carried forward to the consequent
pages.
PHP Module entry in httpd.conf file: LoadModule php4_module
modules/mod_php4-4.3.2.so

The same scripts & web site are working fine on a similar Apache server
and
same version of PHP.
[/snip]

*sigh* Check register_globals in your php.ini. It is probably off (by
default). Please change it to 'on' and restart your web server. Then
make sure all of your code is tightly written so as to prevent possible
harm.

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



[PHP] str_word_count Broken?

2003-10-03 Thread Steven Walker
I ran into a strange problem this morning. Suddenly I am getting an 
error that str_word_count is undefined, even though it has been working 
for the past few months. Anyone know why this may be? Nothing in the my 
code has changed at all.

I did phpinfo() to check the server and it is running 4.2.2. I have a 
workaround for the time being, but it is very strange.

Steven J. Walker
Walker Effects
www.walkereffects.com
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Committing OO Sin

2003-10-03 Thread Gerard Samuel
Jay Blanchard wrote:

Global space? Yes, what you're talking about, if possible, is a sin. 

Why is getting the classes to work together a pain?

A little misleading about what Im feeling.
Im feeling that the more classes that I add the more cumbersome things get,
and at the rate Im going, I get the feeling my code will self destruct 
(figure of speech).
For example.  I have another class that handles comments.
This class currently takes the smarty class by reference, which contains 
the DB class by reference.
If I were to convert the user management file to a class,
then the comments class will also have to contain the user management 
class which contains,
a reference to the DB class.
The whole class paradim, just gets uglier and uglier in my case.
I have to stop and rethink about how to make classes work together better.
Robert Cummings made a suggestion to me in an earlier topic about 
singleton patterns,
and again, in this topic about frameworks (basically a design pattern 
from what I've been reading so far this past week).
Im just not sure how to proceed, and the thought occured to me to use 
$GLOBALS like
$GLOBALS['db']->Execute('some sql');
$GLOBALS['smarty']->fetch('that template');

Im going to have to invest in a book on frameworks (design patterns), as 
I can't see myself continuing down
the road Im presently on.

Im open to any suggestions on books.  Im currently reading up on 
articles at phppatterns.com, hopefully some of it
will sink in.

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


Re: [PHP] PHP and .HTACCESS

2003-10-03 Thread Sid
If I've got my basics right, the auth user and pass will be sent by the
browser. You will need a way to tell the browser not to send the user and
pass anymore.

- Sid

- Original Message -
From: "James D. Stallings" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 3 October 2003 Friday 9:04 AM
Subject: [PHP] PHP and .HTACCESS


>
> I am new to learning PHP and have learned a lot over the last few weeks.
One
> thing that I can not find anywhere is how to code it so a user can click
logoff
> and have it route them to another page and remove their authentication
that was
> set.
>
> ie... I user goes to www.mysite.com and clicks on a link called STAFF
> The STAFF.mysite.com is protected with authentication using .htaccess
> The staff enters their ID and Password and is allowed in.
> I want to have a button that says LOGOFFF that will remove the
authentication
> I know how to do the header(location... to route them back to another
page, but
> I have not been able to remove the authentication so it will ask them for
their
> password again when they return to staff.mysite.com
>
> I have even tried:
>
> header('WWW-Authenticate: Negotiate');
> header('WWW-Authenticate: NTLM', FALSE);
>
> but no go...
>
> Thanks in advance!!
>
> Jim
>
> --
> 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] NEW: XML Application Objects

2003-10-03 Thread Raditha Dissanayake
The ones I tried were lame. Haven't studied your engine yet so i have 
yet to decide whether it's lame or not ;-)

best regards

Robert Cummings wrote:

On Fri, 2003-10-03 at 11:30, Raditha Dissanayake wrote:
 

Hi,

Please give it a shot, it's real easy. far easier than any of the lame 
php template systems i have seen. The beauty is that the same XML/XSL 
combo can be used with PHP, perl, JSP/Servlets, C++, VC++,VB,C,C# and 
the list goes on and on.

Disclaimer: I have never written a single line of VB ,VC++  or C# code 
and don't intend to do so in the future.
   

I have used XSLT before and can't say I particularly liked it. I have my
own "lame" (as you put it ;) php templating system which I prefer much
more. Mind you, in all honesty, XSLT support can be plugged into my
templating engine if I wanted without any adaptation to the engine
itself.
Cheers,
Rob.
 

Robert Cummings wrote:

   

On Fri, 2003-10-03 at 07:21, Terence wrote:

 

The publication of the project itself was partially motivated by the 
discussions that took place in this thread (A Complete List of PHP 
Template Engines?) which basically sees me arguing for the usage of 
standards (XSLT) rather than having to learn a proprietary new 
templating system every time you work on someone elses PHP app.

  

   

XSLT is itself yet another language to learn. Albeit a standard, it is
much heavier than using simple XML tags or macros with PHP code.
personally I never cared much for XSLT, but I imagine that goes back to
my not liking LISP either -- which is a case of not liking functional
languages versus procedural languages.
Cheers,
Rob.
 

--
Raditha Dissanayake.

http://www.radinks.com/sftp/  |  http://www.raditha/megaupload/
Lean and mean Secure FTP applet with  |  Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB  |  with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] str_word_count Broken?

2003-10-03 Thread Marek Kilimajer
str_word_count is available since version 4.3. Check your setup, someone 
restarted webserver with wrong config directory specified.

Steven Walker wrote:
I ran into a strange problem this morning. Suddenly I am getting an 
error that str_word_count is undefined, even though it has been working 
for the past few months. Anyone know why this may be? Nothing in the my 
code has changed at all.

I did phpinfo() to check the server and it is running 4.2.2. I have a 
workaround for the time being, but it is very strange.

Steven J. Walker
Walker Effects
www.walkereffects.com
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Committing OO Sin

2003-10-03 Thread Robert Cummings
On Fri, 2003-10-03 at 12:40, Gerard Samuel wrote:
> Jay Blanchard wrote:
> 
> >Global space? Yes, what you're talking about, if possible, is a sin. 
> >
> >Why is getting the classes to work together a pain?
> >
> A little misleading about what Im feeling.
> Im feeling that the more classes that I add the more cumbersome things get,
> and at the rate Im going, I get the feeling my code will self destruct 
> (figure of speech).
> For example.  I have another class that handles comments.
> This class currently takes the smarty class by reference, which contains 
> the DB class by reference.
> If I were to convert the user management file to a class,
> then the comments class will also have to contain the user management 
> class which contains,
> a reference to the DB class.
> The whole class paradim, just gets uglier and uglier in my case.
> I have to stop and rethink about how to make classes work together better.
> Robert Cummings made a suggestion to me in an earlier topic about 
> singleton patterns,
> and again, in this topic about frameworks (basically a design pattern 
> from what I've been reading so far this past week).
> Im just not sure how to proceed, and the thought occured to me to use 
> $GLOBALS like
> $GLOBALS['db']->Execute('some sql');
> $GLOBALS['smarty']->fetch('that template');
> 
> Im going to have to invest in a book on frameworks (design patterns), as 
> I can't see myself continuing down
> the road Im presently on.
> 
> Im open to any suggestions on books.  Im currently reading up on 
> articles at phppatterns.com, hopefully some of it
> will sink in.

I don't know of any good books for patterns. much of what I know I
learned in university and from experience. But to take your problem and
perhaps give you a window on how you can organize things I will try to
lay out a possible plan.

Known classes:

- User manager (um)
- db connection (dbc)
- smarty (smarty)
- comments (comments)

Relationships:

- um uses smarty, dbc
- smarty uses dbc
- comments uses um

Proposal:

- middle man (mm) it's almost imperative to have a middle man
  class that can return necessary instances of object (whether
  it be multiple instances or a singleton). In InterJinn this
  middle man class is the dynamic loader.

- database manager (dbm) to return database connections. This
  could be a pooling mechanism for a given connection so that
  you only ever return one connection. This has a problem
  though if you wish to do a query based on the results of
  another query without storing all the data from the first
  query. There really isn't much difference in processing time
  when using a pool and when returning a new connection.
  InterJinn uses a pool for the default MySQL database layer,
  but not for the Pear DB database layer. Pear DB may use
  its own pool, but that's not for the user of the class to
  care about (black box coding).

- dbc is a single connection, whether it be pooled or not. The
  only guarantee you should have is that it won't interfere with
  another query (if pooled then the dbm should only return the
  same connection if it has been freed.

- um should be a factory, you give it a userId, or name
  and it returns a user object which the appropriate methods to
  retrieve/store user information.

- user object (user). Singleton for a given user (don't want to
  update multiple copies of a single user object). The um can pool
  user objects according to user Id and return references when
  requested.

- I'm not sure why smarty has a reference to a database
  connection in your code (though I'm not greatly familiar with
  Smarty since I've only used it in conjunction with other
  people's code that was already using it). At any rate, unless
  you are extending the smarty class, then you should give it
  it's own database connection to use. if you wanted you could
  always create a smarty manager layer to retrieve smarty objects,
  but this probably isn't necessary for your own work.

- the connection object isn't used by anything, so it should just
  be a regular object.

For simplicity I'm going to assume I made all my management objects part
of the middle man class with a very simple interface:

lets say I have code that needs to display user stats, comments, and via
a smarty template. I might have the following:

getUser( $userId );

$comment = new Comment();
//
// Not sure what the purpose of comments are, so I'll just skip
// details.
//

$template = new Smarty();

$template->assign( 'USER_NAME',$user->getName() );
$template->assign( 'USER_ADDRESS', $user->getAddress() );
$template->assign( 'COMMENTS', $comment->getText( $userId ) );

$template->display( 'someTemplate.tpl' );

---
That's the bulk of the main page, now inside $mm->getUser()
-

Re: [PHP] PHP coders spare time [OT}

2003-10-03 Thread CPT John W. Holmes
From: "Curt Zirzow" <[EMAIL PROTECTED]>

> Something like this:
>   http://zirzow.dyndns.org/html/mlists/php_general/
> 
> I had to build some cache tables, grouping 141852 records on the
> fly just wasn't fast enough, excpecially  for my 233.

Looks good to me. :)

I also have 8 posts under [EMAIL PROTECTED], for the record. :D

---John Holmes...

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



Re: [PHP] Dates

2003-10-03 Thread Payne
Ok, Mayve I need to be a little clear, I under the link below as showing 
dates. What I need to know how can I take the input of 09-12-1967 and 
have enter into a mysql data using php as 1967-09-12?  Because 
everything that is past from my form to mysql is not the way it was 
enter. Would I need to create three fields month, day, year, then take 
those three into -mm-dd? If so how?

Chuck

Jay Blanchard wrote:

[snip]
This might be mysql question but how can I change a US format date 
(mm/dd/) to a MySQL Format (/mm/dd).  Can I do this will php or 
will need let say javascript or perl to do this?
[/snip]

date("y/m/d");

RTFM at http://www.php.net/date

 

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


[PHP] PHP as a Servlet in Tomcat

2003-10-03 Thread David Erickson
Hi I am wondering if anybody has successfully been able to run PHP in a
servlet only environment?  I am trying to setup php to run as a servlet
within tomcat on my win2k box and am having encredible difficulties.. here
are the specs and the problem.  Any suggestiongs extremely appreciated:

Jakarta Tomcat 4.1.24
JDK 1.4.1_03
PHP 4.3.4RC1 Win32 (tried 4.3.3 as well same problem)
Win2k

I followed the instructions to a T on installing php for servlet.. IE put
the phpsrvlt.jar file in the lib dir in tomcat, php4ts.dll in the
winnt\system32, php.ini in winnt with extensions_dir variable properly set,
and all extensions commented out.   If I uncomment the php_java.dll I get
warning messages when I try to hit a php file that say "Warning Function
registration failed - duplicate name - java_last_exception_clear" along with
a couple more.

After i clear those message windows this is what I get from tomcat the first
time I try to hit a test.php file:

HTTP Status 500 -



type Exception report
message
description The server encountered an internal error () that prevented it
from fulfilling this request.
exception
java.io.IOException: null
 at net.php.servlet.send(Native Method)
 at net.php.servlet.service(servlet.java:190)
 at net.php.servlet.service(servlet.java:214)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)

Then if I try and refresh to hit it again tomcat completely dies and it
crashes my jvm.
Here is the log trace:


An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0xC6536CA
Function=zend_hash_add_or_update+0x9A
Library=C:\WINNT\system32\php4ts.dll

Current Java thread:
 at net.php.servlet.send(Native Method)
 at net.php.servlet.service(servlet.java:190)
 at net.php.servlet.service(servlet.java:214)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
 at
cmcflex.salesweb.control.SecurityFilter.doFilter(SecurityFilter.java:110)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:213)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
 at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:256)
 at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
 at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
 at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
 at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
 at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
46)
 at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
 at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
 at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
 at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
 at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
 at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:171)
 at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
 at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
)
 at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
 at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
 at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
 at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
 at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
 at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
 at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
 at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:392)
 at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEn

RE: [PHP] Dates

2003-10-03 Thread Jay Blanchard
[snip]
Ok, Mayve I need to be a little clear, I under the link below as showing

dates. What I need to know how can I take the input of 09-12-1967 and 
have enter into a mysql data using php as 1967-09-12?  Because 
everything that is past from my form to mysql is not the way it was 
enter. Would I need to create three fields month, day, year, then take 
those three into -mm-dd? If so how?
[/snip]

Aha.

$theOldDate = 09-12-1967;
$theNewDate = substr($theOldDate, 6, 4)."-".substr($theOldDate, 0,
2)."-".substr($theOldDate, 3, 2);
echo $theNewDate;

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



RE: [PHP] PHP coders spare time [OT}

2003-10-03 Thread Chris W. Parker
Curt Zirzow 
on Friday, October 03, 2003 8:26 AM said:

> Something like this:
>   http://zirzow.dyndns.org/html/mlists/php_general/

Cool page!


But if you would do us all a favor and give your pages some useful
's, because you know, EVERY PAGE IS CALLED "PHP DEVELOPMENT",
that'd be great, thaaannnkkss.


c.

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



RE: [PHP] PHP Editor

2003-10-03 Thread Chris W. Parker
Nico Berg 
on Friday, October 03, 2003 12:38 AM said:

> Hi, I have found the solution to my problem, I share it
> http://phpeditors.linuxbackup.co.uk/

OOH! OOH! OOH! This should be added to the weekly PHP Newbie post!!!



chris.

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



Re: [PHP] Dates

2003-10-03 Thread Kris Yates
Also, an option is to have that SQL field set as date.  With postgres, I 
can insert 09-12-1967 and the sql server auto converts it to 1967-09-12 
upon saving into date field.  However, another way is..


Jay Blanchard wrote:

[snip]
Ok, Mayve I need to be a little clear, I under the link below as showing
dates. What I need to know how can I take the input of 09-12-1967 and 
have enter into a mysql data using php as 1967-09-12?  Because 
everything that is past from my form to mysql is not the way it was 
enter. Would I need to create three fields month, day, year, then take 
those three into -mm-dd? If so how?
[/snip]

Aha.

$theOldDate = 09-12-1967;
$theNewDate = substr($theOldDate, 6, 4)."-".substr($theOldDate, 0,
2)."-".substr($theOldDate, 3, 2);
echo $theNewDate;
 

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


[PHP] dir size

2003-10-03 Thread Ms Carlsson
is it possible to count  a size of a dir and all sub dirs in php ? and if, 
how?

thanx

_
Lättare att hitta drömresan med MSN Resor http://www.msn.se/resor/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] dir size

2003-10-03 Thread Jay Blanchard
[snip]
is it possible to count  a size of a dir and all sub dirs in php ? and
if, 
how?
[/snip]

$foo = exec("du -h");

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



Re: [PHP] PHP as a Servlet in Tomcat

2003-10-03 Thread Ray Hunter
Try running php is from a servlet environment.  Basically in tomcat you
set up a servlet that handles your *.php files and calls the php
executable.  This is like php cgi so it can be slow.

--
BigDog


On Fri, 2003-10-03 at 12:11, David Erickson wrote:
> Hi I am wondering if anybody has successfully been able to run PHP in a
> servlet only environment?  I am trying to setup php to run as a servlet
> within tomcat on my win2k box and am having encredible difficulties.. here
> are the specs and the problem.  Any suggestiongs extremely appreciated:
> 
> Jakarta Tomcat 4.1.24
> JDK 1.4.1_03
> PHP 4.3.4RC1 Win32 (tried 4.3.3 as well same problem)
> Win2k
> 
> I followed the instructions to a T on installing php for servlet.. IE put
> the phpsrvlt.jar file in the lib dir in tomcat, php4ts.dll in the
> winnt\system32, php.ini in winnt with extensions_dir variable properly set,
> and all extensions commented out.   If I uncomment the php_java.dll I get
> warning messages when I try to hit a php file that say "Warning Function
> registration failed - duplicate name - java_last_exception_clear" along with
> a couple more.
> 
> After i clear those message windows this is what I get from tomcat the first
> time I try to hit a test.php file:
> 
> HTTP Status 500 -
> 
> 
> 
> type Exception report
> message
> description The server encountered an internal error () that prevented it
> from fulfilling this request.
> exception
> java.io.IOException: null
>  at net.php.servlet.send(Native Method)
>  at net.php.servlet.service(servlet.java:190)
>  at net.php.servlet.service(servlet.java:214)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>  at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:247)
>  at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:193)
> 
> Then if I try and refresh to hit it again tomcat completely dies and it
> crashes my jvm.
> Here is the log trace:
> 
> 
> An unexpected exception has been detected in native code outside the VM.
> Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0xC6536CA
> Function=zend_hash_add_or_update+0x9A
> Library=C:\WINNT\system32\php4ts.dll
> 
> Current Java thread:
>  at net.php.servlet.send(Native Method)
>  at net.php.servlet.service(servlet.java:190)
>  at net.php.servlet.service(servlet.java:214)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>  at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:247)
>  at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:193)
>  at
> cmcflex.salesweb.control.SecurityFilter.doFilter(SecurityFilter.java:110)
>  at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:213)
>  at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:193)
>  at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
> va:256)
>  at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(StandardPipeline.java:643)
>  at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
>  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>  at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
> va:191)
>  at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(StandardPipeline.java:643)
>  at
> org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
> 46)
>  at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(StandardPipeline.java:641)
>  at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
>  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>  at
> org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
>  at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
> )
>  at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(StandardPipeline.java:643)
>  at
> org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
> java:171)
>  at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(StandardPipeline.java:641)
>  at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
> )
>  at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
> nvokeNext(StandardPipeline.java:641)
>  at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
>  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>  at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
> :174)
>  at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(StandardPi

RE: [PHP] dir size

2003-10-03 Thread Robert Cummings
On Fri, 2003-10-03 at 14:45, Jay Blanchard wrote:
> [snip]
> is it possible to count  a size of a dir and all sub dirs in php ? and
> if, 
> how?
> [/snip]
> 
> $foo = exec("du -h");
> 

Hmmm this solution would appear to include the file sizes :D

Rob
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



RE: [PHP] User authentication

2003-10-03 Thread Jeff McKeon


> --- Jeff McKeon <[EMAIL PROTECTED]> wrote:
> > $_SESSION['userid'] = $userid;
> > $_SESSION['userpassword'] = $userpassword;
> 
> [snip]
> 
> > Anything look wrong or insecure with all of this?
> 
> The only thing that catches my attention is your assignments 
> for $_SESSION['userid'] and $_SESSION['userpassword']. I 
> assume you are performing some strict data validation on 
> $userid and $userpassword before this assignment, right? If 
> not, this presents a significant risk, because $_SESSION is a 
> trusted array (it comes from the server, not the client).
> 
> Hope that helps.
> 
> Chris

Well both variables $userid and $userpassword are bounced off of a user
database table, if the username/password don't match then the session
variables are cleared with a  session_destroy() call.  Is that a good
enough validation?

[code begin]

session_start();
if(!isset($userid)) {
login_form();
exit;
}
else {
$_SESSION['userid'] = $userid;
$_SESSION['userpassword'] = $userpassword;
$username = auth_user($userid, $userpassword);
if(!$username) {
echo "user " . $userid . $userpassword . " Authorization
failed. " . 
 "You must enter a valid userid and password
combo. " .
 "Click on the following link to try
again.\n";
echo "login";
echo "If you do not have login, please contact
Operations to obtain one.\n";
session_destroy();
exit;
}
else echo "welcome, $username!";
echo gmmktime();
echo "Continue";
echo "Ticket";
}

function auth_user($userid, $userpassword) {

global $default_dbname, $user_tablename;

$link_id = db_connect($default_dbname);
$query = "SELECT username FROM $user_tablename WHERE userid =
'$userid' && userpassword = password('$userpassword')";
$result = mysql_query($query);
if(!mysql_num_rows($result)) return 0;
else {
$stamp = gmmktime();
$query2 = "update $user_tablename set idle_time = $stamp
where userid = '$userid'";
$result2 = mysql_query($query2);

$query3 = "select CanEdit from $user_tablename where
userid = '$userid'";
$result3 = mysql_query($query3);
$query_data3 = mysql_fetch_row($result3);
$_SESSION['CanEdit'] = $query_data3[0];

$query_data=mysql_fetch_row($result);
return $query_data[0];
}
}

[code end]

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



[PHP] File Download

2003-10-03 Thread Grant Rutherford
Hi there,

I would like to send an arbitrary file to a user.  This file will be on 
the server in the PHP directory.  I will also want to rename it before 
it is sent, but keep the old file with the old filename.

Any help is appreciated...
Thanks,
Grant
--
Grant Rutherford
Iders Incorporated
600A Clifton Street
Winnipeg, MB
R3G 2X6
http://www.iders.ca
tel: 204-779-5400 ext 36
fax: 204-779-5444

Iders Incorporated: Confidential

Note: This message is intended solely for the use of the designated
recipient(s) and their appointed delegates, and may contain
confidential information.  Any unauthorized disclosure, copying or
distribution of its contents is strictly prohibited.  If you have
received this message in error, please destroy it and advise the sender
immediately by phone, Email or facsimile.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] dir size

2003-10-03 Thread Gabriel Guzman
On Friday 03 October 2003 11:48 am, Robert Cummings wrote:
> On Fri, 2003-10-03 at 14:45, Jay Blanchard wrote:
> > [snip]
> > is it possible to count  a size of a dir and all sub dirs in php ? and
> > if,
> > how?
> > [/snip]
> >
> > $foo = exec("du -h");
>
> Hmmm this solution would appear to include the file sizes :D

man du  :D

gabe.

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



[PHP] Re: mail() function, how to get it work?

2003-10-03 Thread Manuel Lemos
Hello,

On 10/03/2003 12:44 PM, Kristian Snabb wrote:
How do I set up the mail() function in php.ini.
How do I define the username and password? My smtp service requires me 
to log on.

I'm using Apache 2.0.47 on WinXP Pro.
There is no way to set SMTP authentication using the mail() function.

You may want to use this class that comes with a wrapper function named 
smtp_mail() that works exactly like the mail() function but lets you 
configure certain SMTP delivery details such as authentication credentials:

http://www.phpclasses.org/mimemessage

You will also need this:

http://www.phpclasses.org/smtpclass

--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] User authentication

2003-10-03 Thread Chris Shiflett
--- Jeff McKeon <[EMAIL PROTECTED]> wrote:
> Well both variables $userid and $userpassword are bounced off of a
> user database table, if the username/password don't match then the
> session variables are cleared with a  session_destroy() call. Is that
> a good enough validation?

Yes, as long as you realize that you have now shifted the trust to those values
in the database. As long as there is no way for a user to inject malicious code
during the registration process (or however the username and password end up in
the database), then that part should be fine.

Hope that helps.

Chris

=
My Blog
 http://shiflett.org/
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

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



Re: [PHP] dir size

2003-10-03 Thread Curt Zirzow
* Thus wrote Ms Carlsson ([EMAIL PROTECTED]):
> is it possible to count  a size of a dir and all sub dirs in php ? and if, 
> how?

Dir size is  rather vague. Are you wanting how many items are in
the dir? or how many bytes is allocated for it? or how many bytes
are actually used in the dir? What is the total sum of all the
files space used inside the dir? and does that include the
sub directories sizes?


Curt
-- 
List Stats: http://zirzow.dyndns.org/html/mlists/php_general/

"I used to think I was indecisive, but now I'm not so sure."

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



[PHP] User Authentication Continued....

2003-10-03 Thread Jeff McKeon
Ok,

I've got the user authentication thing down and now I'm continuing to
build my trouble ticket tracking system.

So from a "customer profile" page there is a link to "Open Ticket" which
brings up a page to open a trouble ticket.  

[html code]
HREF=./open_ticket.php?custid=$custid&custname=$custname
[html code]

The user is validated for permissions and timeout based on the $_SESSION
variables established before the "open ticket"" page is loaded.

I then have a form that they fill in with the minimum info to create a
new ticket.  Some info is passed to the open ticket page from the
customer profile page via a GET method and enterred into hidden form
fields. 

[html code]
HREF=./open_ticket.php?custid=$custid&custname=$custname
[html code]

On the "open ticket" page I have 2 functions, the first is a form for
entering in the ticket info, the second is a function to take the
information and update the database with it when the form is submitted,
then reload the page with a display of the ticket info.

The problem I'm having is with the $_GET variables.  I guess I'm not
declaring them correctly.  Do I need to set them as soon as the page
loads, and outside of any functions like so..

[code start]
$custid = $_GET['custid'];
$custname = $_GET['custname'];
[code end]

Or do I need to declare them in each funtion?

[code start]
Function blah(){
global $custname, $custid;

$custid = $_GET['custid'];
$custname = $_GET['custname'];
DO SOME STUFF
}

Function foo(){
global $custname, $custid;

$custid = $_GET['custid'];
$custname = $_GET['custname'];
DO SOME STUFF
}
[code end]

Or am I way off and there is another way of doing it?

Also I've noticed that when I do an mysql_query("select name from foo
where name='$somevariable'") I cannot use $_GET['somevariable'] or
$_POST['somevariable'] in the sql string, I find I need to do a $name =
$_GET['somevariable'] first and then use $name.  Why is this?

Thanks,

Jeff

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



Re: [PHP] dir size

2003-10-03 Thread Robert Cummings
On Fri, 2003-10-03 at 15:02, Gabriel Guzman wrote:
> On Friday 03 October 2003 11:48 am, Robert Cummings wrote:
> > On Fri, 2003-10-03 at 14:45, Jay Blanchard wrote:
> > > [snip]
> > > is it possible to count  a size of a dir and all sub dirs in php ? and
> > > if,
> > > how?
> > > [/snip]
> > >
> > > $foo = exec("du -h");
> >
> > Hmmm this solution would appear to include the file sizes :D
> 
> man du  :D

I was being facetious.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



RE: [PHP] User authentication

2003-10-03 Thread Jeff McKeon
Yes, I'm the one creating the accounts in the database, users can't
create their own accounts nor do they have permissions to create new
users.

Thanks!

Jeff

> -Original Message-
> From: Chris Shiflett [mailto:[EMAIL PROTECTED] 
> Sent: Friday, October 03, 2003 3:09 PM
> To: Jeff McKeon; php
> Subject: RE: [PHP] User authentication
> 
> 
> --- Jeff McKeon <[EMAIL PROTECTED]> wrote:
> > Well both variables $userid and $userpassword are bounced off of a 
> > user database table, if the username/password don't match then the 
> > session variables are cleared with a  session_destroy() 
> call. Is that 
> > a good enough validation?
> 
> Yes, as long as you realize that you have now shifted the 
> trust to those values in the database. As long as there is no 
> way for a user to inject malicious code during the 
> registration process (or however the username and password 
> end up in the database), then that part should be fine.
> 
> Hope that helps.
> 
> Chris
> 
> =
> My Blog
>  http://shiflett.org/
> HTTP Developer's Handbook
>  http://httphandbook.org/
> RAMP Training Courses
>  http://www.nyphp.org/ramp
> 
> -- 
> 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] dir size

2003-10-03 Thread Jay Blanchard
[snip]
> > > $foo = exec("du -h");
> >
> > Hmmm this solution would appear to include the file sizes :D
> 
> man du  :D

et du?

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



Re: [PHP] User Authentication Continued....

2003-10-03 Thread Kris Yates
I guess you would either need to make the vars global or else keep 
redeclaring them.  Obviously, redeclaring them in each function 
$var=$_GET["whatever"] is technically the more secure method.

Kris

Jeff McKeon wrote:

Ok,

I've got the user authentication thing down and now I'm continuing to
build my trouble ticket tracking system.
So from a "customer profile" page there is a link to "Open Ticket" which
brings up a page to open a trouble ticket.  

[html code]
HREF=./open_ticket.php?custid=$custid&custname=$custname
[html code]
The user is validated for permissions and timeout based on the $_SESSION
variables established before the "open ticket"" page is loaded.
I then have a form that they fill in with the minimum info to create a
new ticket.  Some info is passed to the open ticket page from the
customer profile page via a GET method and enterred into hidden form
fields. 

[html code]
HREF=./open_ticket.php?custid=$custid&custname=$custname
[html code]
On the "open ticket" page I have 2 functions, the first is a form for
entering in the ticket info, the second is a function to take the
information and update the database with it when the form is submitted,
then reload the page with a display of the ticket info.
The problem I'm having is with the $_GET variables.  I guess I'm not
declaring them correctly.  Do I need to set them as soon as the page
loads, and outside of any functions like so..
[code start]
$custid = $_GET['custid'];
$custname = $_GET['custname'];
[code end]
Or do I need to declare them in each funtion?

[code start]
Function blah(){
global $custname, $custid;
$custid = $_GET['custid'];
$custname = $_GET['custname'];
DO SOME STUFF
}
Function foo(){
global $custname, $custid;
$custid = $_GET['custid'];
$custname = $_GET['custname'];
DO SOME STUFF
}
[code end]
Or am I way off and there is another way of doing it?

Also I've noticed that when I do an mysql_query("select name from foo
where name='$somevariable'") I cannot use $_GET['somevariable'] or
$_POST['somevariable'] in the sql string, I find I need to do a $name =
$_GET['somevariable'] first and then use $name.  Why is this?
Thanks,

Jeff

 

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


Re: [PHP] dir size

2003-10-03 Thread Nathan Taylor
Hey, I think I mis-understood you and my first version didn't do what you want, so I 
added what you needed.

 0) {
   $open2 = opendir($directory);
   while($folders = readdir($open2)) {
$folder = $directory."/".$folders;
if($folders == ".." || $folders == ".") continue;
if(is_dir($folder)) {
 echo DirStat($folder);
}
   }
   closedir($open2);
  }
  closedir($open);
 }
}

function ByteSize($bytes) {
  $size = $bytes / 1024;
  if($size < 1024){
   $size = number_format($size, 2);
   $size .= "kb";
  } else {
   if($size / 1024 < 1024) {
$size = number_format($size / 1024, 2);
$size .= "mb";
   } else {
$size = number_format($size / 1024 / 1024, 2);
$size .= "gb";
   }
  }
  return $size;
 }

$dir = getcwd();
DirStat("tmp", 0);
chdir($dir);

$FolderSize = ByteParse($FolderSize);

echo $FileCount;
echo "\n";
echo $FolderSize;

?>


The DirStat() function is almost unchanged except that it now passes out the byte size 
of the directories read. I also threw in a chdir() to get you back to your working 
directory. The major addition here is the ByteSize() function.  That function takes 
the integer which is your total size of the directory and converts it into a nice 
formatted number either in kb, mb, or gb accordingly.  You'll find it uses true file 
size as well, not "industry standard" sizing.

Enjoy,
Nathan Taylor
  - Original Message - 
  From: Ms Carlsson 
  To: [EMAIL PROTECTED] 
  Sent: Friday, October 03, 2003 2:44 PM
  Subject: [PHP] dir size


  is it possible to count  a size of a dir and all sub dirs in php ? and if, 
  how?

  thanx

  _
  Lättare att hitta drömresan med MSN Resor http://www.msn.se/resor/

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



Re: [PHP] User Authentication Continued....

2003-10-03 Thread Chris Shiflett
--- Jeff McKeon <[EMAIL PROTECTED]> wrote:
> The problem I'm having is with the $_GET variables. I guess I'm not
> declaring them correctly. Do I need to set them as soon as the page
> loads, and outside of any functions like so..
> 
> [code start]
> $custid = $_GET['custid'];
> $custname = $_GET['custname'];
> [code end]
> 
> Or do I need to declare them in each funtion?
> 
> [code start]
> Function blah(){
>   global $custname, $custid;
> 
>   $custid = $_GET['custid'];
>   $custname = $_GET['custname'];
>   DO SOME STUFF
> }

$_GET is a superglobal, which just means that it is always available
everywhere. If you assign $custname to $_GET['custname'], you now have a
regular global variable (if the assignment is done outside a function) or a
local variable (if the assignment is done within a function).

So, either just use $_GET['custname'] everywhere you need it, or work with the
variable scope like you would have to if it was anything else. For example:

1. $foo = $_GET['foo'];
2. $foo = 'bar';

The variable scope of $foo would be the same, regardless of which of those
assignments were made.

Hope that helps.

Chris

=
My Blog
 http://shiflett.org/
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

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



Re: [PHP] PHP coders spare time [OT}

2003-10-03 Thread Ryan A
Hey Curt,
Just had a look at it, really cool stuff.

If you decide to release the code let me know as i am sure I (and quite a
few others) will learn a few things from it, if not, its still a very very
nice bunch of scripts.

While there I had a funny thought, if for whatever reason the php list
closes downJohn Holmes is probably gonna kill himself :-D with the spare
time he will suddenly find himself having!

Cheers,
-Ryan

> From: "Curt Zirzow" <[EMAIL PROTECTED]>
>
> > Something like this:
> >   http://zirzow.dyndns.org/html/mlists/php_general/
> >
> > I had to build some cache tables, grouping 141852 records on the
> > fly just wasn't fast enough, excpecially  for my 233.
>
> Looks good to me. :)
>
> I also have 8 posts under [EMAIL PROTECTED], for the record. :D
>
> ---John Holmes...
>
> -- 
> 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 center image in PDF (fpdf) using Image() in PHP....

2003-10-03 Thread Scott Fletcher
Hi!

I tried out the Free PDF Library for creating the PDF at www.fpdf.org
and it showed the php function, Image() and I read the documentation on this
Image() on what paramenters are being used inside this function but what I
found instead is that the X,Y coordinate is specified only from the
upper-left corner.  So, the question is how do I know what is the total
width of a page in PDF, so I can whip up a php code to give me the center
code of an image and enter it into the Image() function.

The document showed...

--snip--
Image(string file, float x, float y, float w [, float h [, string type [,
mixed link]]])
--snip--

Thanks...
 Scott F.

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



Re: [PHP] How to center image in PDF (fpdf) using Image() in PHP....

2003-10-03 Thread Jason Wong
On Saturday 04 October 2003 04:03, Scott Fletcher wrote:

> I tried out the Free PDF Library for creating the PDF at www.fpdf.org
> and it showed the php function, Image() and I read the documentation on
> this Image() on what paramenters are being used inside this function but
> what I found instead is that the X,Y coordinate is specified only from the
> upper-left corner.  So, the question is how do I know what is the total
> width of a page in PDF, so I can whip up a php code to give me the center
> code of an image and enter it into the Image() function.
>
> The document showed...
>
> --snip--
> Image(string file, float x, float y, float w [, float h [, string type [,
> mixed link]]])
> --snip--

You would be *far* better off asking on the FPDF forum.

-- 
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-general
--
/*
For every credibility gap, there is a gullibility fill.
-- R. Clopton
*/

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



Re: [PHP] PHP coders spare time [OT}

2003-10-03 Thread CPT John W. Holmes
From: "Ryan A" <[EMAIL PROTECTED]>

> While there I had a funny thought, if for whatever reason the php list
> closes downJohn Holmes is probably gonna kill himself :-D with the
spare
> time he will suddenly find himself having!

Naa... I'd just go learn ASP, since pigs would be flying and all.

I just hope my wife or boss (the same?) doesn't find this list! :)

---John Holmes...

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



  1   2   >